We use cookies to improve our services and provide a better experience. By continuing to use this site, you agree with our Cookies Policy.

Tutorials
More than 400 step-by-step articles to guide you through online project development.
HomeTutorialsOperating SystemsLinuxAdministration

How to add IP address on CentOS

In order to add an additional IP address to your system you will have to create a new eth0 interface file with an additional number in the name and fill it with network information. For example standart file name is ifcfg-eth0 and a new file name should be ifcfg-eth0:1. The file must be put in the directory /etc/sysconfig/network-scripts/.

Step 1 – Simply use your favorite text editor and create a file:

  • nano /etc/sysconfig/network-scripts/ifcfg-eth0:1 – remember that the number differs depending on how many additional IP’s you already have. If you have 7 IP’s already and you want to add 8th the file name will be ifcfg-eth0:8

 

Step 2 – Fill the file with network information. The file should look something like this:

DEVICE=eth0:1
BOOTPROTO=static
IPADDR=10.10.10.11
NETMASK=255.255.255.0
NETWORK=10.10.10.0
ONBOOT=yes

Take note that field DEVICE must be equal to the files name extention. For example if files name is ifcfg-eth0:1 the field DEVICE should be equal to eth0:1.

Step 3 – to active the settings use simple command:

  • ifup eth0:1 – Change part eth0:1 depending on which interface file you want to active.
Rate this Tutorial:
No CommentsLeave a Comment

Other (3)

Popular Keywords