How to prefer ipv4 over ipv6 in RHEL7
We see that some (many) have misconfigured ipv6 DNS entries for their sites and since RHEL seems to try ipv6 lookups before (or simultaneous to) ipv4 this can lead to failed lookups.
How do we set RHEL to prefer ipv4? (We're using RHEL7 and RHEL6)
Responses
I found this article which may give some insight : Why are IPV6 DNS lookups done even when IPV6 is disabled in Red Hat Enterprise Linux?
The workaround proposed by that article is beside the point: Why would I want to completely disable IPv6/AAAA lookups?
As I understand, the glibc resolver will wait for all queries to return, so the behaviour you report is expected.
You could try playing with DNS server label or precedence in the /etc/gai.conf file, see man gai.conf for syntax. This worked on RHEL5 but I am not sure about 6 or 7.
Unfortunately the solution here will be one of:
- don't misconfigure DNS servers
- rewrite applications not to use
AF_UNSPECsockets - any of several methods to disable IPv6 or block AAAA lookups
Since this has been resurrected, I guess I can ask the same question. So far from our testing internally on RHEL7.4/7.5 , the requests goes sequentially from
IPV6 - query all name servers (timeout value between); exhaust attempt value
IPV6 (search domain or localhost domain) - query all name servers (timeout value between); exhaust attempt value
IPV4 - query all name servers (timeout value between); exhaust attempt value
IPV4 (search domain or localhost domain) - query all name servers (timeout value between); exhaust attempt value
I understand it's difficult and unsupported to try to disable IPV6. So, is there a way to force this into parallel run for IPV6 and IPV4?
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
