DNS
Utilities
host – DNS lookup utility
Forward query:
$ host dns.google
dns.google has address 8.8.8.8
dns.google has address 8.8.4.4
dns.google has IPv6 address 2001:4860:4860::8844
dns.google has IPv6 address 2001:4860:4860::8888
Reverse query:
$ host 8.8.8.8
8.8.8.8.in-addr.arpa domain name pointer dns.google.
Get MX records (mail server):
$ host -t MX constoso.com
constoso.com mail is handled by 10 mail2.namebrightmail.com.
constoso.com mail is handled by 10 mail1.namebrightmail.com.
Get NS record (who is authoritative for a domain):
$ host -t NS constoso.com
constoso.com name server ns1.namebrightdns.com.
constoso.com name server ns2.namebrightdns.com.
Get TXT records:
$ host -t TXT constoso.com
constoso.com descriptive text "google-site-verification=YourUniqueGoogleVerificationCode"
constoso.com descriptive text "v=spf1 a:smtpout1.namebrightmail.com a:smtpout2.namebrightmail.com ip4:216.87.78.66/31 include:namebrightmail.com -all"
With a specific DNS server:
$ host microsoft.com 8.8.8.8
Using domain server:
Name: 8.8.8.8
Address: 8.8.8.8#53
Aliases:
microsoft.com has address 104.215.148.63
microsoft.com has address 40.76.4.15
microsoft.com has address 40.112.72.205
microsoft.com has address 40.113.200.201
microsoft.com has address 13.77.161.179
microsoft.com mail is handled by 10 microsoft-com.mail.protection.outlook.com.
SystemD
nslookup – query Internet name servers interactively
$ nslookup dns.google
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: dns.google
Address: 8.8.8.8
Name: dns.google
Address: 8.8.4.4
Name: dns.google
Address: 2001:4860:4860::8888
Name: dns.google
Address: 2001:4860:4860::8844
$ nslookup 8.8.8.8
8.8.8.8.in-addr.arpa name = dns.google.
dig – DNS lookup utility
$ dig @8.8.8.8 debian.org
; <<>> DiG 9.11.3-1ubuntu1.12-Ubuntu <<>> @8.8.8.8 debian.org
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6191
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;debian.org. IN A
;; ANSWER SECTION:
debian.org. 124 IN A 130.89.148.77
debian.org. 124 IN A 128.31.0.62
debian.org. 124 IN A 149.20.4.15
;; Query time: 13 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Jun 18 11:07:16 CEST 2020
;; MSG SIZE rcvd: 87