Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would I go about adding 3 IP's to my eth0.

When I tried the following, the whole network crashed.

ifconfig eth0 netmask gateway

How would I go about adding more IP's to my CentOS server?

share|improve this question
Can you explain a bit more about what you're trying to do? – ewwhite Jan 26 '13 at 3:15
Is this a duplicate of… ? – Edwin Jan 26 '13 at 3:30
No, this seems a valid question of someone who thinks ifconfig adds addresses to an interface instead of replacing the current config... – Sander Steffann Jan 26 '13 at 12:51

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 netmask

The second is using ip:

ip addr add 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:

share|improve this answer
According to section 9.2.7 of the RHEL6 manuals, using the "alias" files is no longer considered best practice. For IPv6, there is a IPV6ADDR_SECONDARIES directive that can be added to the base /etc/sysconfig/network-scripts/ifcfg-* file. But I'm not sure what the directive is for IPv4. – tgharold Dec 23 '13 at 17:42

I recently wrote a post on how to add an IP address / multiple IP's to an interface in CentOS.

Hope that helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.