1
  1. How do I provide a fixed Hostname to my device so that a netscan can shows up the device name across all platforms?
  2. How can I reach the device using the hostname/MAC-ID (something which is fixed) irrespective of the dynamically changing IP?

For example, I have 2 Raspberry-Pi and I give them hostname as Pi-1 and Pi-2 respectively (visible across all platforms). Now my router gives away dynamic IPs, so the IPs keep changing. Now how do I do a simple ping Pi-1 and get a reply? In short,how do I set up a DDNS (correct me if I am wrong) to map the Hostname/MAC-ID/URL against the updated IPs.

I have an application which connects to the corresponding devices (over TCP or MQTT) and does xyz stuffs. But I don't have the luxury to lookup the current IP of my device and update my application with the same everytime I move the setup to a different network. So I will just make a hostname entry in the application saying connect to "Pi-1" and it should be able connect to Pi-1 irrespective of the ip/network/domain as long as all the allocated IPs are reachable by on another.

N.B: I don't want to go for static IP or dhcp reserved IP and Open source packages (if required) are preferred.

0

You may be able to solve your problem by consulting the ARP table. If you do something to associate with all devices on the network first (like an nmap scan), you should then be able to query the ARP table for any device matching the known MAC address of your Raspberry Pi.

ie.

nmap 192.168.1.1/24
ip neigh show | grep AA:BB:CC:DD:EE:FF | cut -f1 -d" "

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.