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

I've recently installed Gentoo on a dedicated server. I have 6 IPs, and I forgot to write down one config before I erased the CentOS install.

Should I have
eth0 = ip1
eth0:0 = ip2
eth0:1 = ip3
eth0:2 = ip4
eth0:3 = ip5
eth0:4 = ip6

or should I have eth0:0 sharing the main IP?
eth0 = ip1
eth0:0 = ip1
eth0:1 = ip2
eth0:2 = ip3
eth0:3 = ip4
eth0:4 = ip5
eth0:5 = ip6

share|improve this question
up vote 6 down vote accepted

You DON'T need interface aliases in order to have multiple IP addresses for the same server. You should use interface aliases mostly if you are dealing with separate subnets and need to route between the addresses, which doesn't seem to be the case.

With Linux (since 2.2 or 2.4, I don't remember) a single interface may have many addresses. This is the preferred way of setting it up. There are issues with the multiple aliases setup, for example, it is not clear how a broadcast message should be handled if multiple aliases are on the same subnet.

I don't know how you set this in Gentoo configuration, but using the standard ip interface, it is simple:

ip addr add ip1/prefix brd + dev eth0
ip addr add ip2/prefix dev eth0
ip addr add ip3/prefix dev eth0
ip addr add ip4/prefix dev eth0
ip addr add ip5/prefix dev eth0
ip addr add ip6/prefix dev eth0

Note 1: Broadcasts will be received only by the first address. If your addresses are on different subnets, you may want to set broadcasts on the other IPs also.

Note 2: ifconfig won't probably show the additional addresses, it is obsolete anyways. Use ip addr show to check which addresses are assigned to each network interface.

Anyways, answering your question: no. Each alias is viewed as a different interface for the system. So eth0 would be one interface, with one address, eth0:0 would be another interface with another address and so on.

share|improve this answer
For a gold star, can anyone tell me how you'd do this in Debian/Ubuntu's /etc/network/interfaces config file? – thomasrutter Apr 29 '10 at 5:44
Found it! Have just one iface section and add an "up" subsection with "ip addr add..." - seen here… – thomasrutter Apr 29 '10 at 13:25

Each entry should be unique.

eth0 = ip1
eth0:0 = ip2
eth0:1 = ip3
eth0:2 = ip4
eth0:3 = ip5
eth0:4 = ip6
share|improve this answer
Yes, seconded, they should. – edomaur Aug 29 '09 at 6:38

Each must be unique. The number after the colon is arbitrary and the numbers need not be sequential. In fact, they don't even have to be numbers at all. From Documentation/networking/alias.txt in the Linux source:

An alias is formed by adding a colon and a string when running ifconfig.
This string is usually numeric, but this is not a must.

share|improve this answer

I agree with Juliano. In Gentoo, you can configure this with /etc/conf.d/net and then set config_eth0 with multiple space seperated ips. The line should look like this: config_eth0=( "" "" "" )

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.