10 perintah Linux nslookup untuk DNS Lookup

nslookup is a network administration tool for querying the Domain Name System (DNS) to obtain domain name or IP address mapping or any other specific DNS record.

It is also used to troubleshoot DNS related problems. This article provides few examples on using the nslookup command.

nslookup can operate on both “Interactive mode” and “Non-Interactive mode”. Interactive mode allows the user to query the DNS-Server about various host, and domains. Non-Interactive mode allows the user to query the information for a host or domain. In this article, all the commands explained are “Non-Interactive mode”.

1. nslookup – Simple Example

nslookup followed by the domain name will display the “A Record” ( IP Address ) of the domain.

In the above output, server refers to the IP address of the DNS server. Then the below section provides the “A Record” ( IP Address ) of the domain “”.

The default output of nslookup command is less cluttered than the default output of dig command. Some of you might be comfortable using dig command for DNS lookups.

2. Query the MX Record using -query=mx

MX ( Mail Exchange ) record maps a domain name to a list of mail exchange servers for that domain. The MX record tells that all the mails sent to “” should be routed to the Mail server in that domain.

In the above example, we have 2 MX records for the domain “”. The number ( 5, 10 ), associated with the MX records tells the preference of mail server. Lower the number, higher the preference. So when a mail is sent to “”, first preference will be “”, then “”.

Baca Juga:  Aplikasi Meeting Online Terbaik untuk WFH

Authoritative Answer vs Non-Authoritative Answer

You may also noticed the keyword “Authoritative Answer” and “Non-Authoritative Answer” in the above output.

Any answer that originates from the DNS Server which has the complete zone file information available for the domain is said to be authoritative answer.

In many cases, DNS servers will not have the complete zone file information available for a given domain. Instead, it maintains a cache file which has the results of all queries performed in the past for which it has gotten authoritative response. When a DNS query is given, it searches the cache file, and return the information available as “Non-Authoritative Answer”.

3. Query the NS Record using -query=ns

NS ( Name Server ) record maps a domain name to a list of DNS servers authoritative for that domain. It will output the name serves which are associated with the given domain.

4. Query the SOA Record using -query=soa

SOA record ( start of authority ), provides the authoritative information about the domain, the e-mail address of the domain admin, the domain serial number, etc…

  • mail addr – specifies the mail address of the domain admin ( [email protected] )
  • serial – sort of revision numbering system. The standard convention is to use “YYYYMMYYNN” format. ( 2012-07-16. 01 will be incremented, if more than one edit has taken place on a same day )
  • refresh – specifies ( in seconds ), when the secondary DNS will poll the primary to see if the serial number has been increased. If increased, secondary will make a new request to copy the new zone file.
  • retry – specifies the interval to re-connect with the Primary DNS
  • expire – specifies the time that the secondary DNS will keep the cached zone file as valid
  • minimum – specifies the time that the secondary DNS should cache the zone file
Baca Juga:  Mengenal Lebih Dekat Tentang Internet of Things!

5. View available DNS records using -query=any

We can also view all the available DNS records using -query=any option.

6. Reverse DNS lookup

You can also do the reverse DNS look-up by providing the IP Address as argument to nslookup.

Baca Juga:  Cara Hapus Aplikasi Bawaan di HP Android | No Root!

7. Using Specific DNS server

Instead of using default DNS server’s for querying, you can also specify a particular name server to resolve the domain name.

In the above command, we have used the as the DNS server. Here you may notice that, we don’t get any “Non-authoritative answer:” header, since has all the zone information of

8. Change the port number to connect with

By default DNS servers uses the port number 53. If for any reasons, the port number got changed, then we can specify the port number using -port option

9. Change timeout interval to wait for a reply

You can change the default timeout to wait for a reply using -timeout option.

10. Enabling debug mode using -debug

You can turn on/off the debugging using -debug option in the command line

The debug mode will display the packets information during searching.

Similar to nslookup command, you can also use dig command to query the DNS information.