Using CentOS 6.9 with IPv4 configured, and _not_ disabling IPv6 yet, we want this NFS client system to prefer the IPv4 address of a dual-stack remote NFS server, which has both A and AAAA records in DNS.
Otherwise we get a minutes long pause while automounter tries to mount the IPv6 address -- I can see automounter's '/bin/mount' running, using the AAAA record of the server, until that times-out and the IPv4 address of the server mounts successfully.
Disabling IPv6 altogether works around the problem as expected, but is a bigger hammer than we wanted to use. :-)
I found posts from others in a similar situation, and proposed solutions included modifying /etc/gai.conf to use:
precedence ::ffff:0:0/96 100
I cp'd /usr/share/doc/glibc-common-2.12/gai.conf to /etc/ and tried that, with several other permutations (e.g. uncommenting other blocks of "label" and "precedence" settings) but none achieved the desired effect.
Am I misunderstanding how this is supposed to work?
Cheers, sr.
On 06/08/2018 10:42 AM, Steve Rikli wrote:
I found posts from others in a similar situation, and proposed solutions included modifying /etc/gai.conf to use:
precedence ::ffff:0:0/96 100
From my reading of that file, you'd need to uncomment all of the default precedence lines, and modify the last one. You couldn't use that one line, alone. It's hard to tell if that's what you did. /etc/gai.conf would contain:
precedence ::1/128 50 precedence ::/0 40 precedence 2002::/16 30 precedence ::/96 20 precedence ::ffff:0:0/96 100
...also of note is that gai.conf should only affect the getaddrinfo() API. If the client is using an older API like gethostbyname(), it won't order DNS results correctly.
In article 669037eb-029c-eb3b-0c60-6a5121142bb8@gmail.com, Gordon Messmer centos@centos.org wrote:
On 06/08/2018 10:42 AM, Steve Rikli wrote:
I found posts from others in a similar situation, and proposed solutions included modifying /etc/gai.conf to use:
precedence ::ffff:0:0/96 100
From my reading of that file, you'd need to uncomment all of the default precedence lines, and modify the last one. You couldn't use that one line, alone. It's hard to tell if that's what you did. /etc/gai.conf would contain:
precedence ::1/128 50 precedence ::/0 40 precedence 2002::/16 30 precedence ::/96 20 precedence ::ffff:0:0/96 100
Yes, I tried that permutation too. Some posts claimed you only need the last "100" precendence line, but I tried it both ways, as well as other combinations, by following the file's comments.
...also of note is that gai.conf should only affect the getaddrinfo() API. If the client is using an older API like gethostbyname(), it won't order DNS results correctly.
I suspect you're right; how to tell what system call is used by CentOS 6.9 NFS automounter?
I've watched the automounter daemon in foreground debug mode, and it does show the NFS server mount attempt with IPv6 first, but the actual API call name isn't displayed there.
This seems the most likely explanation, I'd just like to know for certain before I give up on gai.conf and restort to disabling IPv6 or other workarounds (e.g. /etc/nfsmount.conf).
Thanks, sr.
On 06/08/2018 03:23 PM, Steve Rikli wrote:
This seems the most likely explanation, I'd just like to know for certain before I give up on gai.conf and restort to disabling IPv6 or other workarounds (e.g. /etc/nfsmount.conf).
Have you tried specifying "proto=tcp" as a mount option? That *should* limit the client to IPv4.
In article bc751efa-07f1-91de-9248-5f90f961bcb4@gmail.com, Gordon Messmer centos@centos.org wrote:
On 06/08/2018 03:23 PM, Steve Rikli wrote:
This seems the most likely explanation, I'd just like to know for certain before I give up on gai.conf and restort to disabling IPv6 or other workarounds (e.g. /etc/nfsmount.conf).
Have you tried specifying "proto=tcp" as a mount option? That *should* limit the client to IPv4.
Yes -- that's the other workaround I tried successfully. Either in auto.master mount options for the map, or Defaultproto=tcp in nfsmount.conf works as desired.
I had hopes for gai.conf as the more universal solution, but apparently it's not useable here.
Thanks, sr.
On 06/09/2018 07:51 AM, Steve Rikli wrote:
I had hopes for gai.conf as the more universal solution, but apparently it's not useable here.
gai.conf works as intended for most applications, here. For example, if I uncomment the block of "precedence" lines, and swap between "10" and "100" for the last line, then "telnet www.google.com 80" will connect to either the IPv4 or IPv6 address based on that value. Have you verified that works for you? Do the results for that test not match the results for NFS mounts?
In article 05fc7f7d-897a-8a6e-f91c-f79f8aefd9c7@gmail.com, Gordon Messmer centos@centos.org wrote:
On 06/09/2018 07:51 AM, Steve Rikli wrote:
I had hopes for gai.conf as the more universal solution, but apparently it's not useable here.
gai.conf works as intended for most applications, here. For example, if I uncomment the block of "precedence" lines, and swap between "10" and "100" for the last line, then "telnet www.google.com 80" will connect to either the IPv4 or IPv6 address based on that value. Have you verified that works for you? Do the results for that test not match the results for NFS mounts?
That's correct -- to be clearer, gai.conf works as expected for other things, but not what we wanted for the NFS automounter.
Thanks, sr.