How to: Look up a record in DNS using nslookup



The nslookup command is a standard tool which is available on most operating systems, such as Linux, macOS, UNIX, and Windows.

To perform a single query, you can pass the name and nameserver on the command line.

EXAMPLE: nslookup

Additional information

  • Open your terminal or command app, such as Command Prompt in Windows, or Terminal in macOS.
  • Type nslookup on a command line and press Enter/return.
  • It will default to a nameserver, but you can change which nameserver you query against by typing server, for instance. From that point, you'll be querying against that nameserver (e.g.,
  • To perform a query, just type the name at the prompt (e.g.,
  • By default, nslookup will only query for A and CNAME alias records, which are the most commonly accessed record types. If you want to do a comprehensive search, type set type=any, and nslookup will return any matching records, such as MX, NS, and SOA.
  • Use your operating system's help documentation to review the various commands available within nslookup on your operating system.


For MX (mail exchange) records in the DNS server:

Default Server:

> set type=mx
        primary name server =
        responsible mail addr =
        serial  = 1243965417
        refresh = 3600 (1 hour)
        retry   = 900 (15 mins)
        expire  = 3600000 (41 days 16 hours)
        default TTL = 3600 (1 hour)