☼
⌃
☰

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:

  1. Non-interactive mode: Used for a single query. You provide the domain or IP address as an argument to the command.
  2. Interactive mode: Allows for multiple queries within a single session. You can enter this mode by typing nslookup without 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.

SH
nslookup google.com

Reverse NS Lookup

To find the domain name associated with an IP address.

SH
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):

    SH
    nslookup -type=A google.com
    
  • AAAA Record (IPv6 Address):

    SH
    nslookup -type=AAAA google.com
    
  • MX Record (Mail Exchanger): Finds the mail servers for a domain.

    SH
    nslookup -type=MX google.com
    
  • NS Record (Name Server): Finds the authoritative name servers for a domain.

    SH
    nslookup -type=NS google.com
    
  • SOA Record (Start of Authority): Gets primary information about a DNS zone.

    SH
    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.

SH
nslookup google.com 1.1.1.1