Networking Forums  

Go Back   Networking Forums > Networking Newsgroups > Linux Networking

How to get hostname from IP address???

Reply
 
Thread Tools Display Modes
  #1  
Old 04-18-2007, 11:50 PM
Default How to get hostname from IP address???



Consider I have a host in my LAN called "foo", and it ip address is
172.16.0.1, how can I get the hostname (i.e. foo) from the ip
address???

nslookup 172.16.0.1 won't work.

TIA



Neroku
Reply With Quote
  #2  
Old 04-19-2007, 01:11 AM
Joe Pfeiffer
Guest
 
Posts: n/a
Default Re: How to get hostname from IP address???

Neroku <(E-Mail Removed)> writes:

> Consider I have a host in my LAN called "foo", and it ip address is
> 172.16.0.1, how can I get the hostname (i.e. foo) from the ip
> address???
>
> nslookup 172.16.0.1 won't work.


Then 172.16.0.1 isn't in the reverse DNS lookup tables. If it were,
nslookup would work. So, for instance, I can get:

snowball:603$ nslookup 192.168.0.13
Server: 192.168.0.2
Address: 192.168.0.2#53

13.0.168.192.in-addr.arpa name = zoya.wb.comcast.net.
Reply With Quote
  #3  
Old 04-19-2007, 01:43 AM
Llanzlan Klazmon the 15th
Guest
 
Posts: n/a
Default Re: How to get hostname from IP address???

Neroku <(E-Mail Removed)> wrote in news:1176936630.382899.161850
@d57g2000hsg.googlegroups.com:

> Consider I have a host in my LAN called "foo", and it ip address is
> 172.16.0.1, how can I get the hostname (i.e. foo) from the ip
> address???
>
> nslookup 172.16.0.1 won't work.


Maybe your DNS server is missing the PTR record.

Klazmon



>
> TIA
>


Reply With Quote
  #4  
Old 04-21-2007, 05:31 AM
Mark
Guest
 
Posts: n/a
Default Re: How to get hostname from IP address???

Neroku wrote:

> Consider I have a host in my LAN called "foo", and it ip address is
> 172.16.0.1, how can I get the hostname (i.e. foo) from the ip
> address???
>
> nslookup 172.16.0.1 won't work.
>
> TIA


Try

host 172.16.0.1

On my Centos 5 installation, that shows the
hostname as the last word on the line of output.

Mark
Reply With Quote
  #5  
Old 04-22-2007, 02:04 AM
Moe Trin
Guest
 
Posts: n/a
Default Re: How to get hostname from IP address???

On Sat, 21 Apr 2007, in the Usenet newsgroup comp.os.linux.networking, in
article <PsgWh.490$Fc1.21@trnddc05>, Mark wrote:

>Neroku wrote:


>> Consider I have a host in my LAN called "foo", and it ip address is
>> 172.16.0.1, how can I get the hostname (i.e. foo) from the ip
>> address???
>>
>> nslookup 172.16.0.1 won't work.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>Try
>
>host 172.16.0.1


[compton ~]$ whatis dig dnsquery host nslookup
dig (1) - send domain name query packets to name servers
dnsquery (1) - query domain name servers using resolver
host (1) - look up host names using domain server
nslookup (8) - query Internet name servers interactively
[compton ~]$

All four ask a name server for data. If nslookup won't work, neither will
any of the others. These tools don't look in the /etc/hosts files, or
try to use some microsoft name resolution service or the equally insecure
Apple mDNS (implemented as Avahi in Linux service). Trying any form of
network connection will cause the resolver to look through the available
name resolution services defined in /etc/nsswitch.conf, but if they don't
know the name either, you're just as bad off as you were to start with.

Old guy
Reply With Quote
Reply

Tags
address, hostname

Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump


All times are GMT. The time now is 08:56 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.