Nslookup command to troubleshoot DNS issues.
Nslookup is a command line administrative tool that displays information which you can use to diagnose Domain Name System (DNS) infrastructure.
Syntax
Nslookup
Domain Name | Display information about the host/domain NAME using default server | ||
Domain_Name DNS | As above, use DNS as server | ||
help or ? | Display information on common commands | ||
Set | OPTIONS | ||
All | Display current server and host details | ||
debug | Display debugging information | ||
nod2 | Display exhaustive debugging information | ||
defname | append domain name to each query | ||
recurse | ask for recursive answer to query | ||
search | use domain search list | ||
novc | 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,ANY,CNAME,MX,NS,PTR,SOA,SRV) | ||
queryType=X | same as type | ||
class=X | set query class (ex. IN (Internet), ANY) | ||
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 | ||
finger [USER] | finger the optional NAME at the current default host | ||
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 type (e.g. A,CNAME,MX,NS,PTR etc.) | ||
view FILE | sort an ‘ls’ output file and view it with pg | ||
exit | exit the program | ||
Note
- If ComputerToFind is an IP address and the query is for an A or PTR resource record type, the name of the computer is returned. If ComputerToFind is a name and does not have a trailing period, the default DNS domain name is appended to the name. This behavior depends on the state of the following set subcommands: domain, srchlist, defname, and search.
- If you type a hyphen (-) instead of ComputerToFind, the command prompt changes to nslookup interactive mode.
- The command-line length must be less than 256 characters.
- Nslookup has two modes: interactive and noninteractive.
If you need to look up only a single piece of data, use noninteractive mode. For the first parameter, type the name or IP address of the computer that you want to look up. For the second parameter, type the name or IP address of a DNS name server. If you omit the second argument, nslookup uses the default DNS name server.
If you need to look up more than one piece of data, you can use interactive mode. Type a hyphen (-) for the first parameter and the name or IP address of a DNS name server for the second parameter. Or, omit both parameters and nslookup uses the default DNS name server. Following are some tips about working in interactive mode:
- To interrupt interactive commands at any time, press CTRL+B.
- To exit, type exit.
Example:
Nslookup Domain_Name
Display All details of Domain_Name
Nslookup
Set type = all
Domain_Name