In this tutorial, we will cover the process of adding an entire IP range/subnet to a Linux server running CentOS, Debian, or Ubuntu. The process is rather simple and takes no more than 10 minutes to complete.
Using your favorite text editor, create or edit
eth0 being the default adapter, make sure to use the correct adapter name) and add the following lines:
IPADDR_START= IPADDR_END= CLONENUM_START=0 NETMASK=255.255.255.0
What you want to do is replace the
IPADDR_START variable with the beginning of your IP range, and
It should look like the following after filling the variables (the variables are filled with an example
/24 block, or 256 addresses):
IPADDR_START=192.0.2.0 IPADDR_END=192.0.2.256 CLONENUM_START=0 NETMASK=255.255.255.0
Note: The netmask depends on the subnet size. You can use Vultr’s Subnet Calculator.
Save the configuration and close the file.
Restart the networking service:
service network restart
Using your favorite text editor, open
Add the following (192.0.2.0 being the example address):
iface eth0 inet static address 192.0.2.0/24
Exit and save. Now, reboot the system:
shutdown -r now
You should be able to see the addresses under the interface by running the following command:
This concludes our tutorial. Thank you for reading.
Want to contribute?
You could earn up to $300 by adding new articles
Suggest an update
Request an article