There's a fine tool for checking the operation of your name server setup. It is called nslookup, and may be used both interactively and from the command line. In the latter case, you simply invoke it as
and it will query the name server specified in resolv.conf for hostname. (If this file names more than one server, nslookup will choose one at random).
The interactive mode, however, is much more exciting. Besides looking up individual hosts, you may query for any type of DNS record, and transfer the entire zone information for a domain.
When invoked without argument, nslookup will display the name server it uses, and enter interactive mode. At the `>' prompt, you may type any domain name it should query for. By default, it asks for class A records, those containing the IP address relating to the domain name.
You may change this type by issuing ``set type=type'', where type is one of the resource record names described above in section , or ANY.
For example, you might have the following dialogue with it:
If you try to query for a name that has no IP address associated, but other records were found in the DNS database, nslookup will come back with an error message saying ``No type A records found''. However, you can make it query for records other than type A by issuing the ``set type'' command. For example, to get the SOA record of unc.edu, you would issue:
In a similar fashion you can query for MX records, etc. Using a type of ANY returns all resource records associated with a given name.
A practical application of nslookup beside debugging is to obtain the current list of root name servers for the named.ca file. You can do this by querying for all type NS records associated with the root domain:
The complete set of commands available with nslookup may be obtained by the help command from within nslookup.