Difference between revisions of "DNS"

From WhyAskWhy.org Wiki
Jump to: navigation, search
m (Added some additional references.)
m (Added example of using specific nameserver for queries.)
Line 7: Line 7:
  
 
== Example queries ==
 
== Example queries ==
 +
 +
=== Query specific nameserver ===
 +
 +
Syntax: <code>dig $host @$nameserver</code>
 +
 +
Example using Google's Public DNS server:
 +
 +
<code>$ dig www.penzoil.com @8.8.8.8</code>
 +
 +
<pre>
 +
; <<>> DiG 9.9.5-4.3ubuntu0.2-Ubuntu <<>> www.penzoil.com @8.8.8.8
 +
;; global options: +cmd
 +
;; Got answer:
 +
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59205
 +
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
 +
 +
;; OPT PSEUDOSECTION:
 +
; EDNS: version: 0, flags:; udp: 512
 +
;; QUESTION SECTION:
 +
;www.penzoil.com.              IN      A
 +
 +
;; ANSWER SECTION:
 +
www.penzoil.com.        10799  IN      CNAME  web2.fwd.easydns.com.
 +
web2.fwd.easydns.com.  299    IN      A      216.220.40.244
 +
 +
;; Query time: 485 msec
 +
;; SERVER: 8.8.8.8#53(8.8.8.8)
 +
;; WHEN: Tue Mar 10 10:38:12 CDT 2015
 +
;; MSG SIZE  rcvd: 91
 +
</pre>
 +
 +
  
 
=== Domain ===
 
=== Domain ===

Revision as of 09:40, 10 March 2015


TODO

  • Find a good parent page for this one
  • Add troubleshooting examples

Example queries

Query specific nameserver

Syntax: dig $host @$nameserver

Example using Google's Public DNS server:

$ dig www.penzoil.com @8.8.8.8

; <<>> DiG 9.9.5-4.3ubuntu0.2-Ubuntu <<>> www.penzoil.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59205
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.penzoil.com.               IN      A

;; ANSWER SECTION:
www.penzoil.com.        10799   IN      CNAME   web2.fwd.easydns.com.
web2.fwd.easydns.com.   299     IN      A       216.220.40.244

;; Query time: 485 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Tue Mar 10 10:38:12 CDT 2015
;; MSG SIZE  rcvd: 91


Domain

host example.org

example.org has address 93.184.216.34
example.org has IPv6 address 2606:2800:220:1:248:1893:25c8:1946

A

Normal

dig -t a www.whyaskwhy.org

; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> -t a www.whyaskwhy.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29612
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4000
;; QUESTION SECTION:
;www.whyaskwhy.org.             IN      A

;; ANSWER SECTION:
www.whyaskwhy.org.      7103    IN      A       74.207.228.106

;; Query time: 1 msec
;; SERVER: 131.204.2.131#53(131.204.2.131)
;; WHEN: Tue Feb 10 17:25:40 CST 2015
;; MSG SIZE  rcvd: 62

Brief

dig -t a www.whyaskwhy.org +short

74.207.228.106

host www.whyaskwhy.org

www.whyaskwhy.org has address 74.207.228.106

MX

Normal

dig -t mx google.com

; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> -t mx google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44319
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 6

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4000
;; QUESTION SECTION:
;google.com.                    IN      MX

;; ANSWER SECTION:
google.com.             556     IN      MX      20 alt1.aspmx.l.google.com.
google.com.             556     IN      MX      30 alt2.aspmx.l.google.com.
google.com.             556     IN      MX      40 alt3.aspmx.l.google.com.
google.com.             556     IN      MX      50 alt4.aspmx.l.google.com.
google.com.             556     IN      MX      10 aspmx.l.google.com.

;; ADDITIONAL SECTION:
alt1.aspmx.l.google.com. 58     IN      A       64.233.186.27
alt2.aspmx.l.google.com. 249    IN      A       64.233.184.26
alt3.aspmx.l.google.com. 249    IN      A       173.194.65.26
alt4.aspmx.l.google.com. 249    IN      A       173.194.71.26
aspmx.l.google.com.     249     IN      A       64.233.171.26

;; Query time: 10 msec
;; SERVER: 131.204.2.131#53(131.204.2.131)
;; WHEN: Tue Feb 10 17:29:08 CST 2015
;; MSG SIZE  rcvd: 227

host -t mx google.com

google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 20 alt1.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 50 alt4.aspmx.l.google.com.

Brief

dig -t mx google.com +short

30 alt2.aspmx.l.google.com.
40 alt3.aspmx.l.google.com.
50 alt4.aspmx.l.google.com.
10 aspmx.l.google.com.
20 alt1.aspmx.l.google.com.

PTR

  • dig -x 1.2.3.4
  • host 1.2.3.4

References