If you want to add the IPs to a Linux system through command line interface(manually).
This steps can be pretty useful if you are not having any control panel, such as cPanel, that has a feature to adds ips. If your main ethernet device is eth1 instead of eth0 simply substitute eth1 for eth0.
Other then that should be pretty simple to follow, this should work on any standard redhat/centos based system.
Login to the server with root privileges then simply follow theses steps to add a new ip address to any linux redhat based system.
Quote:
cd /etc/sysconfig/network-scripts
Then as precautionary measure take a backup of the file
cp ifcfg-eth0 ifcfg-eth0.bak
Then copy the config for your new IP
cp ifcfg-eth0 ifcfg-eth0:1
Then we need to edit the new config
vi ifcfg-eth0:1
The lines you need to change:
DEVICE="eth0"
to
DEVICE="eth0:1"
Then change the Ip address value to the new IP thate you wish to add.
IPADDR="xxx.xxx.xxx.xxx"
to be your NEW ip address (it will have your primary ip listed)
This will have saved the config for you and the interface is ready to be brought up. This is done with
/sbin/ifup eth0:1
Having done this if you type
/sbin/ifconfig
You should see something like
------code------
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addrxx.xxx.xxx.xxx Bcastxx.xxx.xxx.xxx Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:55818546 errors:0 dropped:0 overruns:0 frame:0
TX packets:46167836 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:3299680715 (3146.8 Mb) TX bytes:1890963825 (1803.3 Mb)
Interrupt:11 Base address:0xd000
eth0:1 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:NEW.IP.ADDRESS Bcastxx.xxx.xxx.xxx Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:11 Base address:0xd000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:241244 errors:0 dropped:0 overruns:0 frame:0
TX packets:241244 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:66571100 (63.4 Mb) TX bytes:66571100 (63.4 Mb)
------/code------
|
If you then try to ping your new ip it should all work fine
This should also restart eth0:1 on a reboot as its a direct copy of the eth0 config. So checking for the ONBOOT="yes" in the file ifcfg-eth0:1 will ensure it DOES come back up on a reboot.