Add IP Address Range to Your Server (CentOS/Ubuntu/Debian)


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 /etc/sysconfig/network-scripts/ifcfg-eth0-range0 (eth0 being the default adapter, make sure to use the correct adapter name) and add the following lines:


What you want to do is replace the IPADDR_START variable with the beginning of your IP range, and IPADDR_END respectively.

It should look like the following after filling the variables (the variables are filled with an example /24 block, or 256 addresses):


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:

/etc/init.d/network restart


service network restart


Using your favorite text editor, open /etc/network/interfaces.

Add the following ( being the example address):

iface eth0 inet staticaddress

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:

ip addr

This concludes our tutorial. Thank you for reading.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.