Introduction
nslookup
anddig
The (Domain Information Groper) command is used to queryDNS
(Domain Name System) Server to obtain DNS record information such as domain name and IP address.
nslookup command
nslookup
(Name Server Lookup) command is used for queryingDNS
Old tool for recording. Although still available, it has been deprecated and replaced bydig
。
Basic usage
nslookup [domain-name]
Example usage
nslookup
Sample output
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name:
Address: 142.250.183.110
Query the specified DNS server
Use a custom DNS server instead of the system's default DNS server
nslookup 8.8.8.8
Query MX (Mail Exchange) records
nslookup -query=MX
Reverse DNS lookup (get domain name from IP)
nslookup 142.250.183.110
dig command
dig
Commands are a more powerful and flexible tool for querying DNS information.
Basic usage
dig [options] [domain-name] [record-type]
Query the IP address from the domain name
dig
Sample output
;; ANSWER SECTION:
. 299 IN A 142.250.183.110
The IP address (A record) of # is 142.250.183.110
Query a specific DNS server
dig @8.8.8.8
Query MX (mail exchange) records
dig MX
Sample output
. 3599 IN MX 50 .
. 3599 IN MX 40 .
Reverse query DNS
dig -x 142.250.183.110
Get short answers only
dig +short
Query all DNS records
dig ANY
The difference between nslookup and dig
Features | nslookup | dig |
---|---|---|
Output | Simpler, but less details | Detailed output |
Support querying specific DNS servers | support | support |
Reverse search | support | support |
Support modern functions | Deprecated | Recommended use |
The above is the detailed content of Linux using nslookup and dig to query domain name and IP information. For more information about Linux query domain name and IP, please follow my other related articles!