How to Use nslookup

If your site is connected to the Internet, you can use the nslookup(1) program to interactively find MX and other records. To run nslookup, just type its name:

% nslookup

Note that you might have to give the full pathname. Under SunOS, nslookup lives in the /usr/etc directory; under Ultrix, in /usr/ucb; under HP-UX, in /usr/bin; and under Solaris and FreeBSD, in the /usr/sbin directory.

Once nslookup is running, it prints the name of your default name server and the IP address for that machine, then a > character as a prompt, and awaits input:

Server:  Your.Main.Server
Address:  123.45.67.8

>

To tell nslookup to look up only MX records,[12] use the set command:

> set type=mx
>

Now look up some real hosts and domains. First look up the domain sendmail.org by entering its name at the prompt:

> sendmail.org.

Note the trailing dot that tells nslookup(1) that the local, default domain should not be appended prior to the lookup. The output produced by this lookup looks like this:

> sendmail.org.
Server:  Your.Main.Server
Address:  123.45.67.8

sendmail.org    preference = 10, mail exchanger = smtp.neophilic.com
sendmail.org    preference = 20, mail exchanger = smtp.gshapiro.net
sendmail.org    preference = 100, mail exchanger = playground.sun.com
smtp.neophilic.com      internet address = 209.31.233.176
smtp.gshapiro.net       internet address = 209.220.147.178
playground.sun.com      internet address = 192.9.5.5
>

The first two lines again show the name and IP address of the local DNS server. The next ...

Get Sendmail, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.