On Mon, Mar 27, 2023 at 12:48:13PM +0100, Richmond wrote: > So how is the preference determined? It seems to be determined by the > DNS, but why or how do I tell for example with host -v?
I'm not adding anything new here, only pulling together what has already been said in several different replies. There are three main places where this can be affected. Firstly the DNS servers you use can decide on their own what to return to you. Normally it's expected that a resolver is going to return everything that is in the DNS zone for the query you made, but some DNS servers (both authoritative and resolver) do decide to give you filtered results which may for example exclude AAAA records. No AAAA records, no possibility of an IPv6 connection. Secondly, your application that gets a list of answers (A and AAAA records) might do something special. It is after all free to do whatever it is programmed to do. The most common example of this is "Happy Eyeballs", where (simply put) web browsers connect to BOTH A and AAAA and use whichever works first. Thirdly, if no special handling is in use then your operating system chooses which address to use. There's an RFC for that, and all of that is configured in /etc/gai.conf on Debian. The default behaviour is to try IPv6 first. So, DNS tools like "host" will not answer this question for you because that is only showing you the first part. That's enough to show you what your options are, but your app might use those options in a way you weren't expecting. Some apps might not even support IPv6. For most apps /etc/gai.conf controls this. You mentioned in another email that you had to alter gai.conf to make IPv6 be preferred. That is unusual as it is not the expected default behaviour. Cheers, Andy -- https://bitfolk.com/ -- No-nonsense VPS hosting