[CentOS] /etc/gai.conf fails to prefer IPv4 over IPv6 for NFS

Fri Jun 8 22:23:06 UTC 2018
Steve Rikli <sr at genyosha.net>

In article <669037eb-029c-eb3b-0c60-6a5121142bb8 at gmail.com>,
Gordon Messmer  <centos at 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).

|| Steve Rikli             ||| Well, we've stared at it... that oughta ||
|| Systems Administrator   ||| fix it!  Let's get outta here.          ||
|| Genyosha Networks       |||                                         ||
|| sr at genyosha.net         |||                   - Crow, MST3K         ||