nslookup — Query DNS records
Resolves names to addresses and addresses to names, and shows which DNS server answered.
Resolves names to addresses and addresses to names, and shows which DNS server answered.
Basic Information
| Command Name | nslookup |
|---|---|
| One-line Introduction | Resolves names to addresses and addresses to names, and shows which DNS server answered. |
| Provided by | BIND utilities (packaged by distributions) |
| Official Documentation | https://man7.org/linux/man-pages/man1/nslookup.1.html |
| Supported Operating Systems | Linux, macOS, BSD, Windows |
| Installation Status | Package required (apt install dnsutils) |
| Category | Linux networking (tags: Address, port and firewall management (tags: DNS, domain, query, diagnose)) |
What is this command?
nslookup asks a DNS server how a name and an address map to each other.
You can query a specific server instead of the default one, which helps compare answers.
What problems does it solve?
- Check which address a domain resolves to.
- Inspect the answer of one specific DNS server.
- Look up record types such as MX, NS or TXT.
- Tell whether a resolution failure is local or server-side.
Key features
Default lookup
Passing a name or address queries the default resolver.
- When to use: When you want the configured resolver's answer.
- What you get: The name-to-address mapping is printed.
- Limitations: Cached answers may differ from the authoritative server.
Query a specific server
A second argument selects the DNS server to ask.
- When to use: When comparing answers between servers.
- What you get: Only the chosen server's answer appears.
- Limitations: No answer arrives if that server is unreachable.
Record type queries
Use set type= to ask for MX, NS, TXT and other records.
- When to use: When checking mail servers or ownership records.
- What you get: Records of that type are listed.
- Limitations: Some types answer correctly only from the authoritative server.
Installation and usage
Check whether it is installed
nslookup -version
sudo apt install dnsutils
Real-world examples
Resolve a name
Look up the A record of a domain.
nslookup example.com
Choose a server
Ask a public resolver directly.
nslookup example.com 1.1.1.1
MX record
Inspect mail exchanger records.
nslookup -type=MX example.com
Source (HTML): https://games.aidebatehub.com/programs/linux/network/nslookup.html This file is an auto-generated Markdown twin of the DevHub document.
AI Knowledge Hub
Visitor Comments