nslookup
Overview
The nslookup
command queries Internet name servers for DNS (Domain Name System) information. It’s used for diagnosing DNS problems and verifying DNS records.
Syntax
nslookup [options] [hostname|IP] [server]
Common Options
Option | Description |
---|---|
-type=a |
Address record |
-type=aaaa |
IPv6 address |
-type=mx |
Mail server |
-type=ns |
Name server |
-type=soa |
Start of authority |
-type=txt |
Text record |
-type=ptr |
Pointer record |
-type=cname |
Canonical name |
-debug |
Debug mode |
-port=N |
Server port |
-timeout=N |
Query timeout |
-query=type |
Set query type |
Key Use Cases
- DNS troubleshooting
- Record verification
- Mail server lookup
- Reverse DNS
- Domain validation
Examples with Explanations
Example 1: Basic Lookup
nslookup google.com
Look up IP address
Example 2: Mail Servers
nslookup -type=mx domain.com
Find mail servers
Example 3: Name Servers
nslookup -type=ns domain.com
Find name servers
Understanding Output
Example output:
Server: 192.168.1.1
Address: 192.168.1.1#53
Name: google.com
Address: 172.217.167.78
Components: - DNS server used - Query result - Record details
Common Usage Patterns
Address lookup:
nslookup hostname
Reverse lookup:
nslookup IP_address
Specific server:
nslookup domain.com 8.8.8.8
Performance Analysis
- Response time
- Record availability
- Server reliability
- Cache effects
- Resolution chain
Additional Resources
Best Practices
- Verify multiple servers
- Check all record types
- Document results
- Regular testing
- Compare responses
Troubleshooting
- Resolution failures
- Timeout issues
- Server problems
- Cache issues
- Record conflicts
Record Types
- A (Address)
- AAAA (IPv6)
- MX (Mail)
- NS (Nameserver)
- CNAME (Alias)