Nslookup is a powerful network administration tool available on all operating systems that allows you to query the DNS server to obtain information about domain names, IP addresses and other DNS records.
In this tutorial we will discover the most used nslookup commands.
If you cannot find the nslookup command, you will need to install the bind-utils package, below an example on CentOS 8 :
[root@srv ~]# dnf install bind-utils
1- Find the A record of a domain :
[root@srv ~]# nslookup google.com Server: 192.168.162.2 Address: 192.168.162.2#53 Non-authoritative answer: Name: google.com Address: 172.217.16.238 Name: google.com Address: 2a00:1450:4003:803::200e
2- Check a domain’s NS records:
[root@srv ~]# nslookup -type=ns google.com Server: 192.168.162.2 Address: 192.168.162.2#53 Non-authoritative answer: google.com nameserver = ns1.google.com. google.com nameserver = ns3.google.com. google.com nameserver = ns4.google.com. google.com nameserver = ns2.google.com. Authoritative answers can be found from:
3- Check the SOA record of a domain :
[root@srv ~]# nslookup -type=soa google.com Server: 192.168.162.2 Address: 192.168.162.2#53 Non-authoritative answer: google.com origin = ns1.google.com mail addr = dns-admin.google.com serial = 316854466 refresh = 900 retry = 900 expire = 1800 minimum = 60 Authoritative answers can be found from:
4- Find the MX record:
[root@srv ~]# nslookup -query=mx google.com Server: 192.168.162.2 Address: 192.168.162.2#53 Non-authoritative answer: google.com mail exchanger = 10 aspmx.l.google.com. google.com mail exchanger = 40 alt3.aspmx.l.google.com. google.com mail exchanger = 50 alt4.aspmx.l.google.com. google.com mail exchanger = 20 alt1.aspmx.l.google.com. google.com mail exchanger = 30 alt2.aspmx.l.google.com. Authoritative answers can be found from:
5- How to query a specific DNS server:
[root@srv ~]# nslookup google.com ns1.google.com Server: ns1.google.com Address: 216.239.32.10#53 Name: google.com Address: 172.217.16.238 Name: google.com Address: 2a00:1450:4003:803::200e
6- Display DNS Reverse :
[root@srv ~]# nslookup 172.217.16.238 238.16.217.172.in-addr.arpa name = mad08s04-in-f14.1e100.net.
7- Change the timeout interval:
[root@srv ~]# nslookup -timeout=20 google.com Server: 192.168.162.2 Address: 192.168.162.2#53 Non-authoritative answer: Name: google.com Address: 172.217.16.238 Name: google.com Address: 2a00:1450:4003:803::200e
8- Enable debug mode:
[root@srv ~]# nslookup -debug google.com Server: 192.168.162.2 Address: 192.168.162.2#53 ------------ QUESTIONS: google.com, type = A, class = IN ANSWERS: -> google.com internet address = 172.217.16.238 ttl = 5 AUTHORITY RECORDS: ADDITIONAL RECORDS: ------------ Non-authoritative answer: Name: google.com Address: 172.217.16.238 ------------ QUESTIONS: google.com, type = AAAA, class = IN ANSWERS: -> google.com has AAAA address 2a00:1450:4003:803::200e ttl = 5 AUTHORITY RECORDS: ADDITIONAL RECORDS: ------------ Name: google.com Address: 2a00:1450:4003:803::200e
To rea this article in French click here.
Comment installer Nginx on Rocky Linux 9
Empêcher les utilisateurs sudoers d’exécuter des cmds sudo
nmap : les 12 commandes que vous devez connaître
Comment installer Git sur Rocky Linux
Fail2Ban : How to protect Linux services