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

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

How to Add IP Address on CentOS Operating Systems?

Follow These Steps to Add IP Adress on CentOS

To add a new IP into your environment you firstly need to locate network configuration directory. To access it use:

cd /etc/sysconfig/network-scripts/

To add new IP first you need to copy ifcfg-eth0 file by creating new file ifcfg-eth0:0. Use following command:

cp ifcfg-eth0 ifcfg-eth0:0

Now it’s time to edit the file you’ve copied. Enter:

vi ifcfg-eth0:0

This command will open the file with Linux text editor (if you prefer another text editor you can choose nano). Look at the lines which should be in the file and the changes which should be applied:

DEVICE=”eth0″ change into DEVICE=”eth0:0″
IPADDR= contains the IP which you want to add
NETMASK= for example if you have IP from /24 subnet then netmask will be

GATEWAY= also include the gateway

To save the changes enter:


Make sure that all configurations are correct and after adding required IP restart the network by using the following command:

/etc/init.d/network restart

That’s it. You’ve added a new IP address to your server with CentOS.

Rate this Tutorial:
No Comments

Other (3)

Popular Keywords