How does Debian select or prioritize IPv4 and IPv6 connections?
Turns out that it's about configuration of getaddrinfo, which is controlled at /etc/gai.conf
.
More information about how it can be solved: https://askubuntu.com/questions/32298/prefer-a-ipv4-dns-lookups-before-aaaaipv6-lookups
Related videos on Youtube
Hasan Berkay Cagir
Updated on September 18, 2022Comments
-
Hasan Berkay Cagir over 1 year
I'm going to explain my question with an example. I have two servers,
A
andB
, both runs Debian 7.8, both have dual-stack connection to the Internet (I don't know if it matters but they even have the same amount of IPv6 addresses) and they both have the same version of whois installed (without any config file).Now, when I whois google.fr (I chose whois.nic.fr because it shows the IP you're connecting from) from server
A
, I get this response header:%% %% This is the AFNIC Whois server. %% %% complete date format : DD/MM/YYYY %% short date format : DD/MM %% version : FRNIC-2.5 %% %% Rights restricted by copyright. %% See http://www.afnic.fr/afnic/web/mentions-legales-whois_en %% %% Use '-h' option to obtain more information about this service. %% %% [xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx REQUEST] >> -V Md5.1 google.fr %% %% RL Net [##########] - RL IP [#########.] %%
As you can see, whois used a IPv6 address to connect to whois.nic.fr.
But, when I do the same at server
B
, I get this response header:%% %% This is the AFNIC Whois server. %% %% complete date format : DD/MM/YYYY %% short date format : DD/MM %% version : FRNIC-2.5 %% %% Rights restricted by copyright. %% See http://www.afnic.fr/afnic/web/mentions-legales-whois_en %% %% Use '-h' option to obtain more information about this service. %% %% [xx.x.xxx.xxx REQUEST] >> -V Md5.1 google.fr %% %% RL Net [##########] - RL IP [#########.] %%
As you can see now, whois used IPv4 at server
B
.Why doesn't server
B
use IPv6 when connecting to the whois server? They surely both have connection with IPv6 but one of them chooses to use IPv6 where one does not. Is there any reason for the OS to prioritize connection types?-
Admin almost 2 yearsSeeing this in a debian 10 box as well, and
gai.conf
is default, modifying it makes no difference, I wonder what is going on.
-
-
Gilles 'SO- stop being evil' about 9 yearsHmmm, no, not really. In practicec, it's usually the DNS response that makes the difference (assuming the application supports both), and that's strongly influence by the OS configuration.
-
Hasan Berkay Cagir about 9 yearsBoth servers can reach whois.nic.fr via IPv4/IPv6 without any problems. And this made me think that an OS configuration prioritizing something and whois can't use IPv6.
-
Admin almost 2 yearsThe application makes a DNS request, the OS should order the replies with AAAA records first (specified in RFC) applications should be, and are written to handle the protocols equally (unless we are talking about happy eyeballs) If an OS prefers v4 over v6, then it is a misconfiguration (RFC wise)