Nslookup

From aldeid
Jump to navigation Jump to search

Description

nslookup is an interactive tool for testing and troubleshooting DNS servers.

Usage

Non-interactive mode

$ nslookup somesite.com
Server:        192.168.1.1
Address:       192.168.1.1#53

Non-authoritative answer:
Name:	somesite.com
Address: 82.98.86.175

Interactive mode

Commands

host <server>
Look up information for host using the current default server or using server, if specified. If host is an Internet address and the query type is A or PTR, the name of the host is returned. If host is a name and does not have a trailing period, the search list is used to qualify the name.
To look up a host not in the current domain, append a period to the name.
> aldeid.com
Server:        8.8.8.8
Address:       8.8.8.8#53

Non-authoritative answer:
Name:	aldeid.com
Address: 46.252.206.1
server <domain>
Changes default server to be used for queries
> server 8.8.8.8
Default server: somesite.com
Address: 8.8.8.8#53
lserver <domain>
Change the default server to domain; lserver uses the initial server to look up information about domain, while server uses the current default server. If an authoritative answer can't be found,the names of servers that might have the answer are returned.
exit
Quits the program
set keyword[=value]
This command is used to change state information that affects the lookups. Valid keywords are:

Keywords

All of these keywords are modified using following syntax:

set keyword[=value]

For example:

set querytype=ns
all
Prints the current values of the frequently used options to set. Information about the current default server and host is also printed.
class=value
Change the query class to one of
  • IN: The Internet class (default class)
  • CH: The Chaos class
  • HS: The Hesiod class
  • ANY: wildcard
[no]debug
Turn on or off the display of the full response packet and any intermediate response packets when searching.
(Default = nodebug; abbreviation = [no]deb)
[no]d2
Turn debugging mode on or off. This displays more about what nslookup is doing.
(Default = nod2)
domain=name
Sets the search list to name.
[no]search
If the lookup request contains at least one period but doesn't end with a trailing period, append the domain names in the domain search list to the request until an answer is received.
port=value
Change the default TCP/UDP name server port to value.
(Default = 53; abbreviation = po)
querytype=value
Change the query type (ns, a, ...)
> set querytype=mx
> google.com
Server:        8.8.8.8
Address:       8.8.8.8#53

Non-authoritative answer:
google.com	mail exchanger = 40 alt3.aspmx.l.google.com.
google.com	mail exchanger = 30 alt2.aspmx.l.google.com.
google.com	mail exchanger = 20 alt1.aspmx.l.google.com.
google.com	mail exchanger = 50 alt4.aspmx.l.google.com.
google.com	mail exchanger = 10 aspmx.l.google.com.

Authoritative answers can be found from:
google.com	nameserver = ns3.google.com.
google.com	nameserver = ns2.google.com.
google.com	nameserver = ns1.google.com.
google.com	nameserver = ns4.google.com.
aspmx.l.google.com	internet address = 209.85.229.26
ns2.google.com	internet address = 216.239.34.10
ns1.google.com	internet address = 216.239.32.10
ns3.google.com	internet address = 216.239.36.10
ns4.google.com	internet address = 216.239.38.10
type=value
Change the type of the information query.
(Default = A; abbreviations = q, ty)
[no]recurse
Tell the name server to query other servers if it does not have the information.
(Default = recurse; abbreviation = [no]rec)
retry=number
Set the number of retries to number.
timeout=number
Set the number of retries to number.
timeout=number
Change the initial timeout interval for waiting for a reply to number seconds.
[no]vc
Always use a virtual circuit when sending requests to the server.
(Default = novc)
[no]fail
Try the next nameserver if a nameserver responds with SERVFAIL or a referral (nofail) or terminate query (fail) on such a response.
(Default = nofail)