Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
43
rated 0 times [  43] [ 0]  / answers: 1 / hits: 242171  / 2 Years ago, fri, may 13, 2022, 9:39:47

I want to get the hostname of a remote server using the IP address using my Ubuntu.



In Windows we can get using NBTSTAT but this doesn't work in Linux.



Does anyone know how to do that?


More From » 12.04

 Answers
3

NetBIOS



Windows (and Linux devices with Samba) use NetBIOS to 'publish' their addresses. This is what NBTSTAT uses to look up the IP address.



To find a hostname in your local network by IP address you can use:



nmblookup -A <ip>


Or you can install nbtscan by running:



sudo apt-get install nbtscan


And use:



nbtscan <ip>


Multicast DNS



If systems publish their address via Multicast DNS (OS X, Windows 10 and Linux devices with a running avahi-daemon do this), do a lookup using avahi-resolve (requires installing avahi-utils):



avahi-resolve -a <ip>


Reverse DNS



If the host has a public IP-address and a working reverse DNS entry, use the dig (requires installing dnsutils) or host (requires installing bind9-host) programs:



dig -x <ip>
host <ip>

[#34774] Saturday, May 14, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eatack

Total Points: 245
Total Questions: 120
Total Answers: 113

Location: Estonia
Member since Wed, Jun 8, 2022
2 Years ago
;