Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-09-2010, 05:26 AM   #1
Registered: May 2009
Distribution: slackware, fedora, ubuntu
Posts: 101

Rep: Reputation: 21
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.
Old 09-09-2010, 05:32 AM   #2
LQ Newbie
Registered: Feb 2010
Posts: 2

Rep: Reputation: 0
the command is "nslookup [ip]"

greetz, ezfox
Old 09-09-2010, 05:38 AM   #3
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
# dig -x 10.1.36.X

# nslookup 10.1.36.X
Old 09-09-2010, 05:57 AM   #4
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
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
Old 09-09-2010, 06:04 AM   #5
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
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".
Old 09-09-2010, 05:30 PM   #6
Registered: Mar 2008
Posts: 18,565

Rep: Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
FC13 install can ping by hostname, ssh by hostname fails jeffk42 Linux - Networking 4 11-14-2011 12:27 PM
Could someone explain to me the process of adding a hostname? ( brynjarh Linux - Server 2 10-18-2009 08:58 PM
Changed hostname during install, now CUPS has wrong hostname on web interface slinx Linux - Software 1 08-07-2009 09:01 PM
after hostname change, syslogd still output previous hostname to messages file tiger2000 Linux - General 3 07-22-2009 10:36 PM
hostname command vs. $HOSTNAME env. variable Silly22 Linux - Networking 2 03-29-2002 06:01 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:26 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration