CompTIA Certifications

CompTIA Network+ 2009 Domain 5: Network Tools

NSLookup Network Utility

The nslookup, or nameserver lookup, utility is used to find an IP address and associate it with a domain name. NSLookup is available for most major operating systems.

C:\>nslookup /?
Usage:
 nslookup [-opt ...]             # interactive mode using default server
 nslookup [-opt ...] - server    # interactive mode using 'server'
 nslookup [-opt ...] host        # just look up 'host' using default server
 nslookup [-opt ...] host server # just look up 'host' using 'server'

If you type nslookup without any options, it opens an interactive prompt where you can issue commands. Type in a ? at the prompt and you will see the different options available:

C:\>nslookup
Default Server:  ns1.comporium.net
Address:  208.104.244.45

> ?
Commands:   (identifiers are shown in uppercase, [] means optional)
NAME            - print info about the host/domain NAME using default server
NAME1 NAME2     - as above, but use NAME2 as server
help or ?       - print info on common commands
set OPTION      - set an option
 all                 - print options, current server and host
 [no]debug           - print debugging information
 [no]d2              - print exhaustive debugging information
 [no]defname         - append domain name to each query
 [no]recurse         - ask for recursive answer to query
 [no]search          - use domain search list
 [no]vc              - always use a virtual circuit
 domain=NAME         - set default domain name to NAME
 srchlist=N1[/N2/.../N6] - set domain to N1 and search list to N1,N2, etc.
 root=NAME           - set root server to NAME
 retry=X             - set number of retries to X
 timeout=X           - set initial time-out interval to X seconds
 type=X              - set query type (ex. A,AAAA,A+AAAA,ANY,CNAME,MX,NS,PTR,
SOA,SRV)
 querytype=X         - same as type
 - set query class (ex. IN (Internet), ANY)
 [no]msxfr           - use MS fast zone transfer
 ixfrver=X           - current version to use in IXFR transfer request
server NAME     - set default server to NAME, using current default server
lserver NAME    - set default server to NAME, using initial server
root            - set current default server to the root
ls [opt] DOMAIN [> FILE] - list addresses in DOMAIN (optional: output to FILE)
 -a          -  list canonical names and aliases
 -d          -  list all records
 -t TYPE     -  list records of the given RFC record type (ex. A,CNAME,MX,NS,
PTR etc.)
view FILE           - sort an 'ls' output file and view it with pg
exit            - exit the program

>

If you enter in a domain name or hostname at the prompt, it will use your current DNS server to determine the IP address:

> learnthat.com
Server:  ns1.comporium.net
Address:  208.104.244.45

Non-authoritative answer:
Name:    learnthat.com
Address:  72.51.34.96

NSlookup allows you to troubleshoot domain name server problems and problems resolving host names.