Centos – Name resolution not working with ipv6 on centos

centosdomain-name-systemipv6

I just installed CentOs 6.3 on a server to be installed in a data center, but cannot get name resolution / curl to work.

I know this is because of it trying to use ipv6, since ping google.com works, curl -4 google.com works, but not curl google.com.

I removed the ipv6 adress from the interface and it does not change anything.

This is very problematic since most system tools like yum fail at name resolution currently. Browsers like Firefox work because they might be using another tool for name resolution than the one use by curl.

I managed to fix this on workstations by completely disabling ipv6 following tutorials like this one / hardcoding name resolution in /etc/hosts. But since I am here configuring a server which will be later installed in a remote data center, I would like not to mess up, understand what is going on and fix it properly. Besides, I will face the same issue with more servers to come so I would really appreciate your help in understanding this problem and how to solve it.

I would be happy to provide more information if needed to help understand what is going on.

The current network configuration is a small enterprise network, with a DNS server (let's call it A) configured once a long time ago.
dig google.com and dig -4 google.com are both refused by the A DNS. But this is also true for my workstation on which curl is working (and yes they both use the same A DNS server).
Indeed this faulty server and my workstation have multiple nameservers in /etc/resolv.conf, and the second one is working fine for both of them, so if I remove A from my resolv.conf everything works fine!

Regards,

Olivier

Best Answer

I solved this problem with the following diagnostic process, which can be applied when dealing with name resolution problems and ipv6

  • Test dig google.com and dig -4 google.com, on a machine having this problem and another one on the same network not having this problem.
  • If the four command (two by machine) fail, this mean that the first nameserver in their /etc/resolv.conf is not configured for ipv6. Remove it and retest.

One cal also use digg @nameserver google.com to test the other eventual nameservers in /etc/resolv.conf without changing this file.