Tuesday, February 17, 2009

DNS lookup

To find an ip address for a domain, we need to do dns lookup. A few tools available for us to use in linux, but in this article I will give brief explanation about 3 most famous tools of dns lookup, which are host, nslookup and dig. Usually if the commands are used without the optional nameserver, then the nameserver entries in /etc/resolv.conf will be used


To find ip address of a domain using host (nameserver is optional):

$ host
example:
$ host www.google.com 208.67.222.222

To find the domain that belongs to an ip address using host (nameserver is optional):

$ host
example:
$ host 202.188.0.133 ns1.tm.net.my


To find ip address of a domain using nslookup (nameserver is optional):

$ nslookup
example:
$ nslookup www.google.com 208.67.222.222

To find the domain that belongs to an ip address using nslookup (nameserver is optional):

$ nslookup
example:
$ nslookup 202.188.0.133 208.67.222.222

nslookup also have interactive mode that you can access by simply typing
$ nslookup


To find ip address of a domain using dig (nameserver is optional):

$ dig @
example:
$ dig @ns1.tm.net.my www.google.com

1 comment:

anu said...

This article extends to provide that DNS ip address lookup which host etc through linux which is very helpful. I normally use the ip details for windows.