LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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
ezfox
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
sem007
Member
 
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
repo
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
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
The 10.0.0.0 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 8.8.8.8
8.8.8.8 google-public-dns-a.google.com


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
jefro
Moderator
 
Registered: Mar 2008
Posts: 17,101

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


Reply


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? (hostname.domain.com) 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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:13 AM.

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