Tag Archives: QUERY

The following query will return a detailed dig record:

dig any joelgm.me +trace +all

Result:

[[email protected]] ~ #dig any joelgm.me +trace +all

; <<>> DiG 9.7.3 <<>> any joelgm.me +trace +all
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24197
;; flags: qr ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;.                              IN      NS

;; ANSWER SECTION:
.                       6494    IN      NS      b.root-servers.net.
.                       6494    IN      NS      e.root-servers.net.
.                       6494    IN      NS      h.root-servers.net.
.                       6494    IN      NS      d.root-servers.net.
.                       6494    IN      NS      k.root-servers.net.
.                       6494    IN      NS      a.root-servers.net.
.                       6494    IN      NS      i.root-servers.net.
.                       6494    IN      NS      c.root-servers.net.
.                       6494    IN      NS      l.root-servers.net.
.                       6494    IN      NS      j.root-servers.net.
.                       6494    IN      NS      g.root-servers.net.
.                       6494    IN      NS      m.root-servers.net.
.                       6494    IN      NS      f.root-servers.net.

;; Query time: 42 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sat Jun 29 05:33:48 2013
;; MSG SIZE  rcvd: 228

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9280
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 8, ADDITIONAL: 13

;; QUESTION SECTION:
;joelgm.me.                     IN      ANY

;; AUTHORITY SECTION:
me.                     172800  IN      NS      a0.cctld.afilias-nst.info.
me.                     172800  IN      NS      a2.me.afilias-nst.info.
me.                     172800  IN      NS      b0.cctld.afilias-nst.org.
me.                     172800  IN      NS      b2.me.afilias-nst.org.
me.                     172800  IN      NS      c0.cctld.afilias-nst.info.
me.                     172800  IN      NS      d0.cctld.afilias-nst.org.
me.                     172800  IN      NS      ns.nic.me.
me.                     172800  IN      NS      ns2.nic.me.

;; ADDITIONAL SECTION:
a0.cctld.afilias-nst.info. 172800 IN    A       199.254.59.1
a2.me.afilias-nst.info. 172800  IN      A       199.249.119.1
b0.cctld.afilias-nst.org. 172800 IN     A       199.254.60.1
b2.me.afilias-nst.org.  172800  IN      A       199.249.127.1
c0.cctld.afilias-nst.info. 172800 IN    A       199.254.61.1
d0.cctld.afilias-nst.org. 172800 IN     A       199.254.62.1
ns.nic.me.              172800  IN      A       89.188.44.44
ns2.nic.me.             172800  IN      A       89.188.44.88
a0.cctld.afilias-nst.info. 172800 IN    AAAA    2001:500:25::1
a2.me.afilias-nst.info. 172800  IN      AAAA    2001:500:47::1
b0.cctld.afilias-nst.org. 172800 IN     AAAA    2001:500:26::1
b2.me.afilias-nst.org.  172800  IN      AAAA    2001:500:4f::1
c0.cctld.afilias-nst.info. 172800 IN    AAAA    2001:500:27::1

;; Query time: 62 msec
;; SERVER: 192.203.230.10#53(e.root-servers.net)
;; WHEN: Sat Jun 29 05:33:48 2013
;; MSG SIZE  rcvd: 485

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4370
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 3, ADDITIONAL: 0

;; QUESTION SECTION:
;joelgm.me.                     IN      ANY

;; AUTHORITY SECTION:
joelgm.me.              86400   IN      NS      ns2.joelns.com.
joelgm.me.              86400   IN      NS      ns1.joelns.com.
joelgm.me.              86400   IN      NS      ns3.joelns.com.

;; Query time: 56 msec
;; SERVER: 199.254.60.1#53(b0.cctld.afilias-nst.org)
;; WHEN: Sat Jun 29 05:33:48 2013
;; MSG SIZE  rcvd: 91

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41704
;; flags: qr aa; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 3

;; QUESTION SECTION:
;joelgm.me.                     IN      ANY

;; ANSWER SECTION:
joelgm.me.              30      IN      SOA     ns1.joelns.com. admin.joelgm.me. 2007010407 3600 600 1814400 600
joelgm.me.              30      IN      NS      ns1.joelns.com.
joelgm.me.              30      IN      NS      ns2.joelns.com.
joelgm.me.              30      IN      NS      ns3.joelns.com.
joelgm.me.              30      IN      MX      30 aspmx4.googlemail.com.
joelgm.me.              30      IN      MX      10 aspmx.l.google.com.
joelgm.me.              30      IN      MX      20 alt1.aspmx.l.google.com.
joelgm.me.              30      IN      MX      20 alt2.aspmx.l.google.com.
joelgm.me.              30      IN      MX      30 aspmx2.googlemail.com.
joelgm.me.              30      IN      MX      30 aspmx3.googlemail.com.
joelgm.me.              30      IN      A       198.23.228.223

;; ADDITIONAL SECTION:
ns1.joelns.com.         180     IN      A       199.188.75.23
ns2.joelns.com.         180     IN      A       38.114.103.106
ns3.joelns.com.         180     IN      A       38.127.98.233

