The main use of nslookup is to help with any DNS issues you may have. You can use it to find the IP address of a host, find the domain name of an IP address, or find mail servers on a domain. This tool can be used in two modes.
- An interactive
- Non-interactive mode
The Interactive mode is used to query DNS-Server about various domains and hosts. Non-Interactive mode is used to query about information of a domain or host.
Interactive mode In nslookup command in Linux
Example1: You can enter to the interactive mode by using the following command
If you only know the hostname of a host and you need to find the ip address of that host, type the hostname
Example2: Similar to the previous command, you can type the ip address to find out the domain using reverse domain lookup
Example3: You can set the DNS query type to NS to display the NS records only.
Example4: Query only Mail servers. To do that set the DNS query type to MX to display the MX records
The non-interactive mode in nslookup command
The non-interactive mode is invoked by typing the nslookup command, followed by the name, domain or the IP address of the host/network to be looked up.
Example 5: Run the following command to query SOA record
#nslookup -type=soa <URL>
Example6: You can enable Debug mode to display verbose output
#nslookup -debug <URL>
Example 7: Use the following command to query all available dns records:
#nslookup -query=any <URL>
Example 8: Instead of using default DNS server’s for querying, you can also specify a particular name server to resolve the domain name.
#nslookup <URL> <name_server_URL>
Example 9: You can use a specific port instead of using the default port 53 using the following command
#nslookup set port=<port_number> <URL>
Example 10: By default, NSlookup default timeout is set to 5 seconds. You can change it by using the following command
#nslookup -timeout=<number_of_seconds> <URL>
Latest posts by Ruwantha Nissanka (see all)
- 4 ways to hide your identity using linux - January 18, 2021
- How To Install Kali Linux in Virtualbox - December 31, 2020
- Kali Linux : The OS That Hackers Use - December 31, 2020
- How to monitor user activity in Linux with Acct - December 30, 2020
- Debsecan : You will not miss another security update - December 28, 2020