I have a device in a public network (I'm not the owner/admin of the WiFi) and I want to know if there is a way to get the devices IP address by knowing its hostname from a second device in the same network?
Asked
Active
Viewed 1,039 times
-1
-
1Use the command `host hostname`. – bcs78 Sep 02 '18 at 19:04
2 Answers
3
If the network has a DNS service, query that for the hostname using a tool like host
or dig
. This will depend on the device being registered, either statically, by a DHCP service, or by dynamic registration on the device itself.
Many public networks do not do this for avoidance of cost & needless complexity and/or privacy preservation reasons. In that case, consult the network operator, who can infer this data from logs on relevant hardware devices (DHCP server, gateway, etc.).

Cosmic Ossifrage
- 1,640
- 14
- 23
1
The multicast DNS protocol is designed to do exactly that. You simply append .local
after the hostname of the device and you have a name that you can use with all the usual commands. For example:
ssh hostname.local

kasperd
- 30,455
- 17
- 76
- 124