3 Simple Must Know Linux DNS Commands
Feb 24
The 3 simple must know Linux DNS commands that you can use whether you are in a Linux desktop or server are dig, host and nslookup. Below are just example of using dig, host and nslookup to query a forward lookup and a reverse lookup.
1. Forward lookup query using dig: -
[root@localhost ~]# dig www.google.com
; <<>> DiG 9.3.3rc2 <<>> www.google.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23989
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.google.com. IN A
;; ANSWER SECTION:
www.google.com. 6262 IN CNAME www.l.google.com.
www.l.google.com. 278 IN A 72.14.203.99
www.l.google.com. 278 IN A 72.14.203.104
www.l.google.com. 278 IN A 72.14.203.103
www.l.google.com. 278 IN A 72.14.203.147
;; Query time: 10 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Feb 24 17:41:20 2009
;; MSG SIZE rcvd: 116
2. Forward lookup query using host: -
[root@localhost ~]# host www.google.com
www.google.com is an alias for www.l.google.com.
www.l.google.com has address 72.14.203.103
www.l.google.com has address 72.14.203.104
www.l.google.com has address 72.14.203.99
www.l.google.com has address 72.14.203.147
3. Forward lookup query using nslookup: -
[root@localhost ~]# nslookup www.google.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
www.google.com canonical name = www.l.google.com.
Name: www.l.google.com
Address: 72.14.203.147
Name: www.l.google.com
Address: 72.14.203.103
Name: www.l.google.com
Address: 72.14.203.104
Name: www.l.google.com
Address: 72.14.203.99
4. Reverse lookup query using dig:-
[root@kulgpsxen03 ~]# dig -x 72.14.203.99
; <<>> DiG 9.3.3rc2 <<>> -x 72.14.203.99
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61506
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;99.203.14.72.in-addr.arpa. IN PTR
;; ANSWER SECTION:
99.203.14.72.in-addr.arpa. 86341 IN PTR tx-in-f99.google.com.
;; Query time: 8 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Feb 24 17:43:27 2009
;; MSG SIZE rcvd: 77
5. Reverse lookup query using host: -
[root@localhost ~]# host 72.14.203.99
99.203.14.72.in-addr.arpa domain name pointer tx-in-f99.google.com.
6. Reverse lookup query using nslookup:-
[root@localhost ~]# nslookup 72.14.203.99
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
99.203.14.72.in-addr.arpa name = tx-in-f99.google.com.
However, you can use intoDNS to test your DNS and it will give you a full detail of your domain.
Twitter
Facebook
Flickr
RSS
Recent Comments