Nslookup command scenario

Last updated on August 2nd, 2018 at 08:21 am

1. Find the A record of a domain.

$ nslookup example.com
Output:
Server: 127.0.0.1
Address: 127.0.0.1#53

Non-authoritative answer:
Name: example.com
Address: 10.20.30.40

2. Check the NS records of a domain.

$ nslookup -type=ns example.com
Output:
Server: 192.168.19.2
Address: 192.168.19.2#53

Non-authoritative answer:
example.com nameserver = ns1.nsexample.com.
example.com nameserver = ns2.nsexample.com.
example.com nameserver = ns3.nsexample.com.
example.com nameserver = ns4.nsexample.com.

Authoritative answers can be found from:
ns1.nsexample.com internet address = 1.2.3.4
ns2.nsexample.com internet address = 11.12.13.14
ns3.nsexample.com internet address = 110.120.130.140
ns4.nsexample.com internet address = 210.220.230.240

3. Query the SOA record of a domain.

$nslookup -type=soa example.com
Output:
Server: 192.168.19.2
Address: 192.168.19.2#53

Non-authoritative answer:
example.com
origin = ns1.nsexample.com.com
mail addr = noc.example.com
serial = 2015031401
refresh = 300
retry = 180
expire = 604800
minimum = 14400

Authoritative answers can be found from:
ns1.nsexample.com internet address = 10.20.30.40

4 .Find the MX records responsible for the email exchange.

$ nslookup -query=mx example.com
Output:
Server: 127.0.0.1
Address: 127.0.0.1#53

example.com mail exchanger = 10 mx1.example.com.
example.com mail exchanger = 5 mx2.example.com.

Authoritative answers can be found from:
mx1.example.com internet address = 10.20.30.40
mx2.example.com internet address = 50.60.70.80

5. Find all of the available DNS records of a domain.

$ nslookup -type=any example.com
Output:
Server: 192.168.19.2
Address: 192.168.19.2#53

Non-authoritative answer:
Name: example.com
Address: 173.194.35.7
Name: example
Address: 173.194.35.8

example.com nameserver = ns1.nsexample.com.
example.com nameserver = ns2.nsexample.com.
example.com
origin = ns1.nsexampple.com.com
mail addr = noc.example.com
serial = 2015031401
refresh = 300
retry = 180
expire = 604800
minimum = 14400
example.com mail exchanger = 10 mx1.example.com.
example.com mail exchanger = 5 mx2.example.com.
example.com has AAAA address 20:20:20:20

Authoritative answers can be found from:
ns3.nsexample.com internet address = 110.120.130.140
ns4.nsexample.com internet address = 210.220.230.240

6. Check the using of a specific DNS Server.

$ nslookup example.com ns1.nsexample.com
Output:
Server: 209.132.186.218
Address: 209.132.186.218#53

Name: example.com
Address: 1.2.3.4

7. Check the Reverse DNS Lookup.

$ nslookup 10.20.30.40
Output:
Server: 192.168.19.2
Address: 192.168.19.2#53

Non-authoritative answer:
40.30.20.10.in-addr.arpa name = example.com.

8. Change the port number for the connection.

$ nslookup -port=56 example.com

9. Change the timeout interval for a reply.

$ nslookup -timeout=20 example.com

10. Enable debug mode.

$ nslookup -debug example.com
Output:
Server: 192.168.19.2
Address: 192.168.19.2#53

QUESTIONS:
example.com, type = A, class = IN
ANSWERS:
-> example.com
internet address = 1.2.3.4
ttl = 10
AUTHORITY RECORDS:
ADDITIONAL RECORDS:
————
Non-authoritative answer:
Name: example.com
Address: 1.2.3.4

NOTES:
Authoritative answer – This is the answer that originates from the DNS Server which has the information about the zone file.
Non-autoritative answer – When a nameserver is not in the list for the domain you did a lookup on.
Different port – By default, the DNS servers use port 53.