Three Linux DNS Lookup Utilities

The Domain Name Service (DNS) protocol is like a worldwide, distributed phonebook directory service for the Internet. Because both a phonebook and DNS map a “human-readable name” like Bob Smith or mywebsit.com to a 917-228-2345 or IP address 146.112.62.105, respectively. DNS prevents you from having to know or remember the hard-to-remember machine-readable IP address for a website you visit. For example, instead of having to remember the IP address 146.112.62.105 you can type the human-readable name opendns.com and DNS protocol resolves the human-readable-name to the machine-readable IP address. In this case, IP address 146.112.62.105 (See my post Basic DNS Queries and Responses to see DNS in action). Below I demonstrate three linux tools for DNS lookups: host, dig, and nslookup

The Linux Host Utility

Host is a DNS lookup utility. It is used to convert “human-readable name” to machine-readable IP addresses and vice versa  (See above). When no arguments or options are given, host prints a short summary of its command line arguments and options:

By itself without options, the host command reports the IP address for a host and returns A, AAAA, and MX records. A Records are the most basic type of DNS record and are used to point a domain or subdomain to an IP address. AAAA records (i.e., quad-A record) specifies IPv6 address for given host. Mail exchange records (MX) specifics the mail exchange server(s) for domain name. MX records are used by Simple Mail Transfer Protocol (SMTP) to route emails to proper hosts. Typically, there are more than one mail exchange server for a DNS domain and each of them have set priority:

To show DNS records of ALL types use the -t option with ANY. This option displays the CNAME Records and the Certification Authority Authorization (CAA) record. The CNAME record specifies a domain name that has to be queried in order to resolve the original DNS query. The Certification Authority Authorization (CAA) record is used to specify which certificate authorities (CAs) are allowed to issue certificates for a domain:

You can use the -t option without ANY followed by the record type to search for individual DNS records(See my blog post DNS Request Types Cheat Sheet).:

The Linux Dig Utility

dig is a DNS lookup utility. For a complete list of options use “dig -h” or “dig -h | more” for a complete list of options:

dig basic usage:

dig using “ANY,” a special “magic” type in DNS (See my DNS Request Types Cheat Sheet):

dig using the -t option followed by a DNS request type (See my DNS Request Types Cheat Sheet):

See dig manual pages for more information (“man dig”) [snippet]:


The Linux nslookup Utility

nslookup queries Internet name servers interactively.  For a complete list of options use “dig -h” or “dog -h | more” for a complete list of options:

nslookup basic:

nslookup using “ANY,” a special “magic” type in DNS (See my DNS Request Types Cheat Sheet):

nslookup using the -t option followed by a DNS request type (See my DNS Request Types Cheat Sheet):

About the Author

David Zwickl, MSci., CISSP, CEH, has spent over 20 years in information assurance and cybersecurity for companies such as RSA Security and Cisco Systems in a variety of roles. Dave holds a Master’s degree in Information Assurance with a Cybersecurity Specialization from Regis University in Denver Colorado. Regis University’s School of Computer & Information Sciences, designated as a National Center of Excellence in Information Systems Security Education (CAE/IAE) by the National Security Agency (NSA) and the Department of Homeland Security (DHS). Dave is active in industry associations ISSA, OWASP, CSA, among others.

Resources

About WHOIS.  (n.d.).  Retrieved October 29, 2017 from https://whois.icann.org/en/about-whois

https://whois.icann.org/en/dns-and-whois-how-it-worksDNS and WHOIS – How it Works.  (n.d.).  Retrieved October 29, 2017 from

Whois v1.14.  (2016, July 4). DNS and WHOIS – How it Works https://docs.microsoft.com/en-us/sysinternals/downloads/whois

1 thought on “Three Linux DNS Lookup Utilities”

Leave a Reply

Your email address will not be published. Required fields are marked *