ESP32 as access point not routing traffic

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
q-flyche
Posts: 3
Joined: Tue Jan 08, 2019 10:05 am

ESP32 as access point not routing traffic

Post by q-flyche » Tue Jan 08, 2019 10:30 am

Hi There,
this is my first post. I tried search but I am either not looking in the right corner or I am the first one running in that "issue"!?
I've got an heltec board with an ESP32 on it. I flashed the latest micropython build on it and got a REPL prompt. Great.
I set up the ESP32 as access point using the following code:

Code: Select all

import network
ap = network.WLAN(network.AP_IF)
ap.active(True)
ap.config(essid='my-ssid', authmode=network.AUTH_WPA_WPA2_PSK, password='my-password')
ap.ifconfig(('192.168.84.1', '255.255.255.0', '192.168.84.1', '192.168.84.1')) # ip, netmask, gateway, dns
This is working fine. I can connect to the access point using my smart phone, computer whatever. Assume I have a Raspberry Pi added to the network running a simple webserver and my computer:

Code: Select all

esp32 (as access point) = 192.168.84.1 
raspberry = 192.168.84.2 
computer = 192.168.84.3
From my computer, I can ping the esp32. But I cannot ping the the Raspberry Pi. Neither can I make a HTTP GET request from computer -> Raspberry Pi. But I can make a HTTP GET request from esp32 -> Raspberry Pi.
I assume that the access point mode does not implement a routing? If not, is there a way to accomplish this?
Thanks

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: ESP32 as access point not routing traffic

Post by kevinkk525 » Tue Jan 08, 2019 12:22 pm

My guess would be that the AP is not intended to replace a router but is just a means of communicating with the device itself.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

q-flyche
Posts: 3
Joined: Tue Jan 08, 2019 10:05 am

Re: ESP32 as access point not routing traffic

Post by q-flyche » Tue Jan 08, 2019 3:11 pm

Hm probably...
My problem is on the board I am practically walking in the dark. Is there a way to query the DHCP server or any other prosibility to find out which clients are connected and get their IP addresses? using ap.status("station") just returns me the mac addesses.
Thanks

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: ESP32 as access point not routing traffic

Post by kevinkk525 » Wed Jan 09, 2019 6:39 am

I don't know. Maybe on loboris port it is possible, at least for the ftp module it is. Haven't done anything similar on the esp32 yet.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

q-flyche
Posts: 3
Joined: Tue Jan 08, 2019 10:05 am

Re: ESP32 as access point not routing traffic

Post by q-flyche » Thu Jan 10, 2019 6:15 pm

Ok, got it now running as expected.
I had the problem that there was another client connected I was not aware of which clashed the arp table of the access point I guess.

However, I still don't understand why I can't retrieve the client IPs just mac addresses. There are issues open concerning this for quiet a while now. It appears that loboris fork includes that feature. I will go try that fork.

I ran into the next issue - it seems when using sockets and the target is unreachable, the socket cannot be used anymore and a new instance has to be created. I opened an issue, but perhaps I am misunderstanding something.

jdcrunchman
Posts: 17
Joined: Wed Jun 19, 2019 8:17 pm

Re: ESP32 as access point not routing traffic

Post by jdcrunchman » Wed Jun 19, 2019 8:27 pm

Thank you very much for this post.... I've been so looking for how to make my esp32 be a hot spot.

John

Post Reply