ESP32 DHCP 获取不到IP

liutao
Posts: 24
Joined: Fri Feb 25, 2022 3:11 am

Re: ESP32 DHCP 获取不到IP

Postby liutao » Sat Mar 05, 2022 3:48 am

ESP_YJM wrote:
Wed Mar 02, 2022 2:12 am
是的,用 omnipeek 抓。

Code: Select all

I (30) boot: ESP-IDF v4.3.2-dirty 2nd stage bootloader
I (30) boot: compile time 17:21:58
I (30) boot: chip revision: 3
I (32) boot.esp32c3: SPI Speed      : 80MHz
I (37) boot.esp32c3: SPI Mode       : DIO
I (42) boot.esp32c3: SPI Flash Size : 4MB
I (47) boot: Enabling RNG early entropy source...
I (52) boot: Partition Table:
I (56) 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 (78) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (85) boot:  3 ota_0            OTA app          00 10 00010000 00180000
I (93) boot:  4 ota_1            OTA app          00 11 00190000 00180000
I (100) boot:  5 settings         unknown          40 00 00310000 00001000
I (108) boot:  6 file             unknown          40 00 00311000 000ef000
I (115) boot: End of partition table
I (120) esp_image: segment 0: paddr=00010020 vaddr=3c0e0020 size=2c920h (182560) map
I (155) esp_image: segment 1: paddr=0003c948 vaddr=3fc8fe00 size=036d0h ( 14032) load
I (158) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=da408h (893960) map
I (295) esp_image: segment 3: paddr=0011a430 vaddr=3fc934d0 size=004f8h (  1272) load
I (296) esp_image: segment 4: paddr=0011a930 vaddr=40380000 size=0fc48h ( 64584) load
I (313) esp_image: segment 5: paddr=0012a580 vaddr=50000000 size=00010h (    16) load
I (318) boot: Loaded app from partition at offset 0x10000
I (318) boot: Disabling RNG early entropy source...
I (333) cpu_start: Pro cpu up.
I (345) cpu_start: Pro cpu start user code
I (345) cpu_start: cpu freq: 160000000
I (346) cpu_start: Application information:
I (348) cpu_start: Project name:     blufi_demo
I (353) cpu_start: App version:      1
I (358) cpu_start: Compile time:     Mar  3 2022 09:13:30
I (364) cpu_start: ELF file SHA256:  6f04524babec802f...
I (370) cpu_start: ESP-IDF:          v4.3.2-dirty
I (375) heap_init: Initializing. RAM available for dynamic allocation:
I (383) heap_init: At 3FC9B820 len 000247E0 (145 KiB): DRAM
I (389) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
I (396) heap_init: At 50000010 len 00001FF0 (7 KiB): RTCRAM
I (402) spi_flash: detected chip: mxic
I (406) spi_flash: flash io: dio
I (411) sleep: Configure to isolate all GPIO pins in sleep state
I (417) sleep: Enable automatic switching of GPIO sleep configuration
I (424) cpu_start: Starting scheduler.
I (433) coexist: coexist rom version 9387209
I (433) pp: pp rom version: 9387209
I (433) net80211: net80211 rom version: 9387209
I (453) wifi:wifi driver task: 3fca4630, prio:23, stack:6656, core=0
I (453) system_api: Base MAC address is not set
I (453) system_api: read default base MAC address from EFUSE
I (463) wifi:wifi firmware version: eb52264
I (463) wifi:wifi certification version: v7.0
I (463) wifi:config NVS flash: enabled
I (473) wifi:config nano formating: disabled
I (473) wifi:Init data frame dynamic rx buffer num: 32
I (483) wifi:Init management frame dynamic rx buffer num: 32
I (483) wifi:Init management short buffer num: 32
I (493) wifi:Init dynamic tx buffer num: 32
I (493) wifi:Init static tx FG buffer num: 2
I (493) wifi:Init static rx buffer size: 1600
I (503) wifi:Init static rx buffer num: 10
I (503) wifi:Init dynamic rx buffer num: 32
I (513) wifi_init: rx ba win: 6
I (513) wifi_init: tcpip mbox: 32
I (513) wifi_init: udp mbox: 6
I (523) wifi_init: tcp mbox: 6
I (523) wifi_init: tcp tx win: 5744
I (533) wifi_init: tcp rx win: 5744
I (533) wifi_init: tcp mss: 1440
I (533) wifi_init: WiFi IRAM OP enabled
I (543) wifi_init: WiFi RX IRAM OP enabled
I (543) phy_init: phy_version 905,7b93cd2,Oct 25 2021,15:05:11
I (593) wifi:set rx active PTI: 0, rx ack PTI: 12, and default PTI: 1
I (593) wifi:mode : sta (60:55:f9:72:fc:94)
I (593) wifi:enable tsf
I (593) BLUFI_EXAMPLE: WIFI_EVENT_STA_START

