Why are IPv6 DNS lookups done even when IPv6 is disabled?
Issue
- Applications like ssh and telnet use the
getaddrinfo()
function withAF_UNSPEC
and this function invokes both AAAA (IPv6) and A (IPv4) lookups one after the other. This can delay the connection time when DNS servers block or don't handle IPV6 correctly. - How do I prevent IPv6 DNS queries?
getaddrinfo()
takes a long time to resolve hostnames- DNS lookups slow in Java due to poor response to IPv6 AAAA records
- How can I change the
getaddrinfo(AF_UNSPEC)
system call behaviour in Java, to only look up IPv4 A records when a DNS request is made? - Java application hangs on DNS resolution lookup with backtrace like:
"http-8080-1" daemon prio=10 tid=0x00007fba60008800 nid=0x3d5d runnable [0x00007fba96b3a000]
java.lang.Thread.State: RUNNABLE
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:902)
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1281)
at java.net.InetAddress.getAllByName0(InetAddress.java:1232)
at java.net.InetAddress.getAllByName(InetAddress.java:1163)
at java.net.InetAddress.getAllByName(InetAddress.java:1099)
at java.net.InetAddress.getByName(InetAddress.java:1049)
Environment
- Red Hat Enterprise Linux
- glibc
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.