Debug DNS: What to do if host name resolution does not work as expected

debuggingdomain-name-system

The current search results for "debug dns" don't reveal a guide-line what to do, if you (as user/client) think there is something wrong with the host name resolution.

What steps can I do to narrow down the problem?

My particular case:

The tool host can resolve the name:

root@mypc# host remotehost.internal-domain.local
remotehost.internal-domain.local has address 10.99.204.11

But the tool nslookup can't:

root@mypc# nslookup host remotehost.internal-domain.local
nslookup: couldn't get address for 'remotehost.internal-domain.local': not found

I am confused.

Solution

In my case I changed this line in /etc/nsswitch.conf:

hosts:          files mdns4_minimal [NOTFOUND=return] dns

to this

hosts:          files dns

Now the .local Domain gets resolved by DNS, not by avahi peer-to-peer stuff.

Best Answer

What steps can I do to narrow down the problem?

In general: Many commands come with switches that increase the verbosity and/or the debug level allowing you to troubleshoot more easily. Check the manual page for the exact options, i.e. man host and man nslookup

In the case of DNS issues:

  • a fairly typical problem is the presence of static entries in /etc/hosts
  • your system may use alternative hosts database configured in /etc/nsswitch.conf and when you use tools that only test actual DNS name servers you get different results compared to what your system resolves.
  • your /etc/resolv.conf may contain multiple nameservers and one or more of those responds differently from the other(s), check by querying each specific name server directly