I'm going to explain my question with an example. I have two servers, A and B, 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?
How does Debian select or prioritize IPv4 and IPv6 connections?
linux;debian;ipv6;ipv4;whois
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