nslookup
Table of Contents
Nslookup
Description
nslookup, which stands for "name server lookup", is a network administration utility available for Windows, macOS, and Linux. It is used for querying the Domain Name System (DNS) to map domain names to IP addresses and vice versa. This functionality is essential for diagnosing DNS resolution problems and gathering information about a domain's configuration.
The tool can be operated in two modes:
- Non-interactive mode: Used for a single query. You provide the domain or IP address as an argument to the command.
- Interactive mode: Allows for multiple queries within a single session. You can enter this mode by typing
nslookupwithout any arguments.
While still widely used, nslookup is sometimes considered a legacy tool, with newer utilities like dig and host offering more detailed output on some systems.
Examples
Basic Domain Name Lookup
To find the IP address(es) associated with a domain name.
nslookup google.com
Reverse NS Lookup
To find the domain name associated with an IP address.
nslookup 8.8.8.8
Query for Specific Record Types
You can query for different types of DNS records using the -type (or -query) option.
A Record (IPv4 Address):
nslookup -type=A google.com
AAAA Record (IPv6 Address):
nslookup -type=AAAA google.com
MX Record (Mail Exchanger): Finds the mail servers for a domain.
nslookup -type=MX google.com
NS Record (Name Server): Finds the authoritative name servers for a domain.
nslookup -type=NS google.com
SOA Record (Start of Authority): Gets primary information about a DNS zone.
nslookup -type=SOA google.com
Using a Specific NS Server
By default, nslookup uses the system's configured DNS server. You can specify a different one.
nslookup google.com 1.1.1.1