Sunday, April 17, 2011

getting hostname with IP

how to get hostname with IP without logging into the host

From stackoverflow
  • Making a portable wrapper is left as an exercise. :)

    Matthew Flaschen : In Java, there's InetAddress.getHostName(). Does that count? :)
  • i am not using it in code. just tell the method . the host is a unix host

  • If you're not using it in code (and you're not, according to an answer you posted, which should have really been an edit to your question :-), it's not a programming question.

    But the answer is to use nslookup.

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    
    C:\Documents and Settings\Administrator>nslookup www.company.com
    Server:  bhadns01.company.com
    Address:  9.190.234.35
    
    Non-authoritative answer:
    Name:    www-int.company.com.cs186.net
    Address:  129.42.58.216
    Aliases:  www.company.com
    
    C:\Documents and Settings\Administrator>nslookup 129.42.58.216
    Server:  bhadns01.company.com
    Address:  9.190.234.35
    
    Non-authoritative answer:
    Name:    www-int.company.com.cs186.net
    Address:  129.42.58.216
    Aliases:  www.company.com
    
    C:\Documents and Settings\Administrator>
    
    Zaagmans : or do it the other way around: nslookup 9.190.234.35
    paxdiablo : Thanks, @Z, I had to edit that bit in since I initially misunderstood the question.
  • nslookup

    It's on both Windows and Linux.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.