Hi rhkramer, On Sun, Oct 09, 2016 at 04:23:45PM -0400, rhkra...@gmail.com wrote: > I'm not the OP, and I'm sort of piggybacking and going somewhat (or a lot?) > OT,
In that case it would be good to change the subject of the email. I've done so here. > but I am curious about how old inet4 (right term?) and the new > inet6 addresses interact. As the address family for IPv4 is "inet" (vs "inet6"), you could say "inet", but then it may not be so obvious that you were intending to make a distinction between IPv4 and IPv6. So, perhaps "inet4" is not so bad, or IPv4. Some go as far as to say "legacy". :) > When I do ifconfig, I see that eth0 has both a 32 bit (e.g., 192.168.1.19) > and > an inet6 address assigned. On Linux, it would be best to get used to using the "ip" command rather than "ifconfig". Issuing an "ip address" command will get you all the configured addresses of the various families. > Can anybody point me to a fairly short document that explains things like > which gets used under what circumstances If we restrict the domain of this question to source address selection then reading around from this point may help: http://linux-ip.net/html/routing-saddr-selection.html > does one have precedence over the other, Clearly if there is just one inet address and one inet6 address, then which will be chosen depends on which family the destination address comes from. i.e., if the destination is an inet6 address then the source address will have to be an inet6 address as well, otherwise no communication will be possible¹. If the destination address has been directly specified then that's simple enough to predict. Usually though, we are just dealing with host names that we wish to communicate with. A host name is going to be presented to the system's hostname resolution system, which may return a result from /etc/hosts or some other database. More usually though it's going to go out to DNS. The DNS may contain both A (IPv4) and AAAA (IPv6) addresses with no regard as to whether the client actually has a source address of the matching family. That is, if you had a host with only inet6 addresses and you did a DNS query, you would still receive A records as answers. If amongst the answers there were no AAAA records then you'd have no way to communicate with the destination when the application tried to do that. It's the getaddrinfo() function of GNU libc that decides which destination address to select for use. You can find more details about that with "man getaddrinfo". By default, if there are both inet and inet6 family addresses to choose from, getaddrinfo will choose the inet6 one. So, if your host has at least one configured global inet6 address then your applications will tend to try to connect to inet6 destination addresses, where available. You can configure getaddrinfo's address selection in /etc/gai.conf. A very common desire is to prefer inet addresses over inet6 ones, and so on Debian the configuration required to do that is shown in /etc/gai.conf commented out. An application can be told to use a specific source address, but it is more common for applications to be allowed to use any address. In that case for inet it will generally be a reasonably simple case of using the routing table to determine which source address is "closest" to the destination. For example, suppose you have an interface that has the addresses 192.168.1.1/24 and 192.168.1.175/25 on it. When attempting to communicate with 192.168.1.180 the routing table will show that this is in the same network as 192.168.1.175/25 and that that is the most specific address. When it comes to inet6 it can get a bit more complicated, especially as it is much more common to have several inet6 addresses, and you've got whole new concepts like privacy addresses and deprecated addresses. But, it's all covered by RFC 6724, and this may help as a summary: http://biplane.com.au/blog/?p=22 > do they both use DNS, As hopefully made clear by the above, it is not the addresses on your system which "use DNS". It's more like your system uses DNS, and the DNS may contain both inet and inet6 addresses, thus your system decides which to communicate with based on which families of address you have. > and similar things which might let me make sense of the situation? Hopefully that helped. It's quite a large topic, so some reading will be required in many places to fully understand it. Cheers, Andy ¹ This ignores the various translation mechanisms that may in place to allow IPv4 networks and IPv6 networks to inter-operate. These can involve various kinds of NAT and DNS rewriting. Look into things like "NAT64" and "DNS64" for more information about these. -- https://bitfolk.com/ -- No-nonsense VPS hosting