host - Unix, Linux Command


Advertisements


NAME

host - DNS lookup utility

SYNOPSIS

host [-aCdlnrsTwv] [-c class] [-N ndots] [-R number] [-t type] [-W wait] [-m flag] [-4] [-6] {name} [server]

DESCRIPTION

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.

OPTIONS

TAG DESCRIPTION
-a The -a (all) option is equivalent to setting the -v option and asking host to make a query of type ANY..
-C When the -C option is used, host will attempt to display the SOA records for zone name from all the listed authoritative name servers for that zone. The list of name servers is defined by the NS records that are found for the zone.

-c class TThe -c option instructs host to make a DNS query of class class. This can be used to lookup Hesiod or Chaosnet class resource records. The default class is IN (Internet)..
-d Verbose output is generated by host when the -d or -v option is used. The two options are equivalent. They have been provided for backwards compatibility. In previous versions, the -d option switched on debugging traces and -v enabled verbose output.
-l List mode is selected by the -l option. This makes host perform a zone transfer for zone name. Transfer the zone printing out the NS, PTR, and address records (A/AAAA). If combined with -a all records will be printed.
-i The -i option specifies that reverse lookups of IPv6 addresses should use the IP6.INT domain as defined in RFC1886. The default is to use IP6.ARPA.
-N ndots The -N option sets the number of dots that have to be in name for it to be considered absolute
-R number Non-recursive queries can be made via the -r option. Setting this option clears the RD ("recursion desired") bit in the query which host makes..
-T By default, host uses UDP when making queries. The -T option makes it use a TCP connection when querying the name server. TCP will be automatically selected for queries that require it, such as zone transfer (AXFR) requests.
-4 The -4 option forces host to only use IPv4 query transport..
-6 The -6 option forces host to only use IPv6 query transport.
-s The -s option tells host not to send the query to the next nameserver if any server responds with a SERVFAIL response, which is the reverse of normal stub resolver behavior.
-m flag The -m can be used to set the memory usage debugging flags record, usage and trace.
-6 The -6 option forces host to only use IPv6 query transport.

EXAMPLES

EXAMPLE-1:

Making simple query for any site say google.com using sitename

$ host google.com

output:

google.com has address 172.217.26.174
google.com has IPv6 address 2404:6800:4007:801::200e
google.com mail is handled by 20 alt1.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 50 alt4.aspmx.l.google.com.

EXAMPLE-2:

Making host query using IP address:

$ host 172.217.26.174

output:
174.26.217.172.in-addr.arpa domain name pointer maa03s22-in-f14.1e100.net.

EXAMPLE-3:

To display MX records for google.com domain

$ host -n -t mx google.com

output:
#  host -n -t mx google.com
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 20 alt1.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.

EXAMPLE-4:

To find out the domain name servers

$ host -t ns google.com

output:
# host -t ns google.com
google.com name server ns3.google.com.
google.com name server ns1.google.com.
google.com name server ns2.google.com.
google.com name server ns4.google.com.

EXAMPLE-5:

Find out the domain TXT record

$ host -t txt google.com

output:
google.com descriptive text "v=spf1 include:_spf.google.com ~all"

EXAMPLE-6:

Find out the SOA record:

$ host -t soa google.com

output:
google.com has SOA record ns4.google.com. dns-admin.google.com. 143179694 900 900 1800 60

 

EXAMPLE-7:

Query Particular Name Server

$ host google.com ns4.google.com

output:

Using domain server:
Name: ns4.google.com
Address: 216.239.38.10#53
Aliases:

google.com has address 216.58.196.110
google.com has IPv6 address 2404:6800:4007:806::200e
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 50 alt4.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 20 alt1.aspmx.l.google.com.

EXAMPLE-8:

Display all information regarding Domain Records and Zone:

$ host -a amazon.in

output:
Trying "amazon.in"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26969
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 7, ADDITIONAL: 12

;; QUESTION SECTION:
;amazon.in.                     IN      ANY

;; ANSWER SECTION:
amazon.in.              5       IN      A       178.236.7.18
amazon.in.              5       IN      A       54.239.32.8
amazon.in.              5       IN      A       54.239.34.40

;; AUTHORITY SECTION:
in.                     5       IN      NS      c0.in.afilias-nst.info.
in.                     5       IN      NS      a2.in.afilias-nst.info.
in.                     5       IN      NS      b2.in.afilias-nst.org.
in.                     5       IN      NS      a0.in.afilias-nst.info.
in.                     5       IN      NS      b1.in.afilias-nst.in.
in.                     5       IN      NS      b0.in.afilias-nst.org.
in.                     5       IN      NS      a1.in.afilias-nst.in.

;; ADDITIONAL SECTION:
a0.in.afilias-nst.info. 5       IN      A       199.7.87.1
a0.in.afilias-nst.info. 5       IN      AAAA    2001:500:29::1
a1.in.afilias-nst.in.   5       IN      A       115.249.164.142
a2.in.afilias-nst.info. 5       IN      A       199.249.117.1
a2.in.afilias-nst.info. 5       IN      AAAA    2001:500:45::1
b0.in.afilias-nst.org.  5       IN      A       199.253.56.1
b0.in.afilias-nst.org.  5       IN      AAAA    2001:500:50::1
b1.in.afilias-nst.in.   5       IN      A       180.179.215.70
b1.in.afilias-nst.in.   5       IN      AAAA    2401:8800:411:8::70
b2.in.afilias-nst.org.  5       IN      A       199.249.125.1
b2.in.afilias-nst.org.  5       IN      AAAA    2001:500:4d::1
c0.in.afilias-nst.info. 5       IN      A       199.253.57.1

Received 498 bytes from 192.168.134.2#53 in 498 ms

EXAMPLE-9:

Get TTL Information

$ host -v -t a google.com

output:
Trying "google.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37908
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;google.com.                    IN      A

;; ANSWER SECTION:
google.com.             5       IN      A       172.217.26.174

;; AUTHORITY SECTION:
google.com.             5       IN      NS      ns2.google.com.
google.com.             5       IN      NS      ns4.google.com.
google.com.             5       IN      NS      ns1.google.com.
google.com.             5       IN      NS      ns3.google.com.

;; ADDITIONAL SECTION:
ns1.google.com.         5       IN      A       216.239.32.10
ns2.google.com.         5       IN      A       216.239.34.10
ns3.google.com.         5       IN      A       216.239.36.10
ns4.google.com.         5       IN      A       216.239.38.10

Received 180 bytes from 192.168.134.2#53 in 54 ms


Advertisements