User Tools

Site Tools

//[lab source : NSRC]//

1. Exercises: DNS

1.1 Verify the resolv.conf configuration on your workstation.

cat /etc/resolv.conf The output should look like


1.2 Issue the following DNS queries using 'dig' Run each command below, look for the “ANSWER SECTION” and write down the result. Make a note of the TTL as well. Repeat the command. Is the TTL the same as in the first try? Are the responses Authoritative?

COMMAND                         RESULT              TTL (1st)   TTL (2nd)
-----------------------------  ------------------ ------------ --------------
dig a    ________________    ___________ __________
dig a                ________________    ___________ __________                  
dig mx               ________________    ___________ __________      
dig aaaa      ________________    ___________ __________      
dig ns                  ________________    ___________ __________      
dig <domain of your choice> a   ________________    ___________ __________  
dig <domain of your choice> mx  ________________    ___________ __________      
dig txt              ________________    ___________ __________           
dig +dnssec +multi     ________________    ___________ __________ 

Now send some queries to another caching server. How long did it take each answer to be received?

COMMAND                                         RESULT
--------------------------------------------    ------------------

dig @ a                       ______________
dig @ a                      ______________
dig @ aaaa             ______________
dig @<a-server-of-yours> <domain-of-yours> a    ______________

1.3 Reverse DNS lookups

Now try some reverse DNS lookups. Remember to reverse the four parts of the IP address, add '', and ask for a PTR resource record. (for

dig ptr

Repeat for an IP address of your choice.

Now try the short form of dig using the '-x' flag for reverse lookups:

dig -x
dig --x 2405:7600:0:6::5
dig -x 2001:468:d01:103::80df:9d13
dig @<server-of-your-choice> -x <ip-address-of-your-choice>

1.4 Use tcpdump to show DNS traffic In a separate window, run the following command (you must be 'root')

 # tcpdump -n -s 1500 -i eth0 udp port 53 

This shows all packets going in and out of your machine for UDP port 53 (DNS). Now go to another window and repeat some of the 'dig' queries from earlier. Look at the output of tcpdump, check the source and destination IP address of each packet

  • -n: Prevents tcpdump doing reverse DNS lookups on the packets it receives, which would generate additional (confusing) DNS traffic
  • -s 1500: Read the entire packet (otherwise tcpdump only reads the headers)
  • -i eth0: Which interface to listen on (use ifconfig to determine the name of your ethernet interface)
  • udp port 53: A filter which matches only packets to/from UDP port 53
bdnog5/track2agenda/dns-lab.txt · Last modified: 2016/04/03 18:38 by Fakrul Alam