how to find host name from IP with out login to the host

前端 未结 11 2163
花落未央
花落未央 2021-01-29 21:06

i need to find the host name of a UNIX host whose IP is known with out login to that UNIX host

相关标签:
11条回答
  • 2021-01-29 21:32

    You can use traceroute command as well.

    http://linux.die.net/man/8/traceroute

    just use the traceroute it will show you the routing path with host names (IPs resolved)

    0 讨论(0)
  • 2021-01-29 21:34

    For Windows ping -a 10.10.10.10

    0 讨论(0)
  • 2021-01-29 21:35

    You can do a reverse DNS lookup with host, too. Just give it the IP address as an argument:

    $ host 192.168.0.10
    server10 has address 192.168.0.10
    
    0 讨论(0)
  • 2021-01-29 21:35

    Another NS lookup utility that can be used for reversed lookup is dig with the -x option:

    $ dig -x 72.51.34.34
    
    ; <<>> DiG 9.9.2-P1 <<>> -x 72.51.34.34
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12770
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
    
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 1460
    ;; QUESTION SECTION:
    ;34.34.51.72.in-addr.arpa.      IN      PTR
    
    ;; ANSWER SECTION:
    34.34.51.72.in-addr.arpa. 42652 IN      PTR     sb.lwn.net.
    
    ;; Query time: 4 msec
    ;; SERVER: 192.168.178.1#53(192.168.178.1)
    ;; WHEN: Fri Jan 25 21:23:40 2013
    ;; MSG SIZE  rcvd: 77
    

    or

    $ dig -x 127.0.0.1
    
    ; <<>> DiG 9.9.2-P1 <<>> -x 127.0.0.1
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11689
    ;; flags: qr aa ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;1.0.0.127.in-addr.arpa.                IN      PTR
    
    ;; ANSWER SECTION:
    1.0.0.127.in-addr.arpa. 10      IN      PTR     localhost.
    
    ;; Query time: 2 msec
    ;; SERVER: 192.168.178.1#53(192.168.178.1)
    ;; WHEN: Fri Jan 25 21:23:49 2013
    ;; MSG SIZE  rcvd: 63
    

    Quoting from the dig manpage:

    Reverse lookups -- mapping addresses to names -- are simplified by the -x option. addr is an IPv4 address in dotted-decimal notation, or a colon-delimited IPv6 address. When this option is used, there is no need to provide the name, class and type arguments. dig automatically performs a lookup for a name like 11.12.13.10.in-addr.arpa and sets the query type and class to PTR and IN respectively.

    0 讨论(0)
  • 2021-01-29 21:41

    The other answers here are correct - use reverse DNS lookups. If you want to do it via a scripting language (Python, Perl) you could use the gethostbyaddr API.

    0 讨论(0)
提交回复
热议问题