[CentOS] inconsistent DNS results - ping vs dig vs nslookup

Thu Jun 23 09:06:07 UTC 2011
John Hodrien <J.H.Hodrien at leeds.ac.uk>

On Wed, 22 Jun 2011, Ljubomir Ljubojevic wrote:

> As Les wrote in another branch of the thread, search clause is if you
> try name without a domain.

I think it's slightly more subtle and possibly more annoying than that.

Say you have a machine called foo.mydomain.com

By default (if you don't specify it), search is set to be mydomain.com.

So a lookup for bar would initially be done as bar.domain.com.

A lookup for bar.baz would initially be searched for as bar.baz (because it
has at least ndots in it), but if that failed, would then be looked up as
bar.baz.domain.com.

Equally a search for baz.domain.com (where baz didn't exist) would be looked
up first as baz.domain.com and then as baz.domain.com.domain.com.

This appears to be doubly annoying with programs compile with IPv6 support
where there aren't AAAA records.

So a typical valid lookup for machine.domain.com becomes:

AAAA lookup for machine.domain.com (not found)
AAAA lookup for machine.domain.com.domain.com (not found)
A lookup for machine.domain.com (found)

jh