Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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, 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.

share|improve this question

migrated from Jun 14 '11 at 4:16

This question came from our site for professional and enthusiast programmers.

Isn't this more of a serverfault question? – joeforker Jun 14 '11 at 13:31
up vote 3 down vote accepted

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.

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


share|improve this answer

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

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.

share|improve this answer

The best document I was able to find is RFC 3484 Default Address Selection for IPv6 and its draft revision

share|improve this answer

You must log in to answer this question.

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