Back to Lab Listing

Lab Objective:

Learn how to use the dig command and some of its switches.

Lab Purpose:

Dig is short for domain information groper. It’s a Unix command line tool used to query DNS name servers. It comes with a large number of options and switches you can use, and it varies according to the platform (e.g., Red Hat, Ubuntu, etc.), so check your documentation.

Lab Tool:

Ubuntu VM

Lab Topology:

Please use the following topology to complete this lab exercise. I used a virtual Ubuntu PC running inside VirtualBox, but if you are using Windows, you can use your home PC. Just check your firewall settings don’t block the test.

dig command

Lab Walkthrough:

Task 1:

Pull up a terminal by typing ‘terminal’ into the search box.

dig command2

Task 2:

At the command prompt, issue the dig command. Check your documentation for more information on all the available switches. Ubuntu doesn’t display anything after the question mark.

dig command3

Task 3:

Issue a dig cisco.com command. By default, an A record search will be executed.

dig command4

We got one answer: 3145 is the time to live (TTL) before the DNS server rechecks the entry. ‘IN’ indicates a standard Internet class, A record is the standard record type, and 72.163.4.185 is the IP address the domain name resolves to.

Task 4:

We can use one of the many switches available. Let’s use the mx switch to query the mail servers.

dig command5

Task 5:

The ANY switch will return all information record types. Many users have had very few results here, so don’t worry if the same happens to you.

dig command6

Task 6:

You can drill down to use the AAAA record if you wish with the dig -t AAAA command, where ‘t’ is short for ‘type’.

dig command7

Task 7:

Finally, you can do a reverse lookup with the -x switch and the IP address.

dig command8

Note:

There are many other options for this command, so feel free to research further.

Newsletter Subscribe

Stay Informed, Stay Inspired: Subscribe for Cutting-Edge IT-Certification Insights

101 Labs Newsletter