SoftAp with Domain Name

Franck
Posts: 3
Joined: Fri May 25, 2018 3:44 am

SoftAp with Domain Name

Postby Franck » Fri May 25, 2018 4:12 am

Hello,
Is there an ESP-IDF example for a webserver with a domain name in SoftAP mode?
The examples I found use the IP address to access the webserver.
Couldn't find any using a domain name as www.xxx.com.

I suppose I need a DNS server running on the SoftAP to do a redirect to the ESP32 IP address. But I haven't found the way to do it.

I am porting an existing system to ESP32, and the domain name is fixed (www.sensor.com) so I don't think I can use mDNS as it would need to be changed to xxx.local.

Any link to examples or directions on how to do this would be welcome.

Thanks,
Franck.

User avatar
kolban
Posts: 1534
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: SoftAp with Domain Name

Postby kolban » Fri May 25, 2018 4:06 pm

Howdy Franck,
My loose understanding is that the domain name system is like a database which maps symbolic names (www.xxx.com) to their IP addresses. The registration of which name maps to which IP address is not performed by the device that has that IP address but is rather done by the network / DNS administrator.

If your target machine has a dynamic IP address (i.e. dynamically allocated) then DNS isn't an option because DNS maps names to static IP addresses (this is a loose statement ... in enterprises there may be special hardware and software that performs load balancing that sprays work for the same name/IP address to multiple back-end systems).

Where we have dynamic IPs, mDNS is then a candidate but that is usually very local.

Is your goal to have your ESP32 addressible over the "Internet" or have it resolved locally (for example just in your house or office)?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Available for ESP32 consulting.

WiFive
Posts: 1763
Joined: Tue Dec 01, 2015 7:35 am

Re: SoftAp with Domain Name

Postby WiFive » Sat May 26, 2018 2:06 am

He is talking about captive portal.

https://github.com/search?q=esp32+dns

Franck
Posts: 3
Joined: Fri May 25, 2018 3:44 am

Re: SoftAp with Domain Name

Postby Franck » Mon May 28, 2018 3:38 am

Howdy Kolban,
The idea here is to have a webserver and a DNS server implemented on the same ESP32 SoftAP.
I think it works this way:
1- Client connects to the ESP32 SoftAP
2- Client web browser sends a DNS resolution request for www.xxx.com to the ESP32 (UDP port 53)
3- ESP32 resolve DNS request and returns its own IP address
4- Client web browser uses the received IP to get the ESP32 webserver page.

But I guess you already know this since my DNS understanding comes from your book ;)!

Hi WiFive,
That's exactly what I am looking for.
I spent 2 days trying to find examples, I was only getting Arduino results...
I guess I am not using the right keyword.
Thanks!

Who is online

Users browsing this forum: No registered users and 4 guests