Nslookup is another networking command available in linux which
helps in resolving the names.
Every machine that we connect on internet contains a ip address,
since these ip address are very complex to remember we assign names to those
like ( www.google.com).
When we are connecting to a web site using name, how can the
browser know the ip address to communicate?. The process of changing the name
to IP address is called name resolution.
Every system contains a special file called , hosts file which
contains information about the hostname and ip address . a excerpt of the hosts
file is
[xprk477@omhq13aa ~]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
170.192.2.255 vx111a.example.com vx111a
This shows that the hostname vx111a.example.com is translated to
170.192.2.255. The special entry with the IP address 127.0.0.1 is called a
loopback entry, which points back to the server itself via a special network
interface called lo.
But we cant get the name resolution done for all the ip address
in the world by adding them to the hosts file. There should be a mechanism for
performing these and this is done by a special server called name Server. The
name server is much like a phone book with all details of Ip address and host
names.
The host connects to a name server for a ip address, if that
finds it gets back of it can connect to another name server for the details.
There may be several name servers available in and out of your network.
How does the host know what these nameservers are? It looks into
a special file called /etc/resolv.conf to get that information. An Excerpt of
this file,
[xprk477@omhq13aa ~]$ cat /etc/resolv.conf
nameserver 179.162.200.205
nameserver 177.162.200.209
But how can we make sure that name resolutions are working fine
for a host.. The nslookup command is useful for that
[xprk477@omhq13aa ~]$ nslookup google.com
Server:
167.132.254.225
Address:
167.132.254.225#53
Non-authoritative answer:
Name: google.com
Address: 74.125.227.9
Name: google.com
Address: 74.125.227.14
Name: google.com
Address: 74.125.227.0
Name: google.com
Address: 74.125.227.1
Name: google.com
Address: 74.125.227.2
Name: google.com
Address: 74.125.227.3
Name: google.com
Address: 74.125.227.4
Name: google.com
Address: 74.125.227.5
Name: google.com
Address: 74.125.227.6
Name: google.com
Address: 74.125.227.7
Name: google.com
Address: 74.125.227.8
The ‘Server:
167.132.254.225’ is the Ip address associated to the google.com.
Happy Learning ,More To Come