You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Robert Alexa <ro...@gmail.com> on 2023/10/15 19:42:06 UTC
ESP32 SoftAP - Station bridging
Hi all,
I'm trying to connect my smartphone to the Internet through NuttX and ESP32
by creating a SoftAP - station bridge. Is this possible?
Currently, I'm building NuttX as esp32-devkitc:sta_softap, configuring
wlan0 as station and wlan1 as softAP using the commands from here[1][2]. I
have also enabled support for L2 forwarding and routing table from the make
menuconfig.
From my smartphone, I am able to connect to ESP32 but there is no internet
access. From the board, I can reach 8.8.8.8 by pinging after using the
following command: *addroute default 192.168.0.1 wlan0*.
I have also tried enabling NAT (CONFIG_NET_NAT) hoping that will solve the
issue but it still persists.
Does someone have any relevant input here? Am I missing any rules in the
routing table or any configurations?
Best regards,
Robert
[1]:
https://nuttx.apache.org/docs/latest/platforms/xtensa/esp32/index.html#wi-fi
[2]:
https://nuttx.apache.org/docs/latest/platforms/xtensa/esp32/index.html#wi-fi-softap
Re: ESP32 SoftAP - Station bridging
Posted by "Alan C. Assis" <ac...@gmail.com>.
Hi Robert,
I reproduced your issue here, but I don't know if it is some network
issue on NuttX or just because I don't know how to configure the
network route correctly. See my board config attached.
I tried many scenarios and it never worked:
nsh> ?
help usage: help [-v] [<cmd>]
. cd exec kill pwd true
[ cp exit ls reboot truncate
? cmp false mkdir rm uname
addroute dirname fdinfo mkrd rmdir umount
alias dd free mount route unset
unalias delroute help mv set uptime
arp df hexdump nslookup sleep usleep
basename dmesg ifconfig pidof source xd
break echo ifdown printf test
cat env ifup ps time
Builtin Apps:
dhcpd dhcpd_stop ping sh wapi
dhcpd_start nsh renew telnetd
nsh> ifconfig
wlan0 Link encap:Ethernet HWaddr bc:dd:c2:d4:a9:ec at RUNNING mtu 1504
inet addr:192.168.0.7 DRaddr:192.168.0.1 Mask:255.255.255.0
wlan1 Link encap:Ethernet HWaddr bc:dd:c2:d4:a9:ed at DOWN mtu 1504
inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0
nsh> ping 8.8.8.8
PING 8.8.8.8 56 bytes of data
56 bytes from 8.8.8.8: icmp_seq=0 time=50.0 ms
56 bytes from 8.8.8.8: icmp_seq=1 time=40.0 ms
56 bytes from 8.8.8.8: icmp_seq=2 time=40.0 ms
56 bytes from 8.8.8.8: icmp_seq=3 time=40.0 ms
56 bytes from 8.8.8.8: icmp_seq=4 time=40.0 ms
56 bytes from 8.8.8.8: icmp_seq=5 time=40.0 ms
56 bytes from 8.8.8.8: icmp_seq=6 time=40.0 ms
56 bytes from 8.8.8.8: icmp_seq=7 time=50.0 ms
56 bytes from 8.8.8.8: icmp_seq=8 time=40.0 ms
56 bytes from 8.8.8.8: icmp_seq=9 time=40.0 ms
10 packets transmitted, 10 received, 0% packet loss, time 10100 ms
rtt min/avg/max/mdev = 40.000/42.000/50.000/4.000 ms
nsh>
Create the SoftAP on wlan1:
nsh> dhcpd_start wlan1
nsh> wapi psk wlan1 mypasswd 3
nsh> wapi essid wlan1 nuttxap 1
nsh> route
SEQ TARGET NETMASK ROUTER
1. 0.0.0.0 0.0.0.0 10.0.0.1
nsh> delroute 0.0.0.0 0.0.0.0
nsh> route
nsh> addroute 0.0.0.0 0.0.0.0 192.168.0.1
nsh> route
SEQ TARGET NETMASK ROUTER
1. 0.0.0.0 0.0.0.0 192.168.0.1
Didn't work... lets try to add 10.0.0.0/24
nsh> addroute 10.0.0.0/24 192.168.0.1
nsh> route
SEQ TARGET NETMASK ROUTER
1. 0.0.0.0 0.0.0.0 192.168.0.1
2. 10.0.0.0 255.255.255.0 192.168.0.1
Didn't work!
Other tests:
nsh> addroute 0.0.0.0 0.0.0.0 192.168.0.1
nsh> route
SEQ TARGET NETMASK ROUTER
1. 0.0.0.0 0.0.0.0 192.168.0.1
nsh> delroute 0.0.0.0 0.0.0.0
nsh> addroute 0.0.0.0 0.0.0.0 192.168.0.7
nsh> route
SEQ TARGET NETMASK ROUTER
1. 0.0.0.0 0.0.0.0 192.168.0.7
nsh> addroute 10.0.0.0/24 192.168.0.1
nsh> route
SEQ TARGET NETMASK ROUTER
1. 0.0.0.0 0.0.0.0 192.168.0.7
2. 10.0.0.0 255.255.255.0 192.168.0.1
In all modes the computer connected to the SoftAP always was able to
ping 10.0.0.1, but never ping 192.168.0.1 or 8.8.8.8.
Maybe someone from here has more experience with it and can show how
to use NuttX with routing and ipforward working correctly.
BR,
Alan
On 10/15/23, Robert Alexa <ro...@gmail.com> wrote:
> Hi all,
>
> I'm trying to connect my smartphone to the Internet through NuttX and ESP32
> by creating a SoftAP - station bridge. Is this possible?
>
> Currently, I'm building NuttX as esp32-devkitc:sta_softap, configuring
> wlan0 as station and wlan1 as softAP using the commands from here[1][2]. I
> have also enabled support for L2 forwarding and routing table from the make
> menuconfig.
>
> From my smartphone, I am able to connect to ESP32 but there is no internet
> access. From the board, I can reach 8.8.8.8 by pinging after using the
> following command: *addroute default 192.168.0.1 wlan0*.
>
> I have also tried enabling NAT (CONFIG_NET_NAT) hoping that will solve the
> issue but it still persists.
>
> Does someone have any relevant input here? Am I missing any rules in the
> routing table or any configurations?
>
> Best regards,
> Robert
>
> [1]:
> https://nuttx.apache.org/docs/latest/platforms/xtensa/esp32/index.html#wi-fi
> [2]:
> https://nuttx.apache.org/docs/latest/platforms/xtensa/esp32/index.html#wi-fi-softap
>