Websitetemplate.org

Welcome > Linux > Networking > DIGing Around

DIGing Around

DIG is awesome - you can actually trace out how a client gets to a service using the trace mode.  The best example is tracing mail - some people don't understand how this works, so here's an example.

1.  First off, let's see what the MX records are:

$ dig fsf.org mx +short
10 mail.fsf.org.
$
2. Trace mail delivery:

$ dig fsf.org mx +trace
; <<>> DiG 9.2.4 <<>> fsf.org mx +trace
;; global options:  printcmd
.                       81278   IN      NS      k.root-servers.net.
.                       81278   IN      NS      l.root-servers.net.
.                       81278   IN      NS      m.root-servers.net.
.                       81278   IN      NS      a.root-servers.net.
.                       81278   IN      NS      b.root-servers.net.
.                       81278   IN      NS      c.root-servers.net.
.                       81278   IN      NS      d.root-servers.net.
.                       81278   IN      NS      e.root-servers.net.
.                       81278   IN      NS      f.root-servers.net.
.                       81278   IN      NS      g.root-servers.net.
.                       81278   IN      NS      h.root-servers.net.
.                       81278   IN      NS      i.root-servers.net.
.                       81278   IN      NS      j.root-servers.net.
;; Received 420 bytes from 127.0.0.1#53(127.0.0.1) in 4 ms
org.                    172800  IN      NS      a0.org.afilias-nst.info.
org.                    172800  IN      NS      a2.org.afilias-nst.info.
org.                    172800  IN      NS      b0.org.afilias-nst.org.
org.                    172800  IN      NS      b2.org.afilias-nst.org.
org.                    172800  IN      NS      c0.org.afilias-nst.info.
org.                    172800  IN      NS      d0.org.afilias-nst.org.
;; Received 427 bytes from 193.0.14.129#53(k.root-servers.net) in 190 ms
fsf.org.                86400   IN      NS      ns2.gnu.org.
fsf.org.                86400   IN      NS      ns3.gnu.org.
fsf.org.                86400   IN      NS      ns1.gnu.org.
;; Received 187 bytes from 199.19.56.1#53(a0.org.afilias-nst.info) in 212 ms
fsf.org.                300     IN      MX      10 mail.fsf.org.
fsf.org.                300     IN      NS      ns3.gnu.org.
fsf.org.                300     IN      NS      ns2.gnu.org.
fsf.org.                300     IN      NS      ns1.gnu.org.
fsf.org.                300     IN      NS      ns4.gnu.org.
;; Received 258 bytes from 87.98.253.102#53(ns2.gnu.org) in 196 ms
$
Using the +trace option, we see the client first asks the root servers, then asks the .org TLD for the registration record, gets the name servers, gets the DNS entry, and then displays the MX record.  Yep - all this just to send email.

Content Copyright 2003-2014 George Toft