Check DNS Record with Dig Command

Check DNS Record with Dig Command

How do you find out a domain name A record, CName Record, MX record via command line? How to find out a domain name Time To Live and calculate when will the next refresh will happen? Dig command will give you the magic details how does a domain name record is configured. By default, or most of the Unix and Linux Operating System will come with Dig command.

Domain Name “A and CNAME” Record with Dig

Most of us know, if a website is running load balance, the host name will point to multiple IP Address. The IP Address may resolve from an A record or a CNAME record. For an example, Google search engine domain name google.com will have multiple A record to load balance their traffic to another cloud. Let’s find out how many IP Address is pointed to google.com

From the dig result, google.com has 3 A record which pointed to 3 IP Addresses, for load balance purpose. Beside the no 147 is domain name TTL, which mean Time to Live, 147 means after 147 seconds the domain name will refresh again. Google has configure the TTL to 300 seconds, which mean it will refresh the record in every 5 minutes.

Domain Name MX Record with Dig

MX record will tell you how does a domain name email routing works. MX record is the DNS record telling the Mail Server which destination server should deliver to for a domain name. We take a look at gmail.com email routing.

gmail.com’s user, now you will find out when your friend using yahoo.com to send an email to you, the email will deliver to Gmail’s relay servers; Which we can see there are 5 different MX servers with different priority. Email server will always deliver the email to the lowest priority MX record. MX record usually play the role as Mr Postman.

This is how useful a Dig command is. Do man dig for more information and start dig for more DNS information.