Networking

nslookup

nslookup is a utility used to troubleshoot DNS-related problems. Using nslookup, you can, for example, run manual name resolution queries against DNS servers, get information about the DNS configuration of your system or specify what kind of DNS record should be resolved.

When nslookup is started, it displays the current hostname and the IP address of the locally configured DNS server. You will then see a command prompt which allows you to specify further queries. This is known as 'interactive' mode. The commands you can enter in interactive mode are listed in Table 10.

Table 10 nslookup Switches

Switch

Description

all

Prints options, as well as current server and host information

[no]debug

Prints debugging information

[no]d2

Prints exhaustive debugging information

[no]defname

Appends the domain name to each query

[no]recurse

Asks for recursive answer to query

[no]search

Uses domain search list

[no]vc

Always uses a virtual circuit

domain=NAME

Sets default domain name to NAME

srchlist=N1[/N2/.../N6]

Sets domain to N1 and search list to N1, N2, and so on

root=NAME

Sets root server to NAME

retry=X

Sets number of retries to X

timeout=X

Sets initial timeout interval to X seconds

type=X

Sets query type (for example, A, ANY, CNAME, MX, NS, PTR, SOA, or SRV)

querytype=X

Same as type

class=X

Sets query class (for example, IN [Internet], ANY)

[no]msxfr

Uses MS fast zone transfer

ixfrver=X

Current version to use in IXFR transfer request

server NAME

Sets default server to NAME, using current default server

exit

Exits the program


Instead of using interactive mode, you can also execute nslookup requests directly at the command prompt. The following listing shows the output from nslookup when a domain name is specified to be resolved.

C:\>nslookup comptia.org
Server:  nsc1.ht.ok.shawcable.net
Address:  64.59.168.13
Non-authoritative answer:
Name:    comptia.org
Address:  208.252.144.4

As you can see from the output, nslookup shows the hostname and IP address of the DNS server against which the resolution was performed, along with the hostname and IP address of the resolved host.