| by Scott Kilroy | No comments

10 Examples of using nslookup in linux

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 an interactive and a noninteractive 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

You can enter to the interactive mode by using the following command

#nslookup

If you only know the hostname of a host and you need to find the ip address of that host, type the hostname

Similar to the previous command, you can type the ip address to find out the domain using reverse domain lookup

You can set the DNS query type to NS to display the NS records

>set type=ns
><URL>

Set the DNS query type to MX to display the MX records

>set type=mx
><URL>

The non-interactive mode

The non-interactive mode is invoked by typing the nslookup command, followed by the name or the IP address of the host to be looked up.

Run the following command to query SOA record

#nslookup -type=soa <URL>

You can enable Debug mode to display verbose output

#nslookup -debug <URL>

Use the following command to query all available dns records:

#nslookup -query=any <URL>

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>

You can use a specific port instead of using the default port 53 using the following command

#nslookup set port=<port_number> <URL>

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>

 

The post 10 Examples of using nslookup in linux appeared first on The Linux Juggernaut.

Share Button

Source: The Linux Juggernaut

Leave a Reply