Go Back   The UNIX and Linux Forums > Special Forums > IP Networking


IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum.

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-30-2013
Registered User
 
Join Date: Oct 2011
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Lightbulb IP address to host name conversion

hi,

i want to get the hostname for the specified IP address.


Code:
# host www.google.com
www.google.com has address 173.194.69.104
www.google.com has address 173.194.69.105
www.google.com has address 173.194.69.106
www.google.com has address 173.194.69.147
www.google.com has address 173.194.69.99
www.google.com has address 173.194.69.103

# host 173.194.69.99
99.69.194.173.in-addr.arpa domain name pointer bk-in-f99.1e100.net.

Is there any way to get host name as "www.google.com" for the given IP address (173.194.69.99)?

"gethostbyaddr" function also returns same host name(bk-in-f99.1e100.net.) as above but i want "www.google.com" as the host name.


thanks in advance

Regards,
kavitha
Sponsored Links
    #2  
Old 01-30-2013
Moderator
 
Join Date: Feb 2007
Location: The Netherlands
Posts: 7,500
Thanks: 73
Thanked 473 Times in 452 Posts
Something like this?

Code:
awk '$NF=="173.194.69.99"{print $1}' host_file

Sponsored Links
    #3  
Old 01-30-2013
Registered User
 
Join Date: Oct 2011
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
No, actually "173.194.69.99" belongs to google then ,why are we not getting www.google.com as host name other than internal name "bk-in-f99.1e100.net."
is there any function to get actual host names?
    #4  
Old 01-30-2013
Scrutinizer's Avatar
Moderator
 
Join Date: Nov 2008
Location: Amsterdam
Posts: 7,338
Thanks: 143
Thanked 1,754 Times in 1,591 Posts
I don't think there is a way. It is up to google what PTR records they provide for reverse lookups. You could use whois to try and find the IP-address owner..
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
IP address to decimal format conversion vaibhavkorde Shell Programming and Scripting 2 03-15-2011 01:11 PM
get host name by IP address limmer Programming 6 12-18-2009 06:24 AM
host name to IP address cleopard Programming 7 04-11-2008 09:27 AM
Host ID vs MAC Address TheBlueSky Solaris 4 02-03-2007 09:10 AM
How to get the host ip address in HP-UX in ksh? nir_s Shell Programming and Scripting 12 08-07-2005 08:01 PM



All times are GMT -4. The time now is 04:28 PM.