Dig, not to confuse with the social network Digg, is a tool that allows one to trouble shoot or view domain name DNS data. Dig is in the category of essential tools. Just like a voltage tester is an essential tool for an electrician, dig the most important tool for domain administrator. Dig tells the truth like nothing else.
Let us start with the basics first. A domain, to be accessible via a web browser, has to be associated with a name server that is tasked with responding to requests on its behalf and deliver the IP address associated with the domain in question. So every time someone decides to browse your Website, the browser has to go through a chain of requests and events to obtain the IP and then make a connection to the IP. The chain of events and requests are defined in protocols, standards, and best practices.
The good news is Dig can emulate the same browser actions and events without us having to understand the details behind them. One, however, needs to know how to interpret the results. The rest of this blog entry will be a list of essential Dig commands that will help trouble shoot a domain name. The following commands are done against the root domain name’s A record, although it could be against any valid DNS record like MX, SOA, TXT, etc.
First of all, if you are on a Windows computer, you will need to download Dig for Windows. Download it from here http://members.shaw.ca/nicholas.fong/dig/. You can install Dig on Linux directly from the repositories. Let’s get started!
Obtain the IP of a domain from your ISP’s cache
When running this command via your computer, you are essentially tapping into your ISP’s DNS server, which most often than not caches results to speed up lookups, improve performance, and save on bandwidth fees.
dig +nocmd vpslux.com A +short +norecurse
If the above command doesn’t return an IP address, chances are the domain’s IP is not in the cache. This could be because no one using your ISP has ever visited the domain or that the cache was flushed after the record expired.
Find out how much longer your ISP is going to cache your domain’s IP
dig +nocmd vpslux.com A +norecurse
;; ANSWER SECTION:
vpslux.com. 12884 IN A 18.104.22.168
That would be 12884 seconds until the ISP’s cache refreshes the data or removes the domain name from the cache altogether.
Obtain the IP of a domain bypassing the ISP’s cache
dig vpslux.com A +trace +short
That’s all folks. We hope this was useful.