Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why IPv6 allows a single interface with multiple addresses? [closed]

Tags:

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

like image 286
Simon Gong Avatar asked Mar 27 '12 09:03

Simon Gong


People also ask

Can a single interface have multiple IPv6 addresses?

It's completely normal to have multiple IPv6 addresses on one interface. Every interface with IPv6 is required to have a link-local FE80 address, and there's an algorithm that defines which address of those multiple addresses to use as source address.

Why does a device have multiple IPv6 addresses?

It's completely normal to have multiple IPv6 addresses on one device. A device generates new 64 bits every once in a while and uses that in the IPv6 address. Because new addresses are generated regularly the addresses are marked as temporary interfaces.

How many addresses can IPv6 handle?

The size of an IPv6 address is 128 bits, compared to 32 bits in IPv4. The address space therefore has 2128=340,282,366,920,938,463,463,374,607,431,768,211,456 addresses (approximately 3.4×1038).


1 Answers

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.

like image 100
Celada Avatar answered Sep 19 '22 11:09

Celada