;; Query time: 23 msec
;; SERVER: 199.188.75.23#53(ns1.joelns.com)
;; WHEN: Sat Jun 29 05:33:48 2013
;; MSG SIZE  rcvd: 350

Basic format:

[email protected]:~$ dig droidzone.in

; &lt;&lt;&gt;&gt; DiG 9.8.1-P1 &lt;&lt;&gt;&gt; droidzone.in
;; global options: +cmd
;; Got answer:
;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 59555
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 0

;; QUESTION SECTION:
;droidzone.in. IN A

;; ANSWER SECTION:
droidzone.in. 27895 IN A 93.182.179.225

;; AUTHORITY SECTION:
droidzone.in. 85494 IN NS ns2.enames.in.
droidzone.in. 85494 IN NS ns1.enames.in.
droidzone.in. 85494 IN NS ns.enames.in.
droidzone.in. 85494 IN NS ns3.enames.in.

;; Query time: 24 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Sep 18 22:38:57 2012
;; MSG SIZE rcvd: 124

The printcmd options means that the command section (the name given to these first two line) is printed. You can turn it off by using the option +nocmd.

Dig can yield specific records like A or MX:

[email protected]:~$ dig droidzone.in A

; &lt;&lt;&gt;&gt; DiG 9.8.1-P1 &lt;&lt;&gt;&gt; droidzone.in A
;; global options: +cmd
;; Got answer:
;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 61546
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 0

;; QUESTION SECTION:
;droidzone.in.                  IN      A

;; ANSWER SECTION:
droidzone.in.           27811   IN      A       93.182.179.225

;; AUTHORITY SECTION:
droidzone.in.           85410   IN      NS      ns.enames.in.
droidzone.in.           85410   IN      NS      ns1.enames.in.
droidzone.in.           85410   IN      NS      ns2.enames.in.
droidzone.in.           85410   IN      NS      ns3.enames.in.

;; Query time: 24 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Sep 18 22:40:21 2012
;; MSG SIZE  rcvd: 124

[email protected]:~$ dig droidzone.in MX

; &lt;&lt;&gt;&gt; DiG 9.8.1-P1 &lt;&lt;&gt;&gt; droidzone.in MX
;; global options: +cmd
;; Got answer:
;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 52453
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 4, ADDITIONAL: 10

;; QUESTION SECTION:
;droidzone.in.                  IN      MX

;; ANSWER SECTION:
droidzone.in.           28800   IN      MX      30 aspmx4.googlemail.com.
droidzone.in.           28800   IN      MX      30 aspmx5.googlemail.com.
droidzone.in.           28800   IN      MX      10 aspmx.l.google.com.
droidzone.in.           28800   IN      MX      20 alt1.aspmx.l.google.com.
droidzone.in.           28800   IN      MX      20 alt2.aspmx.l.google.com.
droidzone.in.           28800   IN      MX      30 aspmx2.googlemail.com.
droidzone.in.           28800   IN      MX      30 aspmx3.googlemail.com.

;; AUTHORITY SECTION:
droidzone.in.           85401   IN      NS      ns.enames.in.
droidzone.in.           85401   IN      NS      ns3.enames.in.
droidzone.in.           85401   IN      NS      ns1.enames.in.
droidzone.in.           85401   IN      NS      ns2.enames.in.

;; ADDITIONAL SECTION:
aspmx.l.google.com.     3       IN      A       173.194.79.26
aspmx.l.google.com.     208     IN      AAAA    2607:f8b0:400e:c01::1b
alt1.aspmx.l.google.com. 234    IN      A       74.125.142.27
alt1.aspmx.l.google.com. 97     IN      AAAA    2a00:1450:4010:c04::1b
alt2.aspmx.l.google.com. 206    IN      A       74.125.130.27
alt2.aspmx.l.google.com. 96     IN      AAAA    2a00:1450:4010:c04::1a
aspmx2.googlemail.com.  212     IN      A       74.125.142.27
aspmx2.googlemail.com.  105     IN      AAAA    2a00:1450:4010:c04::1a
aspmx3.googlemail.com.  60      IN      A       74.125.130.27
aspmx3.googlemail.com.  99      IN      AAAA    2a00:1450:4010:c04::1a

;; Query time: 353 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Sep 18 22:40:30 2012
;; MSG SIZE  rcvd: 507

[email protected]:~$

In most cases, you dont need all that output.

[email protected]:~$ dig droidzone.in MX +short
20 alt2.aspmx.l.google.com.
30 aspmx2.googlemail.com.
30 aspmx3.googlemail.com.
30 aspmx4.googlemail.com.
30 aspmx5.googlemail.com.
10 aspmx.l.google.com.
20 alt1.aspmx.l.google.com.

This option can be added as default to dig by editing ~/.digrc to have the following:

To use a different name server call dig with the first parameter as@nameserver. For example we can query ns.hosteurope.com directly like this:

	
dig @ns.hosteurope.com www.droidzone.in

My ~/.digrc contains:

 

+noall 
+answer