IP address to host name conversion | Unix Linux Forums | IP Networking

  Go Back    


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

IP address to host name conversion

IP Networking


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-30-2013
kavitha rao kavitha rao is offline
Registered User
 
Join Date: Oct 2011
Last Activity: 30 January 2013, 6:51 AM EST
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
Franklin52's Avatar
Franklin52 Franklin52 is offline Forum Staff  
Moderator
 
Join Date: Feb 2007
Last Activity: 28 November 2014, 6:46 AM EST
Location: The Netherlands
Posts: 7,720
Thanks: 123
Thanked 538 Times in 508 Posts
Something like this?

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

Sponsored Links
    #3  
Old 01-30-2013
kavitha rao kavitha rao is offline
Registered User
 
Join Date: Oct 2011
Last Activity: 30 January 2013, 6:51 AM EST
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
Scrutinizer Scrutinizer is offline Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 28 November 2014, 3:36 PM EST
Location: Amsterdam
Posts: 9,626
Thanks: 294
Thanked 2,459 Times in 2,205 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
Closed Thread

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 02:11 PM
get host name by IP address limmer Programming 6 12-18-2009 07:24 AM
host name to IP address cleopard Programming 7 04-11-2008 10:27 AM
Host ID vs MAC Address TheBlueSky Solaris 4 02-03-2007 10:10 AM
How to get the host ip address in HP-UX in ksh? nir_s Shell Programming and Scripting 12 08-07-2005 09:01 PM



All times are GMT -4. The time now is 06:44 PM.