If you are a Linux user, you have a great built-in network diagnostic tool – the Dig command. It is a simple software that you can use through the Terminal. It serves various network diagnostics.
Purpose of the Dig command.
Dig command is a DNS utility that is available on Linux. The purpose of the Dig command is to be able to get information about your domain quickly. You can probe different DNS record types, see if the DNS propagation has ended, and check the parameters of a particular DNS record. You can also see which are the name servers that are authoritative for a domain and see if they respond correctly.
Syntax of the Dig command.
To be able to see the syntax of the Dig command, you can open the Terminal application and type “dig -h”. This is the help for the command that will show you the syntax and all of its options (flags) for advanced DNS lookups.
dig [@server] [-b address] [-c class] [-f filename] [-k filename] [-p port#] [-q name] [-t type] [-x addr] [-y [hmac:] name:key] [-4] [-6] [name] [type] [class] [queryopt…]
You can use the Dig command and probe both domain names and IP addresses.
Dig command examples
Find the A records of a domain.
dig domain.com A
dig – shows which command we are using.
domain.com is the hostname of this example. You can use any domain name or an IP address for probing.
A – stands for an A DNS record. It will show an IPv4 address for the domain name.
Find the AAAA records.
dig domain.com AAAA
AAAA – The AAAA DNS records hold IPv6 addresses for the domain.
Find the CNAME records.
dig domain CNAME
CNAME – will show the canonical name for this domain.
Find the MX records.
dig domain.com MX
MX – The MX records will show the email servers for receiving emails of that domain name.
Find the TXT records.
Find the TXT records.
dig domain.com TXT
TXT – the TXT records have different purposes. They can be used for the verification and authentication of services.
Find the name servers of a domain.
dig domain.com NS
NS – The NS records show the authoritative name servers of the domain name.
Find the SOA record of a domain.
dig dmain.com SOA
SOA – the start of authority.
Reverse DNS lookup with Dig command.
dig -x 126.96.36.199
-x – is used for reverse lookups
188.8.131.52 – is the IP address that we would like to check. That way, you can verify that the IP address belongs to the domain name. You can change it with another.
Trace the route.
dig domain.com +trace
+trace – will activate a traceroute mode. It will show you each hop that your query passes by until it reaches the target.
Check from a particular server.
dig @184.108.40.206 domain.com
@ – the sing for a server.
220.127.116.11 – we are using Google’s public resolver with its IP address 18.104.22.168.
The Dig command is still a very useful tool. It is a part of almost any DNS administrator. It can serve you for quick DNS lookups and advanced DNS probing. To fully utilize it, you can put additional options and produce more specific queries.