Get Hostname from IP Address
linux, network-programming, python
Solution
You've already got the Python code required
socket.gethostbyaddr(ip)
What you need is on the infrastructure side of things. To get an internal hostname, you need to query the internal DNS server for the network in question. Larger networks almost always have internal DNS services but some smaller network don't since they rely on other means (direct IP, NETBIOS, Bonjour, etc.) to find various resources.
TL:DR : You need to query the internal DNS services for the network in question
Problem
My problem is to match IP address to its hostname. If the IP address is a public IP then a simple `socket.gethostbyaddr(ip)` solves it but my problem is with private IP i.e. IP of a network. How can I get host names from a network IP address? Is there a way to find out hostname or not? I'm trying to do this on Linux.