Using NSLookup

Nslookup.exe is a Windows command-line administrative tool for testing and troubleshooting DNS servers. For starting the command line console, press START+R, write "cmd", and press Enter.

Nslookup.exe can be run in two modes: interactive and noninteractive. Noninteractive mode is useful when only a single piece of data needs to be returned. The syntax for noninteractive mode is:

nslookup [-option] [hostname] [server]

To start nslookup.exe in interactive mode, simply type "nslookup" at the command prompt:

C:\> nslookup
Default Server:  nameserver1.domain.com
Address:  10.0.0.1
>

Typing "help" or "?" at the command prompt will generate a list of available commands. Anything typed at the command prompt that is not recognized as a valid command is assumed to be a host name and an attempt is made to resolve it using the default server. To interrupt interactive commands, press CTRL+C. To exit interactive mode and return to the command prompt, type "exit"" at the command prompt.

The following is the help output and contains the complete list of options:

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
    class=X             - 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

Samples

To check an A record for the naked domain, type:

nslookup dnsazure.com

To check a subdomain (A or CNAME records), type:

nslookup www.dnsazure.com

Looking up Different Data Types

To look up different data types within the domain name space, use the set type or set q[uerytype] command at the command prompt. For example, to query for the mail exchanger data, type the following:

C:\>nslookup
Default Server:  ns1.domain.com
Address:  10.0.0.1
> set q=mx
> mailhost
Server:  ns1.domain.com
Address:  10.0.0.1
mailhost.domain.com     MX preference = 0, mail exchanger =
                        mailhost.domain.com
mailhost.domain.com     internet address = 10.0.0.5
>

Querying Directly from a Certain Name Server

To query another name server directly, add the DNS server name to command line:

C:\>nslookup dnsazure.com ns1.durabledns.com
Server:  UnKnown
Address:  75.127.97.225

Name:    dnsazure.com
Address:  23.100.50.51
C:\>