I'm trying to determine why a Nagios host check is failing (hostnames and IPs have been changed to protect the guilty):

: jmglov@laurana; host www.foo.com
;; connection timed out; no servers could be reached

: jmglov@laurana; for ns in `grep -o '\([0-9]\+[.]\)\{3\}[0-9]\+$' /etc/resolv.conf`; do ping -qc 1 $ns; done
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.

--- 192.168.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 10.911/10.911/10.911/0.000 ms
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.

--- 192.168.1.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.241/0.241/0.241/0.000 ms

So I know that my nameservers are reachable, meaning that some nameserver along the delegation path to the authoritative nameserver for my host is not responding. Is there an easy way to determine which nameserver this is (basically a traceroute for DNS)?

up vote 30 down vote accepted

Does this do the job for you?

dig +trace google.com

From the man page:

+[no]trace Toggle tracing of the delegation path from the root name servers for the name being looked up. Tracing is disabled by default. When tracing is enabled, dig makes iterative queries to resolve the name being looked up. It will follow referrals from the root servers, showing the answer from each server that was used to resolve the lookup.

  • That works a charm! – Josh Glover Mar 15 '11 at 16:01

For Windows you can trace your dns query with

nslookup -debug google.at

You can also trace it online (of couse from another host) on http://www.simpledns.com/lookup-dg.aspx

  • nslookup just like dig works also under Mac OS X terminal. – Krzysztof Przygoda Oct 19 '16 at 16:17

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.