HowTo: Add Additional IPs

How to add multiple IPs on an Ethernet network interface card i.e. eth0? OR

How to add additional IPs on a Linux server?

People find it rather hard to add the IPs manually on a Plain server. Following are the steps you can follow to add a range of IPs on a CentOS server:

1 ) Change directory to /etc/sysconfig/network-scripts/ using the ‘cd’ command:

cd /etc/sysconfig/network-scripts/ (this directory contains Interface configuration files)

2) Create a file ifcfg-eth0-range0 using your favorite text editor like ‘pico’

pico ifcfg-eth0-range0

3) Add the following lines to the file:

IPADDR_START=1.1.1.10
IPADDR_END=1.1.1.20
CLONENUM_START=1

where,

IPADDR_START is the first IP in the range.
IPADDR_END is the last IP in the range.
CLONENUM_START=1, where 1 will start adding IPs from eth0:1

4) Save and exit the file.

5) You now need to execute “ifup-aliases” script for the range of IPs to take affect. Execute the following command:

./ifup-aliases eth0

This will add the IPs on eth0 and will bring all the virtual interfaces up. You can view all the interfaces using the “ifconfig” command.

This entry was posted on Friday, September 11th, 2009 and is filed under Linux Administration. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.