5

How does Linux choose which of possibly many IPv6 source addresses to use when connecting to another site? I am opening connections to 6to4 and non-6to4 sites from a host configured with both a 6to4 and a non-6to4 address.

My Linux box was configured with 6to4 and non-6to4 IPv6 addresses and it did indeed seem to pick the 6to4 source address when connecting to another 6to4 host, and the non-6to4 address when connecting to a non-6to4 host. This was faster because both directions of the 6to4 link were able to bypass the tunnel server. I wasn't sure if I was just getting lucky or if this was the expected behavior.

An iPad with the same IPv6 route advertisements chose to use IPv4 even when connecting to sites like ipv6.he.net, so I don't advertise the 6to4 route anymore. The local router still has its own 6to4 gateway to bypass the tunnel for outgoing 6to4.

1
  • Isn't this more of a serverfault question?
    – joeforker
    Jun 14, 2011 at 13:31

3 Answers 3

4

The best document on this is from Ulrich Drepper, he describes the gai.conf, the relationship with RFC 3484, the connection of glibc getaddrinfo(3) and kernel address selection.

http://www.akkadia.org/drepper/linux-rfc3484.html

BTW: iproute2 supports in later versions the gai.conf file, use ip addrlabel show command. You can find some samples in this article:

Greetings
Bernd

1

The routing table, in addition the scope identifier is used for link-local scope addresses.

http://en.wikipedia.org/wiki/Routing_table

http://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices

edit: As an interesting addendum, I found recently that the TCP stack has more strict requirements than UDP or datagrams. With UDP you can quite frequently avoid the scope identifier if the address is obvious on the host, however TCP does not allow you this freedom at all, the identifier must always be specified.

0

The best document I was able to find is RFC 3484 Default Address Selection for IPv6 and its draft revision https://datatracker.ietf.org/doc/html/draft-ietf-6man-rfc3484-revise-03

You must log in to answer this question.

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