Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Troubleshoot DNS with dig and nslookup

Check what a DNS server answers for your domain, with a web tool or a command.

Domains and DNS2 min read16 steps

With a web-based tool

  1. Open a web dig tool, for example digwebinterface.com, in your browser.
  2. Type the domain in the Hostnames or IP addresses box.
  3. In Type, choose the record type, such as A, MX or TXT.
  4. Under Options, tick Show command.
  5. Under Nameservers, choose the server to ask (for example, the authoritative server of the domain, or a public one).
  6. Click Dig. The page shows the answer and the dig command it used.

nslookup on Windows

  1. Open the Command Prompt (click Start, type cmd and press Enter).
  2. Run (replace example.com):
nslookup example.com
  1. To ask a certain DNS server, add its name or IP address:
nslookup example.com 8.8.8.8
  1. By default, nslookup looks up the A record. For another record type, set the type first:
nslookup
> set type=MX
> example.com
  1. Read the answer. For example:
Server:  resolver1.opendns.com
Address: 208.67.222.222

Name:    example.com
Address: 93.184.216.119

The first lines show the DNS server that answered. The last lines show the result.

dig on Linux and macOS

  1. Open a terminal. On macOS: Applications, Utilities, Terminal.
  2. Run:
dig example.com
  1. To ask a certain DNS server, use @:
dig @208.67.222.222 example.com
  1. For another record type, add it:
dig example.com MX
  1. Read the answer. The important part is the ANSWER SECTION:
;; ANSWER SECTION:
example.com.    2424    IN    A    93.184.216.119

;; Query time: 12 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
  • example.com. is the name you asked for.
  • 2424 is the TTL (time to live) in seconds.
  • A is the record type and 93.184.216.119 is the value.
  • Query time is how long the answer took.
  • SERVER is the DNS server that answered.

Useful short forms:

dig +short example.com
dig +short NS example.com
dig +trace example.com

What to look for

  • No answer, or the wrong IP: the record is missing or wrong in the DNS zone.
  • Different answers from different servers: the change has not spread yet. DNS changes can take up to 48 hours.
  • Check the NS records to be sure the domain uses the nameservers you expect.

Quick recap

  • nslookup on Windows, dig on Linux and macOS.
  • Add a server name to ask a specific DNS server.
  • Compare answers to find missing or old records.