Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Some recruits have been trying to understand how DNS works by using DiG. Help th

ID: 3823426 • Letter: S

Question

Some recruits have been trying to understand how DNS works by using DiG. Help them understand the results they produced.

What is the IP address of the nameserver that was queried?

; <<>> DiG 9.9.5-3ubuntu0.13-Ubuntu <<>> @208.67.220.220 reddit.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42130
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;reddit.com. IN A

;; ANSWER SECTION:
reddit.com. 191 IN A 151.101.65.140
reddit.com. 191 IN A 151.101.1.140
reddit.com. 191 IN A 151.101.193.140
reddit.com. 191 IN A 151.101.129.140

;; Query time: 2 msec
;; SERVER: 208.67.220.220#53(208.67.220.220)
;; WHEN: Sat Apr 15 18:42:39 EDT 2017
;; MSG SIZE rcvd: 103

; <<>> DiG 9.9.5-3ubuntu0.13-Ubuntu <<>> @208.67.220.220 reddit.com ANY
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44886
;; flags: qr rd ra; QUERY: 1, ANSWER: 10, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;reddit.com. IN ANY

;; ANSWER SECTION:
reddit.com. 58 IN A 151.101.129.140
reddit.com. 58 IN A 151.101.65.140
reddit.com. 58 IN A 151.101.1.140
reddit.com. 58 IN A 151.101.193.140
reddit.com. 168244 IN NS ns-1029.awsdns-00.org.
reddit.com. 168244 IN NS ns-1887.awsdns-43.co.uk.
reddit.com. 168244 IN NS ns-378.awsdns-47.com.
reddit.com. 168244 IN NS ns-557.awsdns-05.net.
reddit.com. 801 IN SOA ns-557.awsdns-05.net. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400
reddit.com. 3520 IN TXT "v=spf1 include:_spf.google.com include:mailgun.org a:mail.reddit.com ip4:174.129.203.189 ip4:52.205.61.79 ip4:54.172.97.247 ~all"

;; Query time: 3 msec
;; SERVER: 208.67.220.220#53(208.67.220.220)
;; WHEN: Sat Apr 15 18:43:36 EDT 2017
;; MSG SIZE rcvd: 442

; <<>> DiG 9.9.5-3ubuntu0.13-Ubuntu <<>> @208.67.220.220 mail.reddit.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33301
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;mail.reddit.com. IN A

;; ANSWER SECTION:
mail.reddit.com. 300 IN CNAME reddit.map.fastly.net.
reddit.map.fastly.net. 28 IN A 151.101.65.140
reddit.map.fastly.net. 28 IN A 151.101.129.140
reddit.map.fastly.net. 28 IN A 151.101.1.140
reddit.map.fastly.net. 28 IN A 151.101.193.140

;; Query time: 22 msec
;; SERVER: 208.67.220.220#53(208.67.220.220)
;; WHEN: Sat Apr 15 18:43:53 EDT 2017
;; MSG SIZE rcvd: 143

; <<>> DiG 9.9.5-3ubuntu0.13-Ubuntu <<>> @208.67.220.220 mail.reddit.com MX
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7177
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;mail.reddit.com. IN MX

;; ANSWER SECTION:
mail.reddit.com. 20 IN CNAME reddit.map.fastly.net.

;; AUTHORITY SECTION:
fastly.net. 30 IN SOA ns1.fastly.net. hostmaster.fastly.com. 2016110301 3600 600 604800 30

;; Query time: 2 msec
;; SERVER: 208.67.220.220#53(208.67.220.220)
;; WHEN: Sat Apr 15 18:43:55 EDT 2017
;; MSG SIZE rcvd: 150

; <<>> DiG 9.9.5-3ubuntu0.13-Ubuntu <<>> @208.67.220.220 reddit.map.fastly.net
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22621
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;reddit.map.fastly.net. IN A

;; ANSWER SECTION:
reddit.map.fastly.net. 18 IN A 151.101.1.140
reddit.map.fastly.net. 18 IN A 151.101.193.140
reddit.map.fastly.net. 18 IN A 151.101.65.140
reddit.map.fastly.net. 18 IN A 151.101.129.140

;; Query time: 2 msec
;; SERVER: 208.67.220.220#53(208.67.220.220)
;; WHEN: Sat Apr 15 18:44:10 EDT 2017
;; MSG SIZE rcvd: 114

Explanation / Answer

DNS is a protocol within the set of standards for how computers exchange data on the Internet and on many private networks, known as the TCP/IP protocol suite.

Whether you're accessing a Web site or sending e-mail, your computer uses a DNS server to look up the domain name you're trying to access. The proper term for this process is DNS name resolution, and you would say that the DNS server resolves the domain name to the IP address.

Steps which are followed to map Domain name to Its IP Address are given below

Step1: the client types www.example.com in his browser

Step2: the operating system looks at /etc/host file,first for the ip address of www.example.com(this can be changed from /etc/nsswitch), then looks /etc/resolv.conf for the DNS server IP for that machine

Step3: the dns server will search its database for the name www.example.com, if it finds it will give that back, if not it will query the root server(.) for the information.

Step4: root server will return a referral to the .com TLD name server(these TLD name servers knows the address of name servers of all SLD's).In our case we searched for www.example.com so root server will give us referral to .com TLD servers.

If it was www.example.net then root server will give, .net TLD servers refferal.

Step5: Now One of the TLD servers of .com will give us the referral to the DNS server resposible for example.com domain.

Step6: the dns server for example.com domain will now give the client the ip address of www host(www is the host name.)

Now you can clearly see from the dig with trace output that, the request first went to root servers.a.root-servers.net replied me with the addresses of all .com gtld servers, and b.gtld-servers.net gave me the name servers for reddit.com and finally ns2.reddit.com replied you with the ip address of www.reddit.com

reddit.com. 191 IN A 151.101.65.140
reddit.com. 191 IN A 151.101.1.140
reddit.com. 191 IN A 151.101.193.140
reddit.com. 191 IN A 151.101.129.140

These are IP addresses of reddit.com

The dig command output has the following sections:

2. Display Only the ANSWER SECTION of the Dig command Output

For most part, all you need to look at is the “ANSWER SECTION” of the dig command. So, we can turn off all other sections as shown below.

To view all the record types (A, MX, NS, etc.), use ANY as the record type as shown below.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote