Hi Robert & Alan,

Although I don't have an ESP32 board yet, you may need NAT applied on wlan0, I 
guess.

Under Alan's configuration, there are two subnets: the 192.168.0.0/24 and 
10.0.0.0/24. With only routing and ipforward, the ping from 10.0.0.x (take 
10.0.0.2 as an example) normally can reach the router (192.168.0.1), but the 
router doesn't know where 10.0.0.2 is, and it may just reply via its default 
route (packet may be sent to the internet, or dropped by the router's firewall).

 The router's default route (normally the Internet)
    ↑ reply: 192.168.0.1 -> 10.0.0.2
 ----------
 | Router |
 ----------
    ↑ ping: 10.0.0.2 -> 192.168.0.1
 ----------
 | ESP32  | <- Just forward
 ----------
    ↑ ping: 10.0.0.2 -> 192.168.0.1
 ----------
 | Device |
 ----------

You may try NAT with CONFIG_NET_NAT and CONFIG_SYSTEM_IPTABLES enabled, using 
the command 'iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE' to apply 
NAT to all outbound traffic on wlan0, then you may get:

 ----------
 | Router |
 ----------
    ↑ ping:  192.168.0.7 -> 192.168.0.1
    ↓ reply: 192.168.0.1 -> 192.168.0.7
 ----------
 | ESP32  | <- Doing NAT, mapping 10.0.0.2 to 192.168.0.7
 ----------
    ↑ ping:  10.0.0.2 -> 192.168.0.1
    ↓ reply: 192.168.0.1 -> 10.0.0.2
 ----------
 | Device |
 ----------

Hope this may help.

BTW, It's my first time replying to this mailing list, I'm not sure if I'm 
doing it correctly.

Best regards,
Zhe Weng
#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
 This e-mail and its attachments contain confidential information from XIAOMI, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!******/#

Reply via email to