esp32s3 桥接和4g联网问题

cjs123456
Posts: 2
Joined: Sat Dec 06, 2025 3:09 am

esp32s3 桥接和4g联网问题

Postby cjs123456 » Sat Dec 06, 2025 3:22 am

使用esp32s3,wifi和网口桥接后,添加了一个4g模块,用于给wifi上网,dns给了桥接接口,nat使用的是桥接接口的ip,运营商已经给ppp分配ip了,dns addr是211.138.21.66,wifi无法上网

lichurbagan
Posts: 59
Joined: Thu Nov 13, 2025 3:20 pm

Re: esp32s3 桥接和4g联网问题

Postby lichurbagan » Mon Dec 08, 2025 5:53 pm

PPP 有自己的 DNS(运营商下发的),桥接接口设置独立 DNS 可能会导致冲突。

一般 PPP 报告得到的 DNS 更可靠,你可以用:

Code: Select all

esp_netif_get_dns_info(ppp_netif, ESP_NETIF_DNS_MAIN, &dns);
esp_netif_set_dns_info(wifi_netif, ESP_NETIF_DNS_MAIN, &dns);
不要手动写死 DNS,除非确认无效。

cjs123456
Posts: 2
Joined: Sat Dec 06, 2025 3:09 am

Re: esp32s3 桥接和4g联网问题

Postby cjs123456 » Thu Dec 11, 2025 9:31 am

我这里只有get_dns_info变量才会修改,下面是我的log
Executing action: monitor
Serial port COM7
Connecting....
Detecting chip type... ESP32-S3
Running idf_monitor in directory D:\esp32_code\2025-9-04-16-00esp32-S3-wifi\esp32-S3-wifi
Executing "D:\software\Espressif\python_env\idf5.4_py3.11_env\Scripts\python.exe D:/software/Espressif/frameworks/esp-idf-v5.4.1/tools/idf_monitor.py -p COM7 -b 115200 --toolchain-prefix xtensa-esp32s3-elf- --target esp32s3 --revision 0 D:\esp32_code\2025-9-04-16-00esp32-S3-wifi\esp32-S3-wifi\build\esp32-S3-wifi.elf --force-color -m 'D:\software\Espressif\python_env\idf5.4_py3.11_env\Scripts\python.exe' 'D:/software/Espressif/frameworks/esp-idf-v5.4.1/\tools\idf.py'"...
ESP-ROM:esp32s3-20210327

Build:Mar 27 2021

rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)

SPIWP:0xee

mode:DIO, clock div:1

load:0x3fce2820,len:0x170c

load:0x403c8700,len:0x4

load:0x403c8704,len:0xec4

load:0x403cb700,len:0x318c

entry 0x403c8950

I (27) boot: ESP-IDF v5.4.1-dirty 2nd stage bootloader

I (27) boot: compile time Dec 9 2025 14:58:15

I (27) boot: Multicore bootloader

I (28) boot: chip revision: v0.2

I (30) boot: efuse block revision: v1.3

I (34) qio_mode: Enabling default flash chip QIO

I (38) boot.esp32s3: Boot SPI Speed : 80MHz

I (42) boot.esp32s3: SPI Mode : QIO

I (46) boot.esp32s3: SPI Flash Size : 4MB

I (50) boot: Enabling RNG early entropy source...

I (54) boot: Partition Table:

I (57) boot: ## Label Usage Type ST Offset Length

I (63) boot: 0 nvs WiFi data 01 02 00009000 00004000

I (70) boot: 1 otadata OTA data 01 00 0000d000 00002000

I (76) boot: 2 phy_init RF data 01 01 0000f000 00001000

I (83) boot: 3 factory factory app 00 00 00010000 00100000

I (89) boot: 4 ota_0 OTA app 00 10 00110000 00100000

I (96) boot: 5 ota_1 OTA app 00 11 00210000 00100000

I (102) boot: End of partition table

I (106) boot: Defaulting to factory image

I (109) esp_image: segment 0: paddr=00010020 vaddr=3c0b0020 size=29948h (170312) map

I (142) esp_image: segment 1: paddr=00039970 vaddr=3fca2f00 size=04ec8h ( 20168) load

I (146) esp_image: segment 2: paddr=0003e840 vaddr=40378000 size=017d8h ( 6104) load

I (147) esp_image: segment 3: paddr=00040020 vaddr=42000020 size=adad4h (711380) map

I (259) esp_image: segment 4: paddr=000edafc vaddr=403797d8 size=19678h (104056) load

I (279) esp_image: segment 5: paddr=0010717c vaddr=600fe100 size=0001ch ( 28) load

I (289) boot: Loaded app from partition at offset 0x10000

I (290) boot: Disabling RNG early entropy source...

I (300) esp_psram: Found 2MB PSRAM device

I (300) esp_psram: Speed: 40MHz

I (300) cpu_start: Multicore app

I (719) esp_psram: SPI SRAM memory test OK

I (728) cpu_start: Pro cpu start user code

I (728) cpu_start: cpu freq: 240000000 Hz

I (728) app_init: Application information:

I (728) app_init: Project name: esp32-S3-wifi

I (732) app_init: App version: 1

I (735) app_init: Compile time: Dec 10 2025 16:52:15

I (741) app_init: ELF file SHA256: df5063c2e...

I (745) app_init: ESP-IDF: v5.4.1-dirty

I (749) efuse_init: Min chip rev: v0.0

I (753) efuse_init: Max chip rev: v0.99

I (757) efuse_init: Chip rev: v0.2

I (761) heap_init: Initializing. RAM available for dynamic allocation:

I (767) heap_init: At 3FCAD2C8 len 0003C448 (241 KiB): RAM

I (772) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM

I (777) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM

I (783) heap_init: At 600FE11C len 00001ECC (7 KiB): RTCRAM

I (788) esp_psram: Adding pool of 2048K of PSRAM memory to heap allocator

I (795) spi_flash: detected chip: generic

I (798) spi_flash: flash io: qio

I (801) sleep_gpio: Configure to isolate all GPIO pins in sleep state

I (807) sleep_gpio: Enable automatic switching of GPIO sleep configuration

I (814) main_task: Started on CPU0

I (838) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations

I (838) main_task: Calling app_main()

I (839) gpio: GPIO[9]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0

I (859) ------------: ETHIP:192.168.4.1


I (859) ------------: ETHIP:192.168.1.101


I (892) pp: pp rom version: e7ae62f

I (892) net80211: net80211 rom version: e7ae62f

I (894) wifi:wifi driver task: 3fcc1ec8, prio:23, stack:6656, core=0

I (899) wifi:wifi firmware version: 79fa3f41ba

I (900) wifi:wifi certification version: v7.0

I (903) wifi:config NVS flash: enabled

I (906) wifi:config nano formatting: disabled

I (910) wifi:Init data frame dynamic rx buffer num: 64

I (915) wifi:Init static rx mgmt buffer num: 5

I (919) wifi:Init management short buffer num: 32

I (924) wifi:Init dynamic tx buffer num: 64

I (928) wifi:Init static tx FG buffer num: 2

I (932) wifi:Init static rx buffer size: 1600

I (936) wifi:Init static rx buffer num: 16

I (940) wifi:Init dynamic rx buffer num: 64

I (944) wifi_init: rx ba win: 32

I (946) wifi_init: accept mbox: 6

I (949) wifi_init: tcpip mbox: 64

I (953) wifi_init: udp mbox: 64

I (955) wifi_init: tcp mbox: 64

I (958) wifi_init: tcp tx win: 65535

I (962) wifi_init: tcp rx win: 65535

I (965) wifi_init: tcp mss: 1440

I (968) wifi_init: WiFi IRAM OP enabled

I (971) wifi_init: WiFi RX IRAM OP enabled

I (976) phy_init: phy_version 700,8582a7fd,Feb 10 2025,20:13:11

I (1040) wifi:mode : sta (b8:f8:62:d8:dc:90)

I (1040) wifi:enable tsf

I (4841) wifi:flush txq

I (4841) wifi:stop sw txq

I (4841) wifi:lmac stop hw txq

I (4843) modem_board: iot_usbh_modem, version: 1.2.0

I (4843) modem_board: Force reset modem board....

I (4846) gpio: GPIO[0]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0

I (4855) modem_board: Resetting modem using io=0, level=0

I (5060) modem_board: Waiting for modem initialize ready

I (10060) USBH_CDC: iot usbh cdc version: 2.0.1

base_ret 1

I (10090) esp-modem: --------- Modem PreDefined Info ------------------

I (10090) esp-modem: Model: User Defined

I (10090) esp-modem: Modem itf 2

I (10093) esp-modem: ----------------------------------------------------

Found NOTIF endpoint: 136

Found IN endpoint: 129

Found OUT endpoint: 10

*** Device descriptor ***

bLength 18

bDescriptorType 1

bcdUSB 2.00

bDeviceClass 0xef

bDeviceSubClass 0x2

bDeviceProtocol 0x1

bMaxPacketSize0 64

idVendor 0x2ecc

idProduct 0x3012

bcdDevice 1.00

iManufacturer 1

iProduct 2

iSerialNumber 3

bNumConfigurations 1

*** Configuration descriptor ***

bLength 9

bDescriptorType 2

wTotalLength 196

bNumInterfaces 5

bConfigurationValue 1

iConfiguration 0

bmAttributes 0xc0

bMaxPower 500mA

*** Interface Association Descriptor ***

bLength 8

bDescriptorType 11

bFirstInterface 0

bInterfaceCount 2

bFunctionClass 0xe0

bFunctionSubClass 0x1

bFunctionProtocol 0x3

iFunction 5

*** Interface descriptor ***

bLength 9

bDescriptorType 4

bInterfaceNumber 0

bAlternateSetting 0

bNumEndpoints 1

bInterfaceClass 0xe0

bInterfaceSubClass 0x1

bInterfaceProtocol 0x3

iInterface 5

*** Endpoint descriptor ***

bLength 7

bDescriptorType 5

bEndpointAddress 0x87 EP 7 IN

bmAttributes 0x3 INT

wMaxPacketSize 64

bInterval 16

*** Interface descriptor ***

bLength 9

bDescriptorType 4

bInterfaceNumber 1

bAlternateSetting 0

bNumEndpoints 2

bInterfaceClass 0xa

bInterfaceSubClass 0x0

bInterfaceProtocol 0x0

iInterface 5

*** Endpoint descriptor ***

bLength 7

bDescriptorType 5

bEndpointAddress 0x83 EP 3 IN

bmAttributes 0x2 BULK

wMaxPacketSize 64

bInterval 0

*** Endpoint descriptor ***

bLength 7

bDescriptorType 5

bEndpointAddress 0xc EP 12 OUT

bmAttributes 0x2 BULK

wMaxPacketSize 64

bInterval 0

*** Interface descriptor ***

bLength 9

bDescriptorType 4

bInterfaceNumber 4

bAlternateSetting 0

bNumEndpoints 2

bInterfaceClass 0xff

bInterfaceSubClass 0x0

bInterfaceProtocol 0x0

iInterface 8

*** Endpoint descriptor ***

bLength 7

bDescriptorType 5

bEndpointAddress 0x82 EP 2 IN

bmAttributes 0x2 BULK

wMaxPacketSize 64

bInterval 0

*** Endpoint descriptor ***

bLength 7

bDescriptorType 5

bEndpointAddress 0xb EP 11 OUT

bmAttributes 0x2 BULK

wMaxPacketSize 64

bInterval 0

*** Interface descriptor ***

bLength 9

bDescriptorType 4

bInterfaceNumber 3

bAlternateSetting 0

bNumEndpoints 3

bInterfaceClass 0xff

bInterfaceSubClass 0x0

bInterfaceProtocol 0x0

iInterface 11

*** Endpoint descriptor ***

bLength 7

bDescriptorType 5

bEndpointAddress 0x89 EP 9 IN

bmAttributes 0x3 INT

wMaxPacketSize 64

bInterval 16

*** Endpoint descriptor ***

bLength 7

bDescriptorType 5

bEndpointAddress 0x86 EP 6 IN

bmAttributes 0x2 BULK

wMaxPacketSize 64

bInterval 0

*** Endpoint descriptor ***

bLength 7

bDescriptorType 5

bEndpointAddress 0xf EP 15 OUT

bmAttributes 0x2 BULK

wMaxPacketSize 64

bInterval 0

*** Interface descriptor ***

bLength 9

bDescriptorType 4

bInterfaceNumber 2

bAlternateSetting 0

bNumEndpoints 3

bInterfaceClass 0xff

bInterfaceSubClass 0x0

bInterfaceProtocol 0x0

iInterface 11

*** Endpoint descriptor ***

bLength 7

bDescriptorType 5

bEndpointAddress 0x88 EP 8 IN

bmAttributes 0x3 INT

wMaxPacketSize 64

bInterval 16

*** Endpoint descriptor ***

bLength 7

bDescriptorType 5

bEndpointAddress 0x81 EP 1 IN

bmAttributes 0x2 BULK

wMaxPacketSize 64

bInterval 0

*** Endpoint descriptor ***

bLength 7

bDescriptorType 5

bEndpointAddress 0xa EP 10 OUT

bmAttributes 0x2 BULK

wMaxPacketSize 64

bInterval 0

bit 0100

I (10778) modem_board: DTE reconnect, reconnecting ...



I (10783) USBH_CDC: Opened cdc device: 1

I (10786) USBH_CDC: New device connected, address: 1

I (11783) modem_board: reconnect after 5s...

I (12783) modem_board: reconnect after 4s...

I (13783) modem_board: reconnect after 3s...

I (14783) modem_board: reconnect after 2s...

I (15783) modem_board: reconnect after 1s...

I (15783) modem_board: Modem state STAGE_SYNC, Start

modem_stage 1

