Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
Isn't this more of a serverfault question? –  joeforker Jun 14 '11 at 13:31
add comment

migrated from stackoverflow.com Jun 14 '11 at 4:16

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

3 Answers

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.

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.