2

When I add an IPv4 address for the interface eth0:0 with ifconfig, it is created correctly:

ifconfig eth0:0 add 192.168.10.10

This can be verified by ifconfig or "ip a".

When I add an IPv6 address however, ifconfig seems to ignore the alias of the interface:

ifconfig eth0:0 add fc00::2/48

The address fc00::2/48 is added to eth0 then, not to eth0:0, no matter if eth0:0 previously exists with an IPv4 address or not.

I'm doing this on CentOS 5 but I guess it is a general behaviour of ifconfig? Am I doing something wrong or is this by intention? I'm using separate aliases for interfaces very often and I hoped to use it for IPv6 as well.

Kind regards Marten

1 Answer 1

3

This is intentional. The aliases were added because in IPv4 you could usually only have one IP address on an interface. The aliases were added to work around that. With IPv6 multiple addresses per interface are very normal so the aliases are not used anymore.

The ifconfig tool is not the easiest tool to manage this though. The ip tool makes this much easier.

This is how you show the current addresses:

# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:0c:29:75:36:4e brd ff:ff:ff:ff:ff:ff
    inet 83.137.17.100/26 brd 83.137.17.127 scope global eth0
    inet6 2001:4038:0:16::16/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe75:364e/64 scope link 
       valid_lft forever preferred_lft forever

You can add an extra address like this:

# ip addr add 2001:db8::1/64 dev eth0

And it just shows up as one of the addresses in the list:

# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:0c:29:75:36:4e brd ff:ff:ff:ff:ff:ff
    inet 83.137.17.100/26 brd 83.137.17.127 scope global eth0
    inet6 2001:db8::1/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 2001:4038:0:16::16/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe75:364e/64 scope link 
       valid_lft forever preferred_lft forever
2
  • The point is, that I don't actually want to add and remove interfaces or IP addresses manually by calling ip or ifconfig. In RHEL or CentOS, you can have dozends of single files in /etc/sysconfig/network-scripts, each defining the configuration for one interfaces like eth0:24. On Ubuntu, you can add a line like "source interfaces.d/*" to /etc/network/interfaces with the same effect. That way you don't have to restart the whole network configuration to add or remove an IP address, but you can do it by adding or removing single interface definitions.
    – Marten Lehmann
    Sep 19, 2012 at 13:06
  • Using eth0:x should still work. The IPv4 addresses show up on that interface, the IPv6 addresses show up on the eth0 interface itself. In the end it all works :) Oct 26, 2014 at 15:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .