Network and remote access

Command nslookup

Query DNS interactively

Linux · Bash examples · commands run on the selected server

When to use nslookup

Use nslookup for interactive or one-shot DNS investigation. Specify a record type and resolver to make a test reproducible, while remembering that DNS lookup is only one stage of connecting to a service.

Syntax

nslookup [OPTIONS] [NAME [DNS_SERVER]]

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-type=TYPE
Select DNS record type.
DNS_SERVER
Send a request to the specified server.

Usage examples

Find domain address

nslookup example.com

The default resolver is queried for the domain.

Check mail records

nslookup -type=MX example.com

Mail-exchange records are requested instead of an ordinary address lookup.

Use selected DNS

nslookup example.com 1.1.1.1

A chosen public resolver answers the query for comparison.

Notes and limitations

  • Running without a name opens interactive mode; exit leaves it.
  • Output varies by implementation. For automation, dig offers more explicit output controls.

Common questions and troubleshooting

Why can DNS succeed while a website is unavailable?

Name resolution does not verify routing, TCP, TLS or the web application. Check the failed stage separately.

Why is an answer marked non-authoritative?

It was provided by a resolver that is not authoritative for the zone, often from cache. This is normal and not itself an error.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man nslookup.