W (603) BTDM_INIT: esp_bt_controller_mem_release not implemented, return OK
I (603) wifi:new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:1
I (613) wifi:state: init -> auth (b0)
I (613) BTDM_INIT: BT controller compile version [3e61eea]
I (623) coexist: coexist rom version 9387209
I (633) BTDM_INIT: Bluetooth MAC: 60:55:f9:72:fc:95

I (633) wifi:state: auth -> assoc (0)
I (653) BLUFI_EXAMPLE: BD ADDR: 60:55:f9:72:fc:95

I (653) BLUFI_EXAMPLE: BLUFI init finish

W (653) BT_BTM: BTM_BleWriteAdvData, Partial data write into ADV
I (663) BLUFI_EXAMPLE: BLUFI VERSION 0102

I (663) Protocol: 0x3fcb35b8   fa 00 00 00 00 02 00 11  8c ff 05 00              |............|
I (673) : start tcp_client_task
I (673) WIFI: wait to get IP
I (673) : start tcp_client_recv_task
I (683) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (693) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (693) wifi:state: assoc -> run (10)
I (703) : start state_led_task
W (703) wifi:<ba-add>idx:0 (ifx:0, 58:41:20:09:d9:62), tid:5, ssn:0, winSize:64
I (713) : start get_RSSI_task
I (713) BLUFI_EXAMPLE: set rssi threshold
I (813) wifi:connected with TP-LINK_JSB_WZ, aid = 3, channel 1, 40U, bssid = 58:41:20:09:d9:62
I (813) wifi:security: WPA2-PSK, phy: bgn, rssi: -31
I (813) wifi:pm start, type: 1

I (813) wifi:set rx beacon pti, rx_bcn_pti: 14, bcn_timeout: 14, mt_pti: 25000, mt_time: 10000
I (823) BLUFI_EXAMPLE: WIFI_EVENT_STA_CONNECTED

I (883) wifi:BcnInt:102400, DTIM:1
I (883) BLUFI_EXAMPLE: rssi:-31
I (883) Protocol: 0x3fcbc5b4   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (883) BLUFI_EXAMPLE: mac:MAC6055f972fc94
I (1673) WIFI: wait to get IP
I (2673) WIFI: wait to get IP
I (3673) WIFI: wait to get IP
I (4673) WIFI: wait to get IP
I (5673) WIFI: wait to get IP
I (5723) BLUFI_EXAMPLE: set rssi threshold
I (6623) BLUFI_EXAMPLE: rssi:-31
I (6623) Protocol: 0x3fcbc5b4   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (6623) BLUFI_EXAMPLE: mac:MAC6055f972fc94
I (6673) WIFI: wait to get IP
I (7673) WIFI: wait to get IP
I (8673) WIFI: wait to get IP
I (9673) WIFI: wait to get IP
I (10673) WIFI: wait to get IP
I (10723) BLUFI_EXAMPLE: set rssi threshold
I (11123) BLUFI_EXAMPLE: rssi:-31
I (11123) Protocol: 0x3fcbc5b4   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (11123) BLUFI_EXAMPLE: mac:MAC6055f972fc94
I (11673) WIFI: wait to get IP
I (12673) WIFI: wait to get IP
I (13673) WIFI: wait to get IP
I (14673) WIFI: wait to get IP
I (15673) WIFI: wait to get IP
I (15723) BLUFI_EXAMPLE: set rssi threshold
I (16673) WIFI: wait to get IP
I (16753) BLUFI_EXAMPLE: rssi:-31
I (16753) Protocol: 0x3fcbc5b4   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (16753) BLUFI_EXAMPLE: mac:MAC6055f972fc94
I (17673) WIFI: wait to get IP
I (18673) WIFI: wait to get IP
omnipeek还不会用 看看有没有捕获到有用的东西
wireshark.txt
(66.92 KiB) Downloaded 784 times
omnipeek.txt
(1005.55 KiB) Downloaded 890 times

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Mon Mar 07, 2022 1:10 am

无线包是抓到了,你需要把路由器的 SSID 和 密码发我,我看能不能解密。或者你把路由器设置成 OPEN 的不加密,重新抓一下。另外,你 omnipeek 抓包时要抓和路由器一个信道的包。

liutao
Posts: 24
Joined: Fri Feb 25, 2022 3:11 am

Re: ESP32 DHCP 获取不到IP

Postby liutao » Mon Mar 07, 2022 1:37 am

