I am building a application to use raspberry as MQTT broker & client and receive the message from ESP32 which is another MQTT client. I need to have ESP32 to get the broker connected without pre-setting IP address manually. Does anyone know how to let raspberry share the IP address wirelessly and safely? Or could the raspberry pi get a static IP address no matter what network configuration user changed? Thank you for any help or discuss.
Asked
Active
Viewed 1,612 times
-1
-
2Given the tags you have already added (mdns/avahi) you already have your answer – hardillb Jan 08 '20 at 10:37
-
beside the static configuration, you can also have the router or what is in front of the ESPs to allocate the same IP for their MACs if you want to use DHCP – idan Jan 08 '20 at 16:45
-
I tried static ip address, it will not work when wifi changed by user. The design requires like an end to end mode, from a raspberry which act as broker and client, and a ESP32/raspberry act as a client. the client device and broker device both will be configured their WiFi by end customers on UI and ip addresses will be unknown then~~ My alrernative way is to let ESP32 get ip address via Bluetooth from user app and then connect to broker. But we still expect more direct way. – user10417959 Jan 08 '20 at 16:56
-
The answer is mdns – hardillb Jan 08 '20 at 19:02
-
I tagged it because I saw some traces about it. https://groups.google.com/forum/#!topic/mqtt/QL6Qrqx-Y24 But I didn't find clear instructions or examples to apply it on ESP32 or Rapsberry Pi. – user10417959 Jan 08 '20 at 20:44
1 Answers
0
These two instructions gave some help: to build mDNS lookups in raspberry and mDNS client to receive string input. More logic needed to define the principle of "blind search" but considering the security reason, we preferred to transfer string host name by BLE from app side.
mDNS client in ESP32 to receive string input How is the ESP32 (DOIT DevKit) finding another host in the same LAN via mDNS?
to build mDNS lookups in raspberry:
http://root42.blogspot.com/2015/02/how-to-setup-mdns-lookups-on-raspberry.html

user10417959
- 3
- 3