0

How can I access my IoT peripheral device (raspberry pi B3+) on my local network in a reliable way? I want to use WiFi not BLE. I want to protect against the device getting a different IP when it is powered off and on again.

Is there a way to set a domain name for my device that only works locally? Otherwise, is setting a static IP the best option?

4
  • Any standard suggestions?
    – errolflynn
    Dec 27, 2021 at 3:34
  • google Named URLs on Local Network
    – jsotola
    Dec 27, 2021 at 3:36
  • The top response is this question. Anyways the reason for asking the question here is because I thought someone would be able to help provide some further insight. This is not very helpful.
    – errolflynn
    Dec 27, 2021 at 6:18
  • please do research first ... ask a question here when you get stuck ... describe the research that you have done
    – jsotola
    Dec 27, 2021 at 15:41

1 Answer 1

3

There are quite a few ways to achieve this.

First, many DHCP servers will hand out the same IP to the same device, even if it has been switched off for a while (and most certainly if the current DHCP lease has not expired).

You may want to make sure in the settings of your DHCP server (usually your router) that you have enough addresses in your pool, and possibly increase lease duration if it’s something you can change.

Of your current DHCP server does not cooperate, you may want to switch to another device (though it needs to be permanently on and connected to the network).

Of course, you could do static DHCP assignments if the DHCP server allows it.

Otherwise you can use static IP addresses (make sure you take those addresses out of the DHCP pool of course).

All this would help having the same IP.

Alternatively, you could use names which resolve to the dynamic IP. There are several methods to do that, depending on the combination of devices.

One option is to use mDNS / DNS-SD. You can advertise a name like rpi.local from the Pi and then use that name from other computers. You could use the dns-sd tool on the Pi to do so. Some distributions may actually already advertise the host name that way.

There are also alternatives based on uPnP/SSDP, Windows/SMB, and probably a few others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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