-   Linux - Newbie (
-   -   hostname of an ip (

r_s 09-09-2010 05:26 AM

hostname of an ip
Most of you gurus will be able to answer my question, is it possible to find the hostname against which an ip is registered over LAN.
ex. find hostname of ip 10.1.36.* on LAN.

ezfox 09-09-2010 05:32 AM

the command is "nslookup [ip]"

greetz, ezfox :)

sem007 09-09-2010 05:38 AM

# dig -x 10.1.36.X

# nslookup 10.1.36.X

repo 09-09-2010 05:57 AM

This will only work if you have your own DNS server in your LAN
Dig and nslookup will use the nameservers configured in /etc/resolv.conf
If you use the DNS from your provider, they will not find your local IP's, only public IP's

Kind regards

jschiwal 09-09-2010 06:04 AM

The is a private LAN address space. If you run your own DNS server, then dig and nslookup will work.
If you don't, but you maintain an /etc/hosts file, try "getent hosts <ip-address>". The getent hosts command will work for public IPs as well.
getent hosts

I'm not certain if using avahi-dns whether a reverse lookup will work. You can find the IP address of a hostname with "getent hosts hostname.local" or using ping "ping -c2 hostname.local".

jefro 09-09-2010 05:30 PM

Wonder if nslookup would return lines from a hosts file.

To be sure I'd look in the hosts file. I agree ping should work on most os's.

All times are GMT -5. The time now is 03:56 AM.