Search code examples
arduinoesp8266bonjourzeroconfmdns

zeroconf on wireless connection without password


I want to setup a register / discover type of service connection between 2 devices on the same wireless LAN. Idea is to find, connect and send wireless router password to a new device for easy installation. This needs communication between 2 devices on the same wireless network before connecting to router with SSID, password.

I'm aware of zeroconf, bonjour and mDNS libraries. All implementations I see start with connecting to wifi in station mode to get a local IP with hardcoded SSID and password, which is not known at this stage.

In other words, how can connect to wireless and get a link local IP without SSID and password?

-- Edit for better explanation --

The flow i'm looking for is like this:

1- Mobile phone (iphone or android) is connected to secure home wireless network as usual
2- A new device with wireless interface is powered on first time.
3- Device gets (or sets) a local IP and local dns name (multicast ip and name) for itself
4- Device broadcasts its available services to the network
5- Phone discovers the service, along with devices' local name and even local ip already assigned.
6- Phone initiates a direct connection with the device to send wireless configuration information (ssid and password for the access point)
7 - Device saves this information, resets into normal operation mode
8 - Device connects to internet
9 - Device services are still available in the local network

-- edit --

Code will run on esp32 or esp8266, so compatible c or arduino libraries are ok.

I'm aware of smartconfig implementation of ESPTouch application, but it is a horrible design! Discovery program tries to create sockets to every possible IP address to find the peer IP.


Solution

  • Read this sentence in your question again and think about it:

    In other words, how can connect to wireless and get a link local IP without SSID and password?

    The protocols you mentioned are only possible AFTER you're part of the network. As you know, wifi networks are protected to prevent unauthorized access.

    Try wifi protected setup (WPS) in Google.