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


shell> dig google.com

google.com.             147     IN      A       74.125.67.100
google.com.             147     IN      A       209.85.171.100
google.com.             147     IN      A       74.125.45.100

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.


shell> dig mx gmail.com

gmail.com.              2087    IN      MX      5 gmail-smtp-in.l.google.com.
gmail.com.              2087    IN      MX      10 alt1.gmail-smtp-in.l.google.com.
gmail.com.              2087    IN      MX      20 alt2.gmail-smtp-in.l.google.com.
gmail.com.              2087    IN      MX      30 alt3.gmail-smtp-in.l.google.com.
gmail.com.              2087    IN      MX      40 alt4.gmail-smtp-in.l.google.com.

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.

Related posts:

  1. Force Email Delivery on Exim Hundred emails are queuing on your mail relay server, and...
  2. Backup and Archive Incoming Email with Exim Loitering around Google and finding a way to archive/backup incoming...
  3. windows 2000 – command line (cmd) command auto completion By default, windows 2k server does not activate this function....
  4. How to dig SRV record after creating it in DNS dig <record type> <host.name> e.g dig SRV _someservice._port.hostname.domainame.com.my OR dig...
  5. Why name@email.com? I, you, we, they, he, she or it have thier...
  6. Grep Exim Email Transaction with Bash While email transport having problem, the first we look for...
  7. useful unix command: xargs In our mailserver, we backup every incoming email and keep...
  8. Exim, Recipient Verify on Relay and Mail Server How many of you got dictionary/ratware attack on your mail...
  9. freebsd port update, monitor outdated port with portsnap we have about 15 freebsd servers with us, ranging from...
  10. Get your own Domain Name from Yahoo Do you have your own domain name? If yes then...

Leave a Reply