Friday, August 30, 2013

Linux Domain Name Lookup Command


For DNS concept,  see the wiki link


 # nslookup google.com
Server:         171.70.168.183
Address:        171.70.168.183#53

Non-authoritative answer:
Name:   google.com
Address: 74.125.239.131
Name:   google.com
Address: 74.125.239.132
Name:   google.com
Address: 74.125.239.135
Name:   google.com
Address: 74.125.239.142
Name:   google.com
Address: 74.125.239.136
Name:   google.com
Address: 74.125.239.129
Name:   google.com
Address: 74.125.239.130
Name:   google.com
Address: 74.125.239.134
Name:   google.com
Address: 74.125.239.128
Name:   google.com
Address: 74.125.239.137
Name:   google.com
Address: 74.125.239.133

See wiki for an high level view.


http://en.wikipedia.org/wiki/Nslookup


; <<>> DiG 9.2.4 <<>> google.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58279
;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 4, ADDITIONAL: 4

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

;; ANSWER SECTION:
google.com.             172     IN      A       74.125.239.142
google.com.             172     IN      A       74.125.239.137
google.com.             172     IN      A       74.125.239.133
google.com.             172     IN      A       74.125.239.132
google.com.             172     IN      A       74.125.239.130
google.com.             172     IN      A       74.125.239.129
google.com.             172     IN      A       74.125.239.135
google.com.             172     IN      A       74.125.239.131
google.com.             172     IN      A       74.125.239.134
google.com.             172     IN      A       74.125.239.128
google.com.             172     IN      A       74.125.239.136

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

;; ADDITIONAL SECTION:
ns1.google.com.         271309  IN      A       216.239.32.10
ns2.google.com.         239136  IN      A       216.239.34.10
ns3.google.com.         274650  IN      A       216.239.36.10
ns4.google.com.         273632  IN      A       216.239.38.10

;; Query time: 5 msec
;; SERVER: 171.70.168.183#53(171.70.168.183)
;; WHEN: Fri Aug 30 12:56:23 2013
;; MSG SIZE  rcvd: 340

 # /usr/bin/host www.google.com
www.google.com has address 74.125.28.147
www.google.com has address 74.125.28.104
www.google.com has address 74.125.28.106
www.google.com has address 74.125.28.103
www.google.com has address 74.125.28.105
www.google.com has address 74.125.28.99

Here is one good article about those 3 tools.
http://blog.smalleycreative.com/linux/nslookup-is-dead-long-live-dig-and-host/

What happened if meeting the following issues:

bash-3.2# nslookup google.com
;; connection timed out; no servers could be reached 
Check your configure file:
bash-3.2# cat /etc/resolv.conf 
It is empty, so that is why :))
To solve the problem, do following configuration:
bash-3.2# cat /etc/resolv.conf
search comcast.com
nameserver 1.2.3.4
nameserver 4.3.2.1


No comments:

Post a Comment