Table of Contents

Linux Commands#network
dig - How to use dig command in Linux
How to use nslookup Commands on Linux

How to use host command on Linux

DNS lookup utility



host command lists

Operation Command Example
lookups – mapping names to addresses host HOST host google.com
Reverse lookups – mapping addresses to names host IP_ADDRESS host 192.168.0.10
lookups at DNS Server host HOST SERVER host google.com 8.8.8.8
lookups at DNS Server host IP SERVER host 74.125.235.101 8.8.8.8
lookup for an any record host -t any HOST host -t any google.com
lookup for an soa record host -t soa HOST host -t soa google.com
lookup for an ns record host -t ns HOST host -t ns google.com
lookup for an a record host -t a HOST host -t a google.com
lookup for an mx record host -t mx HOST host -t mx google.com
lookup for an txt record host -t txt HOST host -t txt google.com
lookup for an any record
-a is equivalent to -v -t ANY
host -a HOST host -a google.com


host command options

host [-t type] hostname [server]

# host
Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]
            [-R number] [-m flag] hostname [server]
       -a is equivalent to -v -t ANY
       -c specifies query class for non-IN data
       -C compares SOA records on authoritative nameservers
       -d is equivalent to -v
       -l lists all hosts in a domain, using AXFR
       -i IP6.INT reverse lookups
       -N changes the number of dots allowed before root lookup is done
       -r disables recursive processing
       -R specifies number of retries for UDP packets
       -s a SERVFAIL response should stop query
       -t specifies the query type
       -T enables TCP/IP mode
       -v enables verbose output
       -w specifies to wait forever for a reply
       -W specifies how long to wait for a reply
       -4 use IPv4 query transport only
       -6 use IPv6 query transport only
       -m set memory debugging flag (trace|record|usage)


Example

#host www.amazon.com
www.amazon.com has address 205.251.242.103
#host -t mx amazon.com
amazon.com mail is handled by 5 amazon-smtp.amazon.com.
#host -t soa amazon.com
amazon.com has SOA record dns-external-master.amazon.com. root.amazon.com. 2010113059 180 60 3024000 60

#host -t soa aws.com
aws.com has SOA record ns-1490.awsdns-58.org. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400
#host -t any aws.com
aws.com has SPF record "v=spf1 include:spf.intermedia.net ~all"
aws.com descriptive text "v=spf1 include:spf.intermedia.net ~all"
aws.com mail is handled by 20 mx2.smtp.exch022.serverdata.net.
aws.com mail is handled by 10 mx1.smtp.exch022.serverdata.net.
aws.com has SOA record ns-1490.awsdns-58.org. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400
aws.com has address 184.72.117.127
aws.com has address 54.209.129.73
aws.com name server ns-1490.awsdns-58.org.
aws.com name server ns-527.awsdns-01.net.
aws.com name server ns-139.awsdns-17.com.
aws.com name server ns-1818.awsdns-35.co.uk.
#host -a  aws.com
Trying "aws.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53311
;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;aws.com.                       IN      ANY

;; ANSWER SECTION:
aws.com.                86211   IN      SPF     "v=spf1 include:spf.intermedia.net ~all"
aws.com.                86211   IN      TXT     "v=spf1 include:spf.intermedia.net ~all"
aws.com.                1011    IN      MX      10 mx1.smtp.exch022.serverdata.net.
aws.com.                1011    IN      MX      20 mx2.smtp.exch022.serverdata.net.
aws.com.                711     IN      SOA     ns-1490.awsdns-58.org. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400
aws.com.                86211   IN      A       184.72.117.127
aws.com.                86211   IN      A       54.209.129.73
aws.com.                172611  IN      NS      ns-1818.awsdns-35.co.uk.
aws.com.                172611  IN      NS      ns-527.awsdns-01.net.
aws.com.                172611  IN      NS      ns-1490.awsdns-58.org.
aws.com.                172611  IN      NS      ns-139.awsdns-17.com.

Received 421 bytes from 192.168.0.1#53 in 9 ms








Linux Commands#network
dig - How to use dig command in Linux
How to use nslookup Commands on Linux