Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

Currently I am stuck trying to label the interfaces for additional IP addresses I am adding to an interface. Let's say the interface is eth0 ($IFACE), then for $ADDRFAM="inet" I can add an IPv4 address to a labeled alias of eth0 like this:

ip -f $ADDRFAM addr add dev $IFACE:test label $IFACE:test

which translates to

ip -f inet addr add dev eth0:test label eth0:test

where the -f inet, i.e. IPv4, is implied and could be left out.

A cursory check with ifconfig yields:

eth0:test Link encap:Ethernet  HWaddr AA:BB:CC:DD:EE:FF
          inet addr:  Bcast:  Mask:

Trying something similar with IPv6 ($ADDRFAM="inet6"):

ip -f $ADDRFAM addr add fdbf:98fc:66a5:de67::1/128 dev $IFACE:test label $IFACE:test

which expands to

ip -f inet6 addr add fdbf:98fc:66a5:de67::1/128 dev eth0:test label eth0:test

indicates no failure, but doesn't yield the expected result either:

eth0      Link encap:Ethernet  HWaddr AA:BB:CC:DD:EE:FF
          inet6 addr: fdbf:98fc:66a5:de67::1/128 Scope:Global
          RX packets:5641 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5483 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:792232 (792.2 KB)  TX bytes:861177 (861.1 KB)

eth0:test Link encap:Ethernet  HWaddr AA:BB:CC:DD:EE:FF
          inet addr:  Bcast:  Mask:

What gives? Why does the labeling not give the expected effect of listing the address under eth0:test?

For comparison, the respective lines from ip addr look like this:

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    inet scope global eth0:test
       valid_lft forever preferred_lft forever
    inet6 fdbf:98fc:66a5:de67::1/128 scope global
       valid_lft forever preferred_lft forever
share|improve this question
You should not be using old-style interface aliases at all anymore, (they contain a colon) despite that there are millions of outdated tutorials out there. All your IP addresses should be directly on the interface. – Michael Hampton May 7 '14 at 2:29
@MichaelHampton: why? The documentation states only a single thing about this, that there are old-style (legacy style) aliases and that you can add more iface ... blocks to add more addresses (examples only given gor IPv4). Alas, even that doesn't work with IPv6. Not to mention that it prevents me from giving sensible names to the interfaces. – 0xC0000022L May 7 '14 at 9:33
If you want to rename the interface, then just rename the interface rather than making aliases. – Michael Hampton May 7 '14 at 12:11
@MichaelHampton: you do realize that I was asking for different names for the different public IP addresses? Which means I do not merely want to rename the physical interface. In fact I don't care whether that's called eth0 or em1 or whatever. What I am interested is to group the public IPv4/IPv6 pairs into aliases of meaningful names. But you made a claim and still haven't provided any reasons. Also: this clearly indicates that the examples coming with Ubuntu as well as the man pages in Ubuntu are equally outdated as the ominous tutorials you're referring to (which I haven't seen). – 0xC0000022L May 7 '14 at 14:20

I realize this answer is for different flavors of 'NIX but I'll take a second stab and see if this helps.

Q. How do I add multiple IPv6 address to eth0 under Red Hat / Fedora / RHEL / CentOS Linux for virtual hosting?

A. There are two ways to add network aliaes under Red hat / CentOS Linux system. You need to edit any one of the following file in order to add IPv6 network alias.

/etc/rc.local - Use ifconfig command and shell loop.
/etc/sysconfig/network-scripts/ifcfg-eth0 - Set special variable called IPV6ADDR_SECONDARIES for eth0 virtual hosting (network alias).

First, setup IPv6 main server IP address and default router. Once basic IPv6 connectivity established you can setup aliases for NIC. /etc/rc.local configuration

To add 2607:f0d0:1002:11::10 to 2607:f0d0:1002:11::50 (total 40) virtual aliases, open /etc/rc.local file, enter:

vi /etc/rc.local

Append following code:

IP Alias

for ip in {10..40}; do /sbin/ifconfig eth0 inet6 add 2607:f0d0:1002:11::${ip}/64; done

You can type the same command at a shell prompt to immediately activate network aliases. Or create a shell script and call it from /etc/rc.local itself:


INETP="2607:f0d0:1002:11::" PRE="64" START=2 END=200 INT_IF="eth0" IFCONFIG=/sbin/ifconfig echo -n "Adding IPv6 Alias..." for i in {$START..$END} do $IFCONFIG $INT_IF inet6 add ${INETP}${i}/${PRE} done echo "Done!"

sysv style configuration

Open network interface configuration file, enter:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Append a list of secondary IPv6 addresses following code (set 5 aliases):

IPV6ADDR_SECONDARIES="2607:f0d0:1002:11::10/64 \ 2607:f0d0:1002:11::11/64 \ 2607:f0d0:1002:11::12/64 \ 2607:f0d0:1002:11::13/64 \ 2607:f0d0:1002:11::14/64"

Save and close the file. Restart networking:

/etc/init.d/network restart

So it seems the IPV6 address is an alias in and of itself.


share|improve this answer
I think you are mixing up concepts, due to the similar name! Please read that man page yourself first. Of course I will be happy if you can point out how this connects to what I am trying to do. Also see ... this is what ip-addrlabel is all about. – 0xC0000022L May 6 '14 at 23:18
@0xC0000022L my apologies I obviously have no idea what you are trying to do. Perhaps you could elaborate? Thank you – Elder Geek May 6 '14 at 23:26
Try to follow the :test (or eth0:test) in the commands and outputs inside my question. The address label your answer is about is in a sense related precedence ("address selection"), not to labeling as in "naming". I am trying to name the interfaces (and aliases) in IPv6 as I can do in IPv4. – 0xC0000022L May 6 '14 at 23:28
thanks for taking the time to write up an answer anyway. – 0xC0000022L May 6 '14 at 23:47
Does this help? – Elder Geek May 6 '14 at 23:49

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.