![]() ![]() |
9.4 How to Use nslookupIf 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 three lines show that the domain sendmail.org has three MX records. Mail addressed to that domain is sent to the machine with the lowest preference (cost), which happens to be smtp.neophilic.com.[13] If that machine is down (or not accepting mail), the message is sent to the machine with the next higher cost, smtp.gshapiro.net. The last three lines show the IP addresses (A records) for those machines.
The nslookup(1) program is a useful tool for performing all the same lookups that are done by sendmail. Each type of lookup corresponds to a set type. A list of some available nslookup(1) types is shown in Table 9-1.
To exit nslookup(1), just type exit (or Ctrl-D if that fails). |
![]() ![]() |