Check DNS (Domain Name Server) Records On Linux Using Host Command

host is a simple utility for performing DNS lookups. It is normally used to convert names to IP addresses and vice versa. When no arguments or options are given, host prints a short summary of its command line arguments and options. Many of the 3rd party website is there to check about DNS records but we are the server administrator and we are having power shell then why? we need 3rd party website to check the DNS records. You can check all the DNS records using host command. Everything is possible in LINUX so don’t think any 3rd party tools to do something in Linux Environment. Alternatively we can Lookup the DNS records using dig command & nslookup command

1) How to Lookup the domain IP address / A record ?

Use the host command followed by corresponding Domain Name to lookup the domain A record / IP address.

# Common Syntax for host command #
# host -[Options] [TYPE] [domainname.com]

# Lookup 2daygeek.com domain A Record / IP Address #
# host 2daygeek.com
2daygeek.com has address 182.71.233.70

2) How to Lookup the domain MX record ?

Use the host command with -t option choose query type (Here i’m using query type as MX) and followed by corresponding domain name to lookup the domain MX records.

# host -t mx 2daygeek.com
2daygeek.com mail is handled by 0 2daygeek.com.

3) How to Lookup the domain NS record ?

Use the host command with -t option choose query type (Here i’m using query type as NS) and followed by corresponding domain name to lookup the domain NS records.

# host -t ns 2daygeek.com
2daygeek.com name server ns2.2daygeek.in.
2daygeek.com name server ns1.2daygeek.in.

4) How to Lookup the domain TXT (SPF) record ?

Use the host command with -t option choose query type (Here i’m using query type as txt) and followed by corresponding domain name to lookup the domain SPF records.

# host -t txt 2daygeek.com
2daygeek.com descriptive text "v=spf1 ip4:182.71.233.70 +a +mx +ip4:49.50.66.31 ?all"

5) How to Lookup the domain Cname record ?

Use the host command with -t option choose query type (Here i’m using query type as Cname) and followed by corresponding domain name to lookup the domain Cname records.

# host -t cname 2daygeek.com
2daygeek.com has no CNAME record

6) How to Lookup the domain SOA record ?

Use the host command with -t option choose query type (Here i’m using query type as SOA) and followed by corresponding domain name to lookup the domain SOA records.

# host -t soa 2daygeek.com
2daygeek.com has SOA record ns1.2daygeek.in. jeyakabil.gmail.com. 2013110202 86400 7200 3600000 86400

7) How to find out the domain reverse DNS (PTR) record ?

Use the host command with -t option choose query type (Here i’m using query type as DNS (PTR)) and followed by corresponding domain name to lookup the domain DNS (PTR) records.

# host 182.71.233.70
70.233.71.182.in-addr.arpa domain name pointer NSG-Static-070.233.71.182.airtel.in.

8) How to Lookup ALL domain records ?

Use the host command with -t option choose query type (Here i’m using query type as a) and followed by corresponding domain name to lookup the domain ALL records.

# host -a 2daygeek.com
Trying "2daygeek.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59145
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 2, ADDITIONAL: 3

;; QUESTION SECTION:
;2daygeek.com.                  IN      ANY

;; ANSWER SECTION:
2daygeek.com.           86321   IN      SOA     ns1.2daygeek.in. jeyakabil.gmail.com. 2013110202 86400 7200 3600000 86400
2daygeek.com.           14233   IN      TXT     "v=spf1 ip4:182.71.233.70 +a +mx +ip4:49.50.66.31 ?all"
2daygeek.com.           12127   IN      MX      0 2daygeek.com.
2daygeek.com.           12127   IN      A       182.71.233.70
2daygeek.com.           84127   IN      NS      ns1.2daygeek.in.
2daygeek.com.           84127   IN      NS      ns2.2daygeek.in.

;; AUTHORITY SECTION:
2daygeek.com.           84127   IN      NS      ns2.2daygeek.in.
2daygeek.com.           84127   IN      NS      ns1.2daygeek.in.

;; ADDITIONAL SECTION:
2daygeek.com.           12127   IN      A       182.71.233.70
ns1.2daygeek.in.       12127   IN      A       182.71.233.70
ns2.2daygeek.in.       12127   IN      A       182.71.233.70

Received 304 bytes from 83.170.69.2#53 in 13 ms

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...