Adding and viewing IP addresses on CentOS servers

To add newly assigned IP addresses from SSH, follow this procedure:

(Please follow the steps given below only on a Centos / Fedora.)

  • Login to your server with SSH as root.
  • Go to the /etc/sysconfig/network-scripts directory.
cd  /etc/sysconfig/network-scripts/

Verify which interface you will use to add IP addresses. Typically, this will be eth0 for public IP addresses.

/sbin/ifconfig

Make a copy of ifcfg-eth0 for each IP you wish to add and name them as ifcfg-eth0:0, ifcfg-eth0:1 etc.

cp ifcfg-eth0 ifcfg-eth0:0 
cp ifcfg-eth0 ifcfg-eth0:1
cp ifcfg-eth0 ifcfg-eth0:2
cp ifcfg-eth0 ifcfg-eth0:3
cp ifcfg-eth0 ifcfg-eth0:4

Open each of them and change the fields DEVICE, .IPADDR and NETMASK accordingly.

A sample entry would look like this:

DEVICE=eth0:0
BOOTPROTO=static
IPADDR=34.123.111.21
NETMASK=255.255.255.0
ONBOOT=yes

Restart the network:

/etc/init.d/network restart

To verify what are the IP addresses assigned to your server, please use the following command:
/sbin/ifconfig
  • 45 Users Found This Useful
Was this answer helpful?

Related Articles

How to Backup VOS3000 Database and download to your local PC

Login to your server Via SSH ( You can use Putty...

How to Change SSH Port in Centos

Login into your Server Via Putty or any SSH client.type in following commandvi...

How to Reset Mysql passowrd

Step # 1 : Stop mysql service # /etc/init.d/mysql stopOutput: Stopping MySQL database server:...

Linux OS login software [putty]

Please click the link for download Putty software.  If this is not working then copy and paste...

How to reset root password CentOS

1. Boot the system and when you see the following message "Press any key to enter the menu",press...