I (15803) modem_board: Network Auto reconnecting ...

I (15803) modem_board: Modem state STAGE_SYNC, Success!

bit 0200

I (15904) modem_board: Modem state STAGE_CHECK_SIM, Start

modem_stage 3

I (15910) modem_board: SIM Card Ready

I (15910) modem_board: Modem state STAGE_CHECK_SIM, Success!

bit 0200

I (16010) modem_board: Modem state STAGE_CHECK_SIGNAL, Start

modem_stage 4

I (16016) modem_board: Signal quality: rssi=21, ber=99

I (16016) modem_board: Modem state STAGE_CHECK_SIGNAL, Success!

bit 0200

I (16117) modem_board: Modem state STAGE_CHECK_REGIST, Start

modem_stage 5

I (16123) modem_board: Network registered, Operator: "CHINA MOBILE"

I (16123) modem_board: Modem state STAGE_CHECK_REGIST, Success!

bit 0200

I (16225) modem_board: Modem state STAGE_START_PPP, Start

modem_stage 6

I (16236) modem_board: Modem state STAGE_START_PPP, Success!

bit 0200

I (16336) modem_board: Modem state STAGE_WAIT_IP, Start

modem_stage 7

W (16336) modem_board: Modem event! 0

I (18088) esp-netif_lwip-ppp: Connected

I (18089) modem_board: IP event! 6

I (18089) modem_board: Modem Connected to PPP Server

I (18089) modem_board: ppp ip: 10.11.23.141, mask: 255.255.255.255, gw: 10.64.64.64

I (18096) modem_board: Main DNS: 211.138.21.66

I (18100) modem_board: Backup DNS: 211.138.23.66

I (18105) modem_board: Modem state STAGE_WAIT_IP, Success!

I (18105) esp-modem-netif: PPP state changed event 0: (NETIF_PPP_ERRORNONE)

I (18117) esp_eth.netif.netif_glue: dc:32:62:61:8a:e8

I (18121) esp_eth.netif.netif_glue: ethernet attached to netif

I (18128) esp_netif_lwip: DHCP server esp_netif->ip_info 192.168.1.101

I (18133) esp_netif_lwip: DHCP server esp_netif->ip_info 192.168.1.1

I (18140) esp_netif_br_glue: b8:f8:62:d8:dc:93

I (18143) esp_netif_br_glue: bridge netif glue attached

I (18149) esp_netif_lwip: DHCP server esp_netif->ip_info 192.168.4.1

I (18155) esp_netif_lwip: DHCP server esp_netif->ip_info 192.168.4.1

bridgeif does not need tcpip_input, use netif_input/ethernet_input instead

I (18163) wifi:mode : softAP (b8:f8:62:d8:dc:91)

I (18172) wifi:Total power save buffer number: 32

I (18176) wifi:Init max length of beacon: 752/752

I (18181) wifi:Init max length of beacon: 752/752

I (18185) wifi:Set ps type: 0, coexist: 0

I (18186) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.4.1



I (18198) RS485: Start RS485 application test and configure UART.

I (18203) uart: ESP_INTR_FLAG_IRAM flag not set while CONFIG_UART_ISR_IN_IRAM is enabled, flag updated

I (18213) esp_netif_lwip: DHCP server esp_netif->ip_info 192.168.4.1

I (18218) esp_netif_lwip: DHCP server esp_netif->ip_info 192.168.4.1

I (20164) esp_netif_lwip: DHCP server esp_netif->ip_info 192.168.1.101

I (20164) esp_netif_lwip: DHCP server esp_netif->ip_info 192.168.1.1

I (23889) wifi:new:<11,2>, old:<11,2>, ap:<11,2>, sta:<255,255>, prof:11, snd_ch_cfg:0x0

I (23889) wifi:station: 42:6c:98:88:2d:5f join, AID=1, bgn, 40D

net ap 17082560

net br 1694607552

net en 0

net pp 2367097610

net lo 16777343

I (23900) modem_wifi: NAT is enabled

I (24145) wifi:<ba-add>idx:2 (ifx:1, 42:6c:98:88:2d:5f), tid:7, ssn:0, winSize:64

I (24148) wifi:<ba-add>idx:3 (ifx:1, 42:6c:98:88:2d:5f), tid:0, ssn:2, winSize:64

I (24165) esp_netif_lwip: DHCP server assigned IP to a client, IP is: 192.168.1.103

I (24165) modem_board: IP event! 2

I (24170) IP_CONNECT: IP_CONNECT

I (24457) esp_netif_lwip: DHCP server assigned IP to a client, IP is: 192.168.1.102

I (24457) modem_board: IP event! 2

Who is online

Users browsing this forum: No registered users and 3 guests