Monday, September 28, 2009

Domain name resolutions using 'host' command in Linux

host - DNS lookup utility

host is a simple utility for performing DNS lookups. It is normally used to convert names to IP addresses and vice versa.

1. In this example we are asking host to give us the IP of www.askarali.org

host www.askarali.org
www.askarali.org has address 202.125.140.141

2. For more detailed output use -v or -d switch

host -v askarali.org
Trying "askarali.org"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58441 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2 ;; QUESTION SECTION: ;askarali.org. IN A ;; ANSWER SECTION: askarali.org. 600 IN A 202.125.140.141 ;; AUTHORITY SECTION: askarali.org. 600 IN NS dns00.beaconet.net. askarali.org. 600 IN NS dns01.beaconet.net. ;; ADDITIONAL SECTION: dns00.beaconet.net. 85792 IN A 202.125.140.139 dns01.beaconet.net. 85792 IN A 202.125.140.138 Received 130 bytes from 203.99.163.189#53 in 174 ms Trying "askarali.org" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5014 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;askarali.org. IN AAAA ;; AUTHORITY SECTION: askarali.org. 600 IN SOA dns00.beaconet.net. postmaster.askarali.org. 200803202 28800 7200 2419200 86400 Received 95 bytes from 203.99.163.189#53 in 19 ms Trying "askarali.org" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9732
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3

;; QUESTION SECTION:
;askarali.org. IN MX

;; ANSWER SECTION:
askarali.org. 600 IN MX 10 smtp.askarali.org.

;; AUTHORITY SECTION:
askarali.org. 600 IN NS dns00.beaconet.net.
askarali.org. 600 IN NS dns01.beaconet.net.

;; ADDITIONAL SECTION:
smtp.askarali.org. 600 IN A 203.148.64.29
dns00.beaconet.net. 85792 IN A 202.125.140.139
dns01.beaconet.net. 85792 IN A 202.125.140.138

Received 151 bytes from 203.99.163.189#53 in 12 ms

3. For particular type of DNS record for example NS, MX, SOA, CNAME use the -t option. In the following example will search for name server (NS), mail exchanger (MX) and Start of Authority (SOA) for askarali.org

host -t NS askarali.org
askarali.org name server dns00.beaconet.net.
askarali.org name server dns01.beaconet.net.

host -t MX askarali.org
askarali.org mail is handled by 10 smtp.askarali.org.

host -t SOA askarali.org
askarali.org has SOA record dns00.beaconet.net. postmaster.askarali.org. 200803202 28800 7200 2419200 86400

For more information on host read the RTFM (man host)

No comments:

Post a Comment