network nslookup - ghdrako/doc_snipets GitHub Wiki

It is used to display DNS details, such as the IP address, the MX records for a domain or the NS servers of a domain.

nslookup can operate in two modes: interactive and non-interactive. The interactive mode allows you to query name servers for information about various hosts and domains or to print a list of hosts in a domain. The non-interactive mode allows you to print just the name and requested information for a host or domain.

IP Address of the domain will be displayed after writing the following command:-

$ nslookup [domain name]

We can also perform a reverse domain-lookup by using the following command:-

$ nslookup [ip adress]

Interactive mode

nslookup
> google.com   # find the IP address of a host, type the hostname
> 8.8.8.8    # perform a reverse DNS lookup, enter the IP address of a host

> set type=mx # display MX records (the mail servers responsible for accepting email messages on behalf of a recipient’s domain)
> google.com

> set type=ns #  display NS records,
> google.com

non-interactive mode

nslookup google.com
nslookup 8.8.8.8
nslookup -query=mx google.com
nslookup -query=ns google.com
nslookup -query=soa google.com #  display the SOA record (information about the domain)
nslookup -query=any google.com # display all the available DNS records

The nslookup program is officially deprecated, meaning that it’s no longer being maintained. You should use host or dig instead.