ESP_YJM wrote:
Mon Mar 07, 2022 1:10 am
无线包是抓到了,你需要把路由器的 SSID 和 密码发我,我看能不能解密。或者你把路由器设置成 OPEN 的不加密,重新抓一下。另外,你 omnipeek 抓包时要抓和路由器一个信道的包。
ssid:TP-LINK_JSB_WZ
password:Wz123456@
应该都是信道1

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Mon Mar 07, 2022 3:02 am

解不出来,你要不把路由器改成 Open 不加密的吧。

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Mon Mar 07, 2022 3:06 am

然后你再抓个手机可以连上路由器的包。

liutao
Posts: 24
Joined: Fri Feb 25, 2022 3:11 am

Re: ESP32 DHCP 获取不到IP

Postby liutao » Mon Mar 07, 2022 8:20 am

ESP_YJM wrote:
Mon Mar 07, 2022 3:06 am
然后你再抓个手机可以连上路由器的包。
这个路由器开访客网络可以连接获取到IP
拿了一个老OPPO 只支持2.4G,第一次获取IP慢,后面每次都很快
观察omnipeek捕获的数据 esp32c3 有很多802.11 Null Data,OPPO 没有
oppo.pkt.txt
(25.62 KiB) Downloaded 650 times
esp32c3_MAC6055f972fc94.pkt.txt
(49.92 KiB) Downloaded 608 times

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Mon Mar 07, 2022 8:25 am

两个都没有抓到 DHCP 的包,抓的包啥也看不出来。你确认下是否路由器把 ESP32C3 给拉黑了,你改一下 ESP32C3 的 wifi station 接口的 mac 地址,看能否拿到 IP。

liutao
Posts: 24
Joined: Fri Feb 25, 2022 3:11 am

Re: ESP32 DHCP 获取不到IP

Postby liutao » Mon Mar 07, 2022 11:03 am

ESP_YJM wrote:
Mon Mar 07, 2022 8:25 am
两个都没有抓到 DHCP 的包,抓的包啥也看不出来。你确认下是否路由器把 ESP32C3 给拉黑了,你改一下 ESP32C3 的 wifi station 接口的 mac 地址,看能否拿到 IP。
没有拉黑,换了多个模块,mac都是不一样的,都很难拿到IP,有些时候能拿到IP。
去掉密码了,可以看到DHCP,手机获取慢点,但是能获取到。
Attachments
redmi.pkt.txt
筛选条件94:17:00:88:6B:BE
(125.36 KiB) Downloaded 582 times
esp32c3_MAC6055f972fc94.pkt.txt
筛选条件60:55:F9:72:FC:94
(39.14 KiB) Downloaded 577 times

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Mon Mar 07, 2022 11:33 am

抓包看路由器没有回dhcp offer,可能的原因有如下几个,你可以逐一进行排查:
1. 路由器回了 dhcp offer 包,但是由于 dhcp offer 是单播包,wifi 速率比较快,你的抓包网卡没抓到,ESP32C3 也不支持该速率,所以 dhcp 失败,排查的方向可以是把 路由器设置成 b/g 模式,不启用 n 模式。
2. ESP32C3 发送的 dhcp discovery 包缺少 dhcp option 60。更新 IDF SDK 到 tag v4.4 版本, idf.py menuconfig->component config->lwip->LWIP_DHCP_DISABLE_VENDOR_CLASS_ID 设置为 n。

liutao
Posts: 24
Joined: Fri Feb 25, 2022 3:11 am

Re: ESP32 DHCP 获取不到IP

Postby liutao » Mon Mar 07, 2022 12:23 pm

ESP_YJM wrote:
Mon Mar 07, 2022 11:33 am
抓包看路由器没有回dhcp offer,可能的原因有如下几个,你可以逐一进行排查:
1. 路由器回了 dhcp offer 包,但是由于 dhcp offer 是单播包,wifi 速率比较快,你的抓包网卡没抓到,ESP32C3 也不支持该速率,所以 dhcp 失败,排查的方向可以是把 路由器设置成 b/g 模式,不启用 n 模式。
2. ESP32C3 发送的 dhcp discovery 包缺少 dhcp option 60。更新 IDF SDK 到 tag v4.4 版本, idf.py menuconfig->component config->lwip->LWIP_DHCP_DISABLE_VENDOR_CLASS_ID 设置为 n。
我试了把路由器设置成 b/g 模式没效果。
手机2.4g也开始获取不到IP了
应该还是路由器的问题 TL-XDR3230易展版 软件版本:1.0.22
重启了路由器几个esp32c3就都能获取到IP,不知道过段时间会不会又出现这情况,明天试试联系路由器厂家。

Who is online

Users browsing this forum: No registered users and 80 guests