Testing DNS Using BIND'S dig Tool
Using the Domain Information Groper (dig) command line tool, you can test against the delegation where your domain is hosted, and you will immediately see whether the change took place without accounting for the cache or TTL (Time to Live) that you have configured.
Note
Windows users can download the tool from BIND’s website. Use Terminal to access dig on Linux and Macintosh systems.
Windows users can download the tool from BIND’s website. Use Terminal to access dig on Linux and Macintosh systems.
Using dig
Before using BIND's dig tool, you must access or install dig on your system. Once you have access to dig, you can use dig to test your DNS.
To access dig (Mac)
- From your Applications folder, open the Utilities folder, and then select Terminal.
- When Terminal is open, type a dig command using a hostname you want to look up.
To install dig (Windows)
-
Go to BIND’s website and download the most current, stable version of BIND.
Note
BIND supports both 32 and 64 bit Windows systems. Confirm which version of Windows you are using and download the correct version of BIND. View Microsoft’s documentation to determine which version of Windows you are using. - Extract the downloaded file and install BIND in the following directory: C:\Program Files\ISC BIND 9. Select the Tools Only check box.
- Once BIND is installed, on the Windows menu open the Control Panel, and then open your System properties.
- On the Advanced tab, click Environment Variables.
- Under System Variables, select Path, and then click Edit.
- At the end of the path in the Edit System Variable window, add C:\Program Files\ISC BIND 9\bin, and then click OK.
- In the Edit Variables window, click OK. In the System properties window, click OK.
To open the Command Prompt
For Windows versions 8 -10:
- Click the Windows menu icon.
- In the Search field, type CMD.
- Click Command Prompt.
For Windows version 7:
- On the Start menu click Run.
- Enter CMD, and then click OK.
To use dig to test your DNS
- Open Terminal (Mac and Linux) or Command Prompt (Windows).
- Type
dig <any hostname>
, and then press Enter.
The following information is returned:
- Question section: The query made to the DNS. In this example, we asked for the first available A record for the hostname, oracle.com.
- Answer section: The first available answer for the query made to the DNS. In this example, we received the A record for the IP address 137.254.16.101.
- Authority section: The authoritative nameservers from which the answer to the query was received. These nameservers house the zones for a domain.
- Additional section: Additional information the resolver may need but not the answer to the query.
dig Commands
Command | Description | Example |
---|---|---|
dig [hostname]
|
Returns any A record found within the queried hostname's zone. | dig oracle.com
|
dig [hostname] [record type]
|
Returns the records of that type found within the queried hostname's zone. | dig oracle.com MX
|
dig [hostname] +short
|
Provides a brief answer, usually just an IP address. | dig oracle.com +short
|
dig @[nameserver address] [hostname]
|
Queries the nameserver directly instead of your ISP's resolver. | dig @dnsmaster6.oracle.com
|
dig [hostname] +trace
|
Adding +trace instructs dig to resolve the query from the root nameserver downwards and to report the results from each query step. |
dig dyn.com +trace
|
dig -X [IP address]
|
Reverse lookup for IP addresses. | dig -X 137.254.16.101
|
dig [hostname] any
|
Returns all records for a hostname. | dig oracle.com any
|