linux poison RSS
linux poison Email

Get Hostname from IP address

To get the hostname from the IP address.
The simplest way is to use the “host” utility provided by Gnu/Linux. Just run…

poison:~ # host 64.233.187.99
99.187.233.64.in-addr.arpa domain name pointer jc-in-f99.google.com.
poison:~ #


This will query the name server and provide you with the hostname of the IP address.By default it will query the nameserver listed in the /etc/resolv.conf file.


5 comments:

unix find command said...

Many servers doesn't have host command installed on it but you have lot of other choice as well like nslookup, hostname -i etc. See How to find IP address from hostname in linux for more details.

Anonymous said...

also if you are already established connecttion bettwen computer it means you also have arp table required for communication, so just hit arp and you will get hostname for specified ip, also in this way you can see mac of remote host

Anonymous said...

I use two methods.
nslookup 173.194.41.135 | grep name | awk {'print $4'} | sed '$s/\.$//'
or
host 173.194.41.135 | awk {'print $5'} | sed '$s/\.$//'
to give me hostname only.

Anonymous said...

thanks..

Anonymous said...

nice sharing

Post a Comment

Related Posts with Thumbnails