The dig command is commonly used to make DNS queries. However, a much overlooked command is the host command. Here are some quick tips for a useful tool to add to your bag of tricks or to impress your friends.
The syntax is:
$ host [domain.com]
When run with no options, a simple quick summary is output:
$ host google.com google.com has address 126.96.36.199 google.com has address 188.8.131.52 google.com has address 184.108.40.206 google.com has address 220.127.116.11 google.com has address 18.104.22.168 google.com mail is handled by 10 aspmx.l.google.com. google.com mail is handled by 50 alt4.aspmx.l.google.com. google.com mail is handled by 40 alt3.aspmx.l.google.com. google.com mail is handled by 30 alt2.aspmx.l.google.com. google.com mail is handled by 20 alt1.aspmx.l.google.com.
Using tack a is the equivalent of any ANY request:
$ host -a google.com Trying "google.com" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57800 ;; flags: qr rd ra; QUERY: 1, ANSWER: 9, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;google.com. IN ANY ;; ANSWER SECTION: google.com. 296 IN MX 10 aspmx.l.google.com. google.com. 296 IN MX 50 alt4.aspmx.l.google.com. google.com. 296 IN MX 40 alt3.aspmx.l.google.com. google.com. 296 IN MX 30 alt2.aspmx.l.google.com. google.com. 296 IN MX 20 alt1.aspmx.l.google.com. google.com. 170005 IN NS ns2.google.com. google.com. 170005 IN NS ns1.google.com. google.com. 170005 IN NS ns3.google.com. google.com. 170005 IN NS ns4.google.com. Received 208 bytes from 22.214.171.124#53 in 59 ms
Tack t followed by the type desired such as CNAME, NS, A, AAAA and so forth is a quick way to check for a specific type. This is a quick way to check for an ipv6 record, as one example:
$ host -t AAAA ipv6.google.com ipv6.google.com is an alias for ipv6.l.google.com. ipv6.l.google.com has IPv6 address 2001:4860:800a::69