How to troubleshoot DNS using Nslookup command
To troubleshoot DNS using nslookup command
This article explains you how to troubleshoot DNS using Nslookup commands in Linux. nslookup command is tool for testing and troubleshooting DNS server. It generally runs in two modes namely, Interactive and Non-Interactive. The interactive mode used to query DNS server about various domains and non interactive mode is used to query information of domain or host.
To Find out “ A” record (IP address) of Domain
[root@linuxhelp~]# nslookup google.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: google.com
Address: 216.58.196.110
The command query domain www.google.com with 8.8.8.8 public DNS server and below section shows Non-authoritative answer: displays A record of www.google.com
To Find out Reverse Domain Lookup
[root@linuxhelp~]# nslookup 216.58.196.110
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
46.220.58.216.in-addr.arpa name = maa03s18-in-f14.1e100.net.
Authoritative answers can be found from:
To Find out specific Domain Lookup
[root@linuxhelp~]# nslookup maa03s18-in-f14.1e100.net.
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: maa03s18-in-f14.1e100.net.
Address: 216.58.196.110
Query MX (Mail Exchange) record
[root@linuxhelp~]# nslookup -query=mx www.google.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
**Cant find www.google.com: No answer
Authoritative answers can be found from:
Google.com
origin = ns3.google.com
mail addr = dns-admin.google.com
serial = 117212017
refresh = 900
retry = 900
expire = 1800
minimum = 600
MX record maps domain name to list of mail exchange servers. So if the mail is received or sent to google.com it will route to mail server.
Query NS(Name Server) record
[root@linuxhelp~]# nslookup -query=ns www.bing.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
www.bing.com canonical name = any.edge.bing.com.
Authoritative answers can be found from:
bing.com
origin = ns1.msedge.com
mail addr = msnhst.microsoft.com
serial = 1344827782
refresh = 1800
retry = 900
expire = 2419200
minimum = 3600
Query SOA (Start of Authority) record
[root@linuxhelp~]# nslookup -type=soa www.bing.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
www.bing.com canonical name = any.edge.bing.com.
Authoritative answers can be found from:
bing.com
origin = ns1.msedge.com
mail addr = msnhst.microsoft.com
serial = 1344827782
refresh = 1800
retry = 900
expire = 2419200
minimum = 3600
refresh = 30
retry = 30
expire = 86400
minimum = 1800
Query all Available DNS records
[root@linuxhelp~]# nslookup -query=any yahoo.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
google.com
origin = ns4.google.com
mail addr = dns-admin.google.com
serial = 1172081016
refresh = 900
retry = 900
expire = 1800
minimum = 60
Name: google.com
Address: 216.58.197.78
Google.com nameserver=ns3.google.com
Google.com mail exchanger = 10 asmpx.l.google.com.
Google.com mail exchanger = 50 alt4.asmpx.l.google.com.
Google.com mail exchanger = 30 alt2.asmpx.l.google.com.
To Enable Debug mode
To enable Debug Mode ‘ set debug’ will return you verbose information like TTL.
[root@linuxhelp~]# nslookup
> set debug
> google.com
Server: 8.8.8.8
Address: 8.8.8.8#53
------------
QUESTIONS:
google.com, type = A, class = IN
ANSWERS:
-> google.com
internet address = 216.58.197.78
ttl = 299
AUTHORITY RECORDS:
ADDITIONAL RECORDS:
------------
Non-authoritative answer:
Name: google.com
Address: 216.58.197.78
Tag :
nslookup
Q
Is there any other command which is similar to nslookup command in linux?
A
Yes there are similar commands such as dig, traceroute which is similar to nslookup
Q
Nslookup: command not found error on RHEL/CentOS 7
A
install bind utils "sudo yum install bind-utils"
Q
I have my dns server running in port 56 whant can I do to use nslookup with different port number?
A
Use "nslookup -port 56 linuxhelp.com"
Q
while use dig, it shows command not found in my ubuntu machine what can I do ?
A
install digutils "sudo apt-get install dnsutils"
Q
in windows, traceroute command is not working
A
You can use tracert foe windows