Add an IP address to CentOS server
Sometimes due to business growth or testing purposes, we do need an IP address assigned to the server interface. When I came across with adding IP to server, it was little annoying. I followed many number of Google results but ended with wrong configuration.
Finally I myself found out that simply restarting network after adding IP address would be enough.
To add IP,
Make a copy of existing interface config in /etc/sysconfig/network-scripts/ifcfg-eth0 to ifcfg-eth0:0
Get in to the folder,
#cd /etc/sysconfig/netwok-scripts
#cp ifcfg-eth0 ifcfg-eth0:0
Edit newly created interface,
#nano ifcfg-eth0:0
Change the device to eth0:0
And change the IP address,
# Please read /usr/share/doc/initscripts-*/sysconfig.txt
# for the documentation of these parameters.
TYPE=Ethernet
DEVICE=eth0:0
HWADDR=xx:xx:xx:xx:xx:xx
BOOTPROTO=none
NETMASK=255.255.255.0
IPADDR=192.168.1.12
Save and close the file.
Finally restart network as /etc/init.d/network restart
Verify the added IP by running ifconfig
No comments:
Post a Comment