Trevor Hemsley <
Trevor....@mytrousers.ntlworld.com> wrote:
> On Wed, 26 Sep 2012 21:11:05 UTC in comp.os.linux.setup, "Colin B."
> <
cbi...@somewhereelse.shaw.ca> wrote:
>
>> Hey all;
>>
>> Got a weird problem where DNS is properly set up and works fine using
>> dig, hosts, or nslookup; but gethostbyname(3) is NOT using it.
>>
>> /etc/nsswitch.conf is set up properly: (hosts: files dns)
>> /etc/host.conf appears fine too. (order hosts,bind)
>>
>> But when I do getent hosts <FQDN> or plug an FQDN into an application
>> config file, it stops after trying the /etc/host file.
>>
>> Any ideas? This is not normal behaviour!
>
> What are the permissions on /etc/nsswitch.conf? Should be 644.
Found the problem.
Permissions were correct, the file was not.
There was a space in front of each nameserver line in /etc/resolv.conf:
nameserver 1.2.3.4
nameserver 2.3.4.5
Apparently the resolver code for dig and nslookup can parse this space,
but the system resolver libraries cannot.
For what it's worth, this is an issue in CentOS 5.2 and 6.3 both, so I
would imagine at least everything between them.
Cheers folks!
Colin