Sujet : Re: Linux advocacy
De : robin_listas (at) *nospam* es.invalid (Carlos E. R.)
Groupes : comp.os.linux.miscDate : 20. May 2025, 10:46:44
Autres entêtes
Message-ID : <m931c4F8pgcU1@mid.individual.net>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Mozilla Thunderbird
On 2025-05-20 10:36, Nuno Silva wrote:
On 2025-05-20, Marc Haber wrote:
Maybe what's missing here for some of the affected people is configuring
address lookup to prefer IPv4 if they're using nameservers that return
AAAA records?
(Just a wild guess, but fitting enough that it's probably a good idea to
drop this here:)
news://news.gmane.io/m3msju6x5x.fsf@lugabout.jhcloos.org
Although I'm not sure, from the gai.conf online manual page, that just
the mentioned line is sufficient, given it's said to disable the
"default table". I didn't test this myself.
I knew and did the trick in the past, but I have forgotten, so I asked chatgpt:
Method 1: Edit /etc/gai.conf to prefer IPv4
The /etc/gai.conf file is used by the GNU C Library (glibc) to influence address selection when a hostname resolves to multiple addresses (e.g., both A and AAAA records).
Open the file in a text editor as root:
sudo nano /etc/gai.conf
Find the following line (it’s usually commented out):
#precedence ::ffff:0:0/96 100
Uncomment the line by removing the #:
precedence ::ffff:0:0/96 100
This tells the system to prefer IPv4-mapped addresses over IPv6.
Save and exit the editor.
This change takes effect immediately for new processes that use glibc’s getaddrinfo() function.
Method 2: Disable IPv6 (not recommended unless necessary)
(skip)
Verify Preference
You can test the preference with getent:
getent ahosts example.com
The top address should be IPv4 if the change worked.
-- Cheers, Carlos E.R.