Tuesday, September 9, 2014

How to Make Ubuntu Prefer A (IPv4) DNS Lookup Over AAAA (IPv6)

I have Ubuntu server with both IPv6 and IPv4. IPV6 queries made before IPV4 and they where wasting resources, and also there is still no route to some network. After read from some web resources, I got that  it's the standard to prioritize IPv6 over IPv4.

I did changed my /etc/gai.conf (gai stands for getaddrinfo, the standard system call for resolving host names). For sites which prefer IPv4 connections change the last line to:

precedence ::ffff:0:0/96 100

And then, my Ubuntu server query A records (IPv4) before AAAA records (IPv6) when access domains.


Post a Comment