i need to find the host name of a UNIX host whose IP is known with out login to that UNIX host
相关问题
- Why should we check WIFEXITED after wait in order
- softlinks atime and mtime modification
- UNIX Bash - Removing double quotes from specific s
- Get unexpanded argument from bash command line
- Include and Execute EXE in C# Command Line App
相关文章
- Making new files automatically executable?
- How to resolve hostname to an ip address in node j
- Reverse four length of letters with sed in unix
- Compile and build with single command line Java (L
- Extracting columns from text file using Perl one-l
- Problem with piping commands in C
- How to update command line output?
- How to execute another python script from your scr
It depends on the context. I think you're referring to the operating system's hostname (returned by
hostname
when you're logged in). This command is for internal names only, so to query for a machine's name requires different naming systems. There are multiple systems which use names to identify hosts including DNS, DHCP, LDAP (DN's),hostname
, etc. and many systems use zeroconf to synchronize names between multiple naming systems. For this reason, results fromhostname
will sometimes match results fromdig
(see below) or other naming systems, but often times they will not match.DNS is by far the most common and is used both on the internet (like
google.com. A 216.58.218.142
) and at home (mDNS/LLMNR), so here's how to perform a reverse DNS lookup:dig -x <address>
(nslookup
andhost
are simpler, provide less detail, and may even return different results; however,dig
is not included in Windows).Note that hostnames within a CDN will not resolve to the canonical domain name (e.g. "google.com"), but rather the hostname of the host IP you queried (e.g. "dfw25s08-in-f142.1e100.net"; interesting tidbit: 1e100 is 1 googol).
Also note that DNS hosts can have more than one name. This is common for hosts with more than one webserver (virtual hosting), although this is becoming less common thanks to the proliferation of virtualization technologies. These hosts have multiple PTR DNS records.
Finally, note that DNS host records can be overridden by the local machine via /etc/hosts. If you're not getting the hostname you expect, be sure you check this file.
DHCP hostnames are queried differently depending on which DHCP server software is used, because (as far as I know) the protocol does not define a method for querying; however, most servers provide some way of doing this (usually with a privileged account).
Note DHCP names are usually synchronized with DNS server(s), so it's common to see the same hostnames in a DHCP client least table and in the DNS server's A (or AAAA for IPv6) records. Again, this is usually done as part of zeroconf.
Also note that just because a DHCP lease exists for a client, doesn't mean it's still being used.
NetBIOS for TCP/IP (NBT) was used for decades to perform name resolution, but has since been replaced by LLMNR for name resolution (part of zeroconf on Windows). This legacy system can still be queried with the
nbtstat
(Windows) ornmblookup
(Linux).For Windows, try:
or
For Linux, try:
They are almost same.
If you are specifically looking for a Windows machine, try below command:
You can do a reverse DNS lookup with
host
, too. Just give it the IP address as an argument:For Windows ping -a 10.10.10.10