No Internet access when connecting to the AP

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
dedoz
Posts: 3
Joined: Mon Sep 02, 2019 11:43 am

No Internet access when connecting to the AP

Post by dedoz » Mon Sep 02, 2019 11:52 am

Hi,

New member here. Iam impressed about the Micropython and all the possibilities it opens for these small devices.

I have the Micropython running on the ESP8266. all seems to be working, STA and AP networks. STA find the router and connects to the home wifi. I have verified that the esp8266 has access to the internet.

devices can connect the AP network of the ESP8266 and can ping the esp ip address. However, the devices cannot access the internet when connected to the AP.

So, my question, is there a way, to route the communication coming to the AP to the STA?

Thanks

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: No Internet access when connecting to the AP

Post by Roberthh » Mon Sep 02, 2019 1:02 pm

When you connect the ESP8266 in STA mode to your router, the other devices in your LAN can connect the ESP8266 too, and the opposite, and all devices have access to the internet.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: No Internet access when connecting to the AP

Post by jimmo » Mon Sep 02, 2019 2:16 pm

I think your question is that you have an ESP8266 connected as a station to your home wifi network, but it's also simultaneously configured as an AP for another network.

You'd like a device connected to the ESP8266 AP to be able to access the internet via your home wifi.

In which case you want the ESP8266 to act as a layer 2 bridge or layer 3 router between its STA and AP interfaces. I do not know if this is possible in general for the ESP8266, but definitely not using the MicroPython firmware.

dedoz
Posts: 3
Joined: Mon Sep 02, 2019 11:43 am

Re: No Internet access when connecting to the AP

Post by dedoz » Mon Sep 02, 2019 11:44 pm

[quote=jimmo post_id=39060 time=1567433801 user_id=3071]
I think your question is that you have an ESP8266 connected as a station to your home wifi network, but it's also simultaneously configured as an AP for another network.

You'd like a device connected to the ESP8266 AP to be able to access the internet via your home wifi.

In which case you want the ESP8266 to act as a layer 2 bridge or layer 3 router between its STA and AP interfaces. I do not know if this is possible in general for the ESP8266, but definitely not using the MicroPython firmware.
[/quote]

That is correct, exactly what I meant:
[code]
ipad <---> AP |ESP8266| STA <---> Home router
[/code]

The ifconfig on the esp for both ifs is:
[code]
>>> sta_if.ifconfig()
('192.168.2.53', '255.255.255.0', '192.168.2.1', '192.168.2.1')
>>> ap_if.ifconfig()
('192.168.4.1', '255.255.255.0', '192.168.2.1', '192.168.2.1')
[/code]

If i remember correctly, that was done before using the esp as sniffer (proxy) to intercept the packets and analyse them using wireshark.

It is good to get confirmation that the MicroPython default firmware doesnt support that by default. Now is the question, does adding that functionality require changing the firmware or it can be done as a python script? Iam neither a wifi nor a micropython expert!

Thanks for the help

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: No Internet access when connecting to the AP

Post by jimmo » Tue Sep 03, 2019 1:53 am

This can't be done in Python as the sockets interface doesn't give you what you need.

The hardware does support this though -- here's a (non-MicroPython) example (layer 3 NAT). https://github.com/martin-ger/esp_wifi_repeater I'd recommend trying to work from that, much easier than trying to add all the extra networking support into MicroPython.

dedoz
Posts: 3
Joined: Mon Sep 02, 2019 11:43 am

Re: No Internet access when connecting to the AP

Post by dedoz » Tue Sep 03, 2019 12:10 pm

jimmo wrote:
Tue Sep 03, 2019 1:53 am
This can't be done in Python as the sockets interface doesn't give you what you need.

The hardware does support this though -- here's a (non-MicroPython) example (layer 3 NAT). https://github.com/martin-ger/esp_wifi_repeater I'd recommend trying to work from that, much easier than trying to add all the extra networking support into MicroPython.
I think that was the github project I was using before.

Anyways, thank you for the help. I thought this feature could be added easily to the MicroPython. Apparently not.

Post Reply