Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

difference dig and nslookup

Status
Not open for further replies.

peac3

Technical User
Jan 17, 2009
226
AU
Hi guys,

I found this two commands have not much difference to find domain ip address and name, so just wondering what exactly the difference and when we are using it.

Code:
[master@au.com ~]$ nslookup localhost
Server:		192.168.1.254
Address:	192.168.1.254#53

Non-authoritative answer:
Name:	localhost
Address: 127.0.0.1

[master@au.com ~]$ dig localhost

; <<>> DiG 9.5.1-P2-RedHat-9.5.1-2.P2.fc10 <<>> localhost
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3616
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;localhost.			IN	A

;; ANSWER SECTION:
localhost.		0	IN	A	127.0.0.1

;; Query time: 17 msec
;; SERVER: 192.168.1.254#53(192.168.1.254)
;; WHEN: Thu May  7 19:41:49 2009
;; MSG SIZE  rcvd: 43

thanks guys
 
nslookup is the "old" way of querying dns, and dig is the "new" way. Dig has better output, better command line syntax. nslookup has an interactive mode that can be useful.
 
There is a third command too, host localhost, which has very simple output useful for scripting.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top