nslookup (Name Server Lookup) is a built-in network administration command-line tool used to query the Domain Name System (DNS) to obtain mapping between domain names and IP addresses, or for other specific DNS records. It is available across virtually all major operating systems, including Windows, macOS, and Linux, making it a universal tool for diagnosing DNS issues. Interactive vs. Non-Interactive Modes
Non-Interactive Mode: Used for single queries. You type the complete command, receive the answer, and return immediately to the main command prompt.
Interactive Mode: Triggered by typing nslookup alone and pressing Enter. This opens a dedicated sub-shell where you can change settings, swap target servers, and run multiple consecutive queries. You exit by typing exit. Essential Troubleshooting Commands
To run these commands, open your terminal (macOS/Linux) or Command Prompt (Windows).
Basic Forward LookupFinds the IPv4 address associated with a domain. nslookup google.com Use code with caution.
Reverse Lookup (PTR)Finds the domain name associated with a specific IP address. nslookup 142.250.193.14 Use code with caution.
Query Specific DNS RecordsUse the -type= switch (or set type= in interactive mode) to extract targeted infrastructure records.
nslookup -type=mx google.com # Locates Mail Exchange servers nslookup -type=ns google.com # Identifies Authoritative Name Servers nslookup -type=txt google.com # Retrieves TXT records (like SPF/DKIM data) nslookup -type=cname google.com # Finds Canonical Name aliases Use code with caution.
Querying a Specific DNS ServerBypass your default system network settings to check if an upstream public or private server is resolving accurately.
nslookup google.com 8.8.8.8 # Directs the query straight to Google Public DNS Use code with caution. Isolating Errors Like a Pro DNS Troubleshooting – tools and commands – ClouDNS Blog
NSLookup. ‘NSLookup’ stands for ‘Name Server Lookup’. This command-line tool is used for obtaining information about DNS settings.
nslookup Command: 5 Practical Examples for DNS Troubleshooting
Leave a Reply