How would I go about adding 3 IP's to my eth0.
When I tried the following, the whole network crashed.
ifconfig eth0 192.95.22.105 netmask 255.255.255.0 gateway 198.27.64.254
How would I go about adding more IP's to my CentOS server?
How would I go about adding 3 IP's to my eth0.
When I tried the following, the whole network crashed.
ifconfig eth0 192.95.22.105 netmask 255.255.255.0 gateway 198.27.64.254
How would I go about adding more IP's to my CentOS server?
when you issued this command you overwritten your actual interface configuration.
There are two ways of adding the IPs manually, and temporary. First using ifconfig
:
ifconfig eth0:1 192.168.1.10 netmask 255.255.255.0
The second is using ip
:
ip addr add 192.168.1.10/24 dev eth0
note that, unless your secondary IP address is in a completely different network, you don't need to provide the gateway. And, is also worth noting that your gateway must be on the same network of your interface address.
To have your configuration made permanent you have to create the proper files at /etc/sysconfig/network-scripts
. The files are named as ifcfg-eth0:X
where X is the number of the alias.
You may get more info here: http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s1-networkscripts-files.html
I recently wrote a post on how to add an IP address / multiple IP's to an interface in CentOS.
Hope that helps.