nslookup and dig - query Internet name servers interactively.
$ nslookup
>chirico.org
Server: 68.80.0.6
Address: 68.80.0.6#53
Name: chirico.org
Address: 66.35.250.210
>
The nslookup command will query the dns server is "/etc/resolve.conf"
However, you can force a certain dns with "- server". For example the
command below goes to the server named dilbert
$ nslookup - dilbert
>
dig:
dig gives you more information. You should probably use dig instead
of nslookup.
Below I am forcing the lookup from DNS 68.80.0.6 of the name chirico.org,
and
note that the query time is return too.
$ dig @68.80.0.6 +qr chirico.org
; <<>> DiG 9.2.1 <<>> @68.80.0.6 +qr chirico.org
;; global options: printcmd
;; Sending:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55908
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;chirico.org. IN A
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55908
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; QUESTION SECTION:
;chirico.org. IN A
;; ANSWER SECTION:
chirico.org. 5538 IN A 66.35.250.210
;; AUTHORITY SECTION:
chirico.org. 30599 IN NS ns78.worldnic.com.
chirico.org. 30599 IN NS ns77.worldnic.com.
;; ADDITIONAL SECTION:
ns78.worldnic.com. 16022 IN A 216.168.225.218
ns77.worldnic.com. 7 IN A 216.168.228.41
;; Query time: 155 msec
;; SERVER: 68.80.0.6#53(68.80.0.6)
;; WHEN: Thu Dec 23 07:48:23 2004
;; MSG SIZE rcvd: 127
So what if you wanted to know what name the IP address 66.35.250.210
resolves to, when using dns 68.80.0.12.
$ dig @68.80.0.12 -x 66.35.250.210
...
;; ANSWER SECTION:
210.250.35.66.in-addr.arpa. 3600 IN CNAME
210.0/24.250.35.66.in-addr.arpa.
210.0/24.250.35.66.in-addr.arpa. 3600 IN PTR vhost.sourceforge.net.
Above you can see it resolved to "vhost.sourceforge.net"
It's also possible to get all the zone information. The following command
queries my local dns 192.168.1.71 for the squeezel.com. zone information.
$ dig @192.168.1.71 squeezel.com. axfr
Reference ( http://www.tldp.org/HOWTO/DNS-HOWTO-5.html )