25

"A single interface may also have multiple IPv6 addresses of any type(unicast, anycast, and multicast) or scope" ----quoted form RFC 4291

Recently I came across this question during the experiment I proceeded. I went through RFC 4291, with no clue...

Here is the brief intro of my experiment:
There are two hosts, and I have two IPv6 address assigned to them respectively. Then, I tested the connectivity between the two hosts. I use the command "ping6 ipv6_addr". But it turns out that it can't get to both of the address of peer host with command ping6.

More perceptive with examples*(both command execute at host A, with linux kenel 2.6.32)*:
ping6 addr_b_1 --- it works
ping6 addr_b_2 --- couldn't get through

There are two questions I want to discuss with you guys:
1. why should ipv6 protocol allow this kind of mechanism, a single interface with multiple address?
2. Why can't I get to both of the addresses of host a, at the same time.(which should have been the case. Default address selection for IPv6 is defined in RFC 3484)

Thank you guys!

Simon Gong
  • 428
  • 1
  • 4
  • 10
  • Simple answer: Because IPv6 makes it possible. This wasn't really feasible with the "low" number of available IPv4 addresses, but with the number of IPv6 adresses, this is not an issue. So simple: "Because they can". – LiKao Mar 27 '12 at 11:56
  • @LiKao ok...but it seems that this kind of ability brings more cons than pros, from my experience. And make many kinds of experiments take more scenario into account – Simon Gong Mar 27 '12 at 12:53
  • 2
    No version of IP can compensate for the sysadmin screwing up the routing tables. – Ignacio Vazquez-Abrams Mar 27 '12 at 16:25
  • 1
    @LiKao, we routinely had 5 or 6 IPv4 addresses on our Sun's interfaces. Early Linux, hadn't tried before with SunOS. – vonbrand Oct 07 '15 at 23:24
  • 1
    This has nothing whatsoever to do with *programming*. – vonbrand Oct 07 '15 at 23:25
  • @vonbrand: I agree. This is more suitable for SuperUser or NetworkEngineering than StackOverflow. – StockB May 02 '16 at 15:17

1 Answers1

50

Early IPv4 stacks didn't support more than one IP address per interface. Later improvements enabled "secondary" addresses. This was found to be very useful in practice, and the designers of IPv6 choose to mandate support for it as part of the standard so that you could always count on it being possible.

The designers of IPv6 did more than just mandate it. They made it an important part of the IPv6 protocol. Every IPv6 interface has a link-local IP address. If the interface is also able to communicate on a larger network (such as the Internet) then it also has a global scope address. That's two addresses minimum, right there. And if the host is behind a multihomed Internet connection, it probably has even more addresses. Multiple IP addresses per interface was not an afterthought in IPv6 like it was in IPv4.

You mention cons, but barring misconfigurations, I don't see this situation causing any problems. (Maybe you could elaborate on your setup and why one IP address works but not the other; however I guarantee you have some kind of error that's causing it).

On the other hand, think of the advantages:

  • Devices can discover each other on the local LAN using the link-local addresses even if there is no network infrastructure (i.e. router) available. Later, if a router is added and global scope addresses become available, these addresses augment the address set, they do not replace the link-local addresses; so existing communications using the link-local addresses are not disrupted.
  • When an Internet connection is dropped, added, or replaced, one IP address from the set can be withdrawn or added without affecting the others. Thanks to the "depracated" state, this enables a graceful renumbering from one IP address to another, with the interface supporting both for a period of time.

Also: keep in mind that almost all IPv4 stacks support multiple addresses per interface too, so this is not a big difference between v4 and v6. It's only really old v4 stacks that don't support it. The difference is that v6 has methods of managing the set of addresses automatically, but this doesn't exist in v4.

Montag451
  • 1,168
  • 3
  • 14
  • 30
Celada
  • 21,627
  • 4
  • 64
  • 78
  • Well, one actual con is that it can complicate the choice of source IP address for a given connection... – SamB Mar 27 '12 at 20:27
  • @SamB it's no more complicated than the case of MULTIPLE interfaces each with ONE IP address. The source address selection algorithm is well specified, and covers both cases. – Celada Mar 27 '12 at 20:57
  • @Celada thank you, you really help me clear out some of my confusions about multi-address in IP stack. Specifically, I'm simulating a multihoming scenario to do some work. So it seems that I really have something misconfigured, because, when I first set the testbed up, both of the two address set can get through each other well. But afterwards, it fails. I will check all the details out then. ^_^ – Simon Gong Mar 28 '12 at 00:54
  • 1
    Is there a top limit on how many IPv6 addresses can be configured on a given interface? – user31986 Jun 23 '16 at 20:28
  • 2
    @user31986 that'll be an OS-specific detail, and I'm not really sure, but on Linux `/proc/sys/net/ipv6/conf/default/max_addresses` suggests 16 for me. – Celada Jul 17 '16 at 11:49