Problem Using TCP DNS Query on Service Does Not Support IPv6

  • Symptom
    After adding "use-vc options" in /etc/resolv.conf, tools such as wget / curl can no longer resolve the hostname. Dig / nslookup works. But if you change the name server to 1.1.1.1 or 8.8.8.8, everything will work.
  • Research
    After TCPDump with the cross matrix of wget / nslookup / myDNS / 1.1.1.1. I found it:

    1. wget performs IPv4 and IPv6 requests in one request; nslookup is only IPv4.
    2. 1.1.1.1 returns IPv4 and IPv6 responses (resolved in CNAME, not IPv6 addresses) in one response; My DNS only returns IPv4.
    3. A test code calling getaddrinfo works the same way as wget.
  • Conclusion
    With TCP DNS, glibc continues to request both IPv4 and IPv6, if the response does not contain IPv6, it fails.

Question: Is it by design? Why?