Why IPv6 allows a single interface with multiple addresses?

Simon Gong picture Simon Gong · Mar 27, 2012 · Viewed 28.6k times · Source

"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!

Answer

Celada picture Celada · Mar 27, 2012

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.