ESP32 DHCP 获取不到IP

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

Re: ESP32 DHCP 获取不到IP

Postby liutao » Tue Mar 01, 2022 6:40 am

ESP_YJM wrote:
Tue Mar 01, 2022 6:16 am
使用 IDF wifi station 示例(examples/wifi/getting_started/station)也拿不到 IP?是只有这个路由器拿不到 IP 还是都拿不到 IP?换个模组能否拿到 IP?
之前连这个路由器都能正常获取ip的,从上周起开始出问题了,估计重启路由器能正常,但是不想破坏环境想搞清楚。

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

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Tue Mar 01, 2022 8:11 am

你抓取 wifi 包,把模组重启,然后把 log 和抓包发过来。

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

Re: ESP32 DHCP 获取不到IP

Postby liutao » Tue Mar 01, 2022 8:18 am

ESP_YJM wrote:
Tue Mar 01, 2022 8:11 am
你抓取 wifi 包,把模组重启,然后把 log 和抓包发过来。

Code: Select all

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x189c
load:0x403ce000,len:0x8d4
load:0x403d0000,len:0x2dc0
entry 0x403ce000
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=2e978h (190840) map
I (157) esp_image: segment 1: paddr=0003e9a0 vaddr=3fc8fa00 size=01678h (  5752) load
I (158) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=d9120h (889120) map
I (296) esp_image: segment 3: paddr=00119148 vaddr=3fc91078 size=02508h (  9480) load
I (298) esp_image: segment 4: paddr=0011b658 vaddr=40380000 size=0f9c4h ( 63940) load
I (313) esp_image: segment 5: paddr=0012b024 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 (346) cpu_start: Pro cpu start user code
I (346) cpu_start: cpu freq: 160000000
I (346) cpu_start: Application information:
I (349) cpu_start: Project name:     blufi_demo
I (354) cpu_start: App version:      1
I (358) cpu_start: Compile time:     Mar  1 2022 11:06:06
I (364) cpu_start: ELF file SHA256:  dccdcc93cb891f02...
I (370) cpu_start: ESP-IDF:          v4.3.2-dirty
I (376) heap_init: Initializing. RAM available for dynamic allocation:
I (383) heap_init: At 3FC9B300 len 00024D00 (147 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 (403) spi_flash: detected chip: mxic
I (407) 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 (425) cpu_start: Starting scheduler.
I (434) coexist: coexist rom version 9387209
I (434) pp: pp rom version: 9387209
I (434) net80211: net80211 rom version: 9387209
I (454) wifi:wifi driver task: 3fca40a0, prio:23, stack:6656, core=0
I (454) system_api: Base MAC address is not set
I (454) system_api: read default base MAC address from EFUSE
I (464) wifi:wifi firmware version: eb52264
I (464) wifi:wifi certification version: v7.0
I (464) wifi:config NVS flash: enabled
I (474) wifi:config nano formating: disabled
I (474) wifi:Init data frame dynamic rx buffer num: 32
I (484) wifi:Init management frame dynamic rx buffer num: 32
I (484) wifi:Init management short buffer num: 32
I (494) wifi:Init dynamic tx buffer num: 32
I (494) wifi:Init static tx FG buffer num: 2
I (494) wifi:Init static rx buffer size: 1600
I (504) wifi:Init static rx buffer num: 10
I (504) wifi:Init dynamic rx buffer num: 32
I (514) wifi_init: rx ba win: 6
I (514) wifi_init: tcpip mbox: 32
I (514) wifi_init: udp mbox: 6
I (524) wifi_init: tcp mbox: 6
I (524) wifi_init: tcp tx win: 5744
I (534) wifi_init: tcp rx win: 5744
I (534) wifi_init: tcp mss: 1440
I (534) wifi_init: WiFi IRAM OP enabled
I (544) wifi_init: WiFi RX IRAM OP enabled
I (544) phy_init: phy_version 905,7b93cd2,Oct 25 2021,15:05:11
I (594) wifi:set rx active PTI: 0, rx ack PTI: 12, and default PTI: 1
I (594) wifi:mode : sta (60:55:f9:72:fc:94)
I (594) wifi:enable tsf
I (604) BLUFI_EXAMPLE: WIFI_EVENT_STA_START

W (604) BTDM_INIT: esp_bt_controller_mem_release not implemented, return OK
I (614) wifi:new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:1
I (614) wifi:state: init -> auth (b0)
I (624) Protocol: 0x3fcac0a0   fa 00 00 00 00 02 00 11  8c ff 05 00              |............|
I (634) : start tcp_client_task
I (634) WIFI: wait to get IP
I (634) : start tcp_client_recv_task
I (644) wifi:state: auth -> assoc (0)
I (644) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (654) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (664) : start state_led_task
I (664) : start get_RSSI_task
I (674) BLUFI_EXAMPLE: set rssi threshold
I (704) wifi:state: assoc -> run (10)
W (704) wifi:<ba-add>idx:0 (ifx:0, 58:41:20:09:d9:62), tid:5, ssn:0, winSize:64
I (824) wifi:connected with TP-LINK_JSB_WZ, aid = 1, channel 1, 40U, bssid = 58:41:20:09:d9:62
I (824) wifi:security: WPA2-PSK, phy: bgn, rssi: -39
I (824) wifi:pm start, type: 1

I (834) wifi:set rx beacon pti, rx_bcn_pti: 14, bcn_timeout: 14, mt_pti: 25000, mt_time: 10000
dhcp_start(netif=0x3fca175c) st1
dhcp_start(): restarting DHCP configuration
dhcp_start(): starting DHCP configuration
udp_bind(ipaddr = 0.0.0.0, port = 68)
udp_bind: bound to 0.0.0.0, port 68)
udp_connect: connected to 0.0.0.0, port 67)
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(a53ff519)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d3b4
udp_send: sending datagram of length 316
I (884) wifi:BcnInt:102400, DTIM:1
udp_send: UDP packet length 316
udp_send: UDP checksum 0xa450
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        0      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9d     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 500 msecs
I (954) BLUFI_EXAMPLE: WIFI_EVENT_STA_CONNECTED

I (964) BLUFI_EXAMPLE: rssi:-38
I (964) Protocol: 0x3fca9b5c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (974) BLUFI_EXAMPLE: mac:MAC6055f972fc94
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(a53ff519)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d3b4
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0xa450
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        1      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9c     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 1000 msecs
dhcp_coarse_tmr()
I (1634) WIFI: wait to get IP
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(a53ff519)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d3b4
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0xa450
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        2      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9b     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 2000 msecs
dhcp_coarse_tmr()
I (2634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (3634) WIFI: wait to get IP
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(a53ff519)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d3b4
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0xa450
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        3      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9a     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 4000 msecs
dhcp_coarse_tmr()
I (4634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (5634) WIFI: wait to get IP
I (5674) BLUFI_EXAMPLE: set rssi threshold
dhcp_coarse_tmr()
I (6524) BLUFI_EXAMPLE: rssi:-36
I (6524) Protocol: 0x3fca9b5c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (6524) BLUFI_EXAMPLE: mac:MAC6055f972fc94
I (6634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (7634) WIFI: wait to get IP
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(a53ff519)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d3b4
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0xa450
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        4      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba99     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 8000 msecs
dhcp_coarse_tmr()
I (8634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (9634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (10634) WIFI: wait to get IP
I (10674) BLUFI_EXAMPLE: set rssi threshold
I (11024) BLUFI_EXAMPLE: rssi:-36
I (11024) Protocol: 0x3fca9b5c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (11024) BLUFI_EXAMPLE: mac:MAC6055f972fc94
dhcp_coarse_tmr()
I (11634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (12634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (13634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (14634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (15634) WIFI: wait to get IP
I (15674) BLUFI_EXAMPLE: set rssi threshold
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(a53ff519)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d3b4
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0xa450
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        5      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba98     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 15000 msecs
dhcp_coarse_tmr()
I (16634) WIFI: wait to get IP
I (16654) BLUFI_EXAMPLE: rssi:-36
I (16654) Protocol: 0x3fca9b5c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (16664) BLUFI_EXAMPLE: mac:MAC6055f972fc94
dhcp_coarse_tmr()
I (17634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (18634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (19634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (20634) WIFI: wait to get IP
I (20674) BLUFI_EXAMPLE: set rssi threshold
I (21164) BLUFI_EXAMPLE: rssi:-36
I (21164) Protocol: 0x3fca9b5c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (21164) BLUFI_EXAMPLE: mac:MAC6055f972fc94
dhcp_coarse_tmr()
I (21634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (22634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (23634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (24634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (25634) WIFI: wait to get IP
I (25674) BLUFI_EXAMPLE: set rssi threshold
dhcp_coarse_tmr()
I (26634) WIFI: wait to get IP
I (26794) BLUFI_EXAMPLE: rssi:-36
I (26794) Protocol: 0x3fca9b5c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (26794) BLUFI_EXAMPLE: mac:MAC6055f972fc94
dhcp_coarse_tmr()
I (27634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (28634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (29634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (30634) WIFI: wait to get IP
I (30674) BLUFI_EXAMPLE: set rssi threshold
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(a53ff519)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d3b4
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0xa450
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        6      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba97     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 15000 msecs
I (31304) BLUFI_EXAMPLE: rssi:-36
I (31304) Protocol: 0x3fca9b5c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (31304) BLUFI_EXAMPLE: mac:MAC6055f972fc94
dhcp_coarse_tmr()
I (31634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (32634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (33634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (34634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (35634) WIFI: wait to get IP
I (35674) BLUFI_EXAMPLE: set rssi threshold
I (35804) BLUFI_EXAMPLE: rssi:-37
I (35804) Protocol: 0x3fca9b5c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (35804) BLUFI_EXAMPLE: mac:MAC6055f972fc94
dhcp_coarse_tmr()
I (36634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (37634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (38634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (39634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (40634) WIFI: wait to get IP
I (40674) BLUFI_EXAMPLE: set rssi threshold
dhcp_coarse_tmr()
I (41434) BLUFI_EXAMPLE: rssi:-36
I (41434) Protocol: 0x3fca9b5c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (41444) BLUFI_EXAMPLE: mac:MAC6055f972fc94
I (41634) WIFI: wait to get IP
dhcp_coarse_tmr()
DHCP抓包.txt
后缀改成pcapng
(1.91 MiB) Downloaded 1061 times
后缀改成pcapng,抓包工具wireshark v3.6.0

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

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Tue Mar 01, 2022 8:50 am

这个只是有线包,不是无线包。现在需要抓取无线包看模组有没有发送成功或者路由器有没有回复。

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

Re: ESP32 DHCP 获取不到IP

Postby liutao » Tue Mar 01, 2022 9:10 am

ESP_YJM wrote:
Tue Mar 01, 2022 8:50 am
这个只是有线包,不是无线包。现在需要抓取无线包看模组有没有发送成功或者路由器有没有回复。
抓包截图.png
抓包截图.png (87.19 KiB) Viewed 9237 times
我选的是无线网卡 AX200
第17秒我打开手机连wifi能捕获手机的DHCP Discover,但是从来没有捕获到过ESP32C3的DHCP Discover。
DHCP_17秒手机开始获取.txt
(114 KiB) Downloaded 1191 times
电脑热点.txt
(4.93 KiB) Downloaded 1050 times
用电脑共享wifi能捕获到。

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

Re: ESP32 DHCP 获取不到IP

Postby liutao » Tue Mar 01, 2022 9:50 am

ESP_YJM wrote:
Tue Mar 01, 2022 8:50 am
这个只是有线包,不是无线包。现在需要抓取无线包看模组有没有发送成功或者路由器有没有回复。

Code: Select all

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:�ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x189c
load:0x403ce000,len:0x8d4
load:0x403d0000,len:0x2dc0
entry 0x403ce000
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=2fb70h (195440) map
I (157) esp_image: segment 1: paddr=0003fb98 vaddr=3fc8fe00 size=00480h (  1152) load
I (158) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=dd01ch (905244) map
I (299) esp_image: segment 3: paddr=0011d044 vaddr=3fc90280 size=03790h ( 14224) load
I (302) esp_image: segment 4: paddr=001207dc vaddr=40380000 size=0fc48h ( 64584) load
I (316) esp_image: segment 5: paddr=0013042c vaddr=50000000 size=00010h (    16) load
I (322) boot: Loaded app from partition at offset 0x10000
I (322) boot: Disabling RNG early entropy source...
I (337) cpu_start: Pro cpu up.
I (349) cpu_start: Pro cpu start user code
I (349) cpu_start: cpu freq: 160000000
I (349) cpu_start: Application information:
I (352) cpu_start: Project name:     blufi_demo
I (357) cpu_start: App version:      1
I (361) cpu_start: Compile time:     Mar  1 2022 11:06:06
I (368) cpu_start: ELF file SHA256:  599887c811daf121...
I (374) cpu_start: ESP-IDF:          v4.3.2-dirty
I (379) heap_init: Initializing. RAM available for dynamic allocation:
I (386) heap_init: At 3FC9B890 len 00024770 (145 KiB): DRAM
I (392) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
I (399) heap_init: At 50000010 len 00001FF0 (7 KiB): RTCRAM
I (406) spi_flash: detected chip: mxic
I (410) spi_flash: flash io: dio
I (414) sleep: Configure to isolate all GPIO pins in sleep state
I (421) sleep: Enable automatic switching of GPIO sleep configuration
I (428) cpu_start: Starting scheduler.
I (437) coexist: coexist rom version 9387209
I (437) pp: pp rom version: 9387209
I (437) net80211: net80211 rom version: 9387209
I (457) wifi:wifi driver task: 3fca46b4, prio:23, stack:6656, core=0
I (457) system_api: Base MAC address is not set
I (457) system_api: read default base MAC address from EFUSE
I (467) wifi:wifi firmware version: eb52264
I (467) wifi:wifi certification version: v7.0
I (467) wifi:config NVS flash: enabled
I (477) wifi:config nano formating: disabled
I (477) wifi:Init data frame dynamic rx buffer num: 32
I (487) wifi:Init management frame dynamic rx buffer num: 32
I (487) wifi:Init management short buffer num: 32
I (497) wifi:Init dynamic tx buffer num: 32
I (497) wifi:Init static tx FG buffer num: 2
I (497) wifi:Init static rx buffer size: 1600
I (507) wifi:Init static rx buffer num: 10
I (507) wifi:Init dynamic rx buffer num: 32
I (517) wifi_init: rx ba win: 6
I (517) wifi_init: tcpip mbox: 32
I (517) wifi_init: udp mbox: 6
I (527) wifi_init: tcp mbox: 6
I (527) wifi_init: tcp tx win: 5744
I (537) wifi_init: tcp rx win: 5744
I (537) wifi_init: tcp mss: 1440
I (537) wifi_init: WiFi IRAM OP enabled
I (547) wifi_init: WiFi RX IRAM OP enabled
I (547) phy_init: phy_version 905,7b93cd2,Oct 25 2021,15:05:11
I (597) wifi:set rx active PTI: 0, rx ack PTI: 12, and default PTI: 1
I (597) wifi:mode : sta (60:55:f9:72:fc:94)
I (597) wifi:enable tsf
I (607) BLUFI_EXAMPLE: WIFI_EVENT_STA_START

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

I (637) wifi:state: auth -> assoc (0)
I (647) wifi:state: assoc -> run (10)
I (667) wifi:connected with hzwz, aid = 5, channel 1, 40U, bssid = 9c:a6:15:29:e3:57
I (667) wifi:security: WPA2-PSK, phy: bgn, rssi: -34
I (667) wifi:pm start, type: 1

I (667) wifi:set rx beacon pti, rx_bcn_pti: 14, bcn_timeout: 14, mt_pti: 25000, mt_time: 10000
dhcp_start(netif=0x3fca1d70) st1
dhcp_start(): restarting DHCP configuration
dhcp_start(): starting DHCP configuration
udp_bind(ipaddr = 0.0.0.0, port = 68)
udp_bind: bound to 0.0.0.0, port 68)
udp_connect: connected to 0.0.0.0, port 67)
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(f4d72bcd)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
I (717) wifi:BcnInt:102400, DTIM:1
udp_send: added header in given pbuf 0x3fcb76fc
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x58ca
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        0      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9d     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 500 msecs
W (787) wifi:<ba-add>idx:0 (ifx:0, 9c:a6:15:29:e3:57), tid:0, ssn:0, winSize:64
I (797) BLUFI_EXAMPLE: WIFI_EVENT_STA_CONNECTED

ip_input: iphdr->dest 0x7001a8c0 netif->ip_addr 0x0 (0x0, 0x0, 0x7001a8c0)
ip_input: iphdr->dest 0x7001a8c0 netif->ip_addr 0x100007f (0xc0, 0x7f, 0x7001a800)
ip4_input: UDP packet to DHCP client port 68
ip4_input: DHCP packet accepted.
ip4_input:
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       576     | (v, hl, tos, len)
+-------------------------------+
|      130      |010|       0   | (id, flags, offset)
+-------------------------------+
|   64  |   17  |    0xb469     | (ttl, proto, chksum)
+-------------------------------+
|  192  |  168  |    1  |    1  | (src)
+-------------------------------+
|  192  |  168  |    1  |  112  | (dest)
+-------------------------------+
ip4_input: p->len 576 p->tot_len 576
udp_input: received datagram of length 556
UDP header:
+-------------------------------+
|        67     |        68     | (src port, dest port)
+-------------------------------+
|       556     |     0x77b7    | (len, chksum)
+-------------------------------+
udp (192.168.1.112, 68) <-- (192.168.1.1, 67)
pcb (0.0.0.0, 68) <-- (0.0.0.0, 67)
udp_input: calculating checksum
dhcp_recv(pbuf = 0x3fcaa220) from DHCP server 192.168.1.1 port 67
pbuf->len = 548
pbuf->tot_len = 548
searching DHCP_OPTION_MESSAGE_TYPE
DHCP_OFFER received in DHCP_STATE_SELECTING state
dhcp_handle_offer(netif=0x3fca1d70) st1
dhcp_handle_offer(): server 0x0101a8c0
dhcp_handle_offer(): offer for 0x7001a8c0
dhcp_select(netif=0x3fca1d70) st1
dhcp_select(): dhcp state is REQUESTING
transaction id xid(f4d72bcd)
udp_send: added header in given pbuf 0x3fcb76fc
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x3d2d
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        1      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9c     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_select: REQUESTING
dhcp_select(): set request timeout 2000 msecs
ip_input: iphdr->dest 0xff01a8c0 netif->ip_addr 0x0 (0x0, 0x0, 0xff01a8c0)
ip_input: iphdr->dest 0xff01a8c0 netif->ip_addr 0x100007f (0xc0, 0x7f, 0xff01a800)
ip4_input: UDP packet to DHCP client port 5001
ip4_input: packet not for us.
ip_input: iphdr->dest 0x7001a8c0 netif->ip_addr 0x0 (0x0, 0x0, 0x7001a8c0)
ip_input: iphdr->dest 0x7001a8c0 netif->ip_addr 0x100007f (0xc0, 0x7f, 0x7001a800)
ip4_input: UDP packet to DHCP client port 68
ip4_input: DHCP packet accepted.
ip4_input:
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       576     | (v, hl, tos, len)
+-------------------------------+
|      131      |010|       0   | (id, flags, offset)
+-------------------------------+
|   64  |   17  |    0xb468     | (ttl, proto, chksum)
+-------------------------------+
|  192  |  168  |    1  |    1  | (src)
+-------------------------------+
|  192  |  168  |    1  |  112  | (dest)
+-------------------------------+
ip4_input: p->len 576 p->tot_len 576
udp_input: received datagram of length 556
UDP header:
+-------------------------------+
|        67     |        68     | (src port, dest port)
+-------------------------------+
|       556     |     0x63b7    | (len, chksum)
+-------------------------------+
udp (192.168.1.112, 68) <-- (192.168.1.1, 67)
pcb (0.0.0.0, 68) <-- (0.0.0.0, 67)
udp_input: calculating checksum
dhcp_recv(pbuf = 0x3fcaa220) from DHCP server 192.168.1.1 port 67
pbuf->len = 548
pbuf->tot_len = 548
searching DHCP_OPTION_MESSAGE_TYPE
DHCP_ACK received
dhcp_check(netif=0x3fca1d70) st
dhcp_check(): dhcp state is CHECKING
dhcp_check(): set request timeout 500 msecs
I (1157) BLUFI_EXAMPLE: BD ADDR: 60:55:f9:72:fc:95

I (1157) BLUFI_EXAMPLE: BLUFI init finish

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

I (1177) Protocol: 0x3fcb761c   fa 00 00 00 00 02 00 11  8c ff 05 00              |............|
I (1187) : start tcp_client_task
I (1187) WIFI: wait to get IP
I (1197) : start tcp_client_recv_task
I (1197) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1207) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1217) : start state_led_task
I (1217) : start get_RSSI_task
I (1227) BLUFI_EXAMPLE: set rssi threshold
I (1227) BLUFI_EXAMPLE: rssi:-34
I (1237) Protocol: 0x3fcb762c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (1237) BLUFI_EXAMPLE: mac:MAC6055f972fc94
dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): CHECKING, ARP request timed out
dhcp_check(netif=0x3fca1d70) st
dhcp_check(): dhcp state is CHECKING
dhcp_check(): set request timeout 500 msecs
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): CHECKING, ARP request timed out
dhcp_bind(netif=0x3fca1d70) st1
dhcp_bind(): t0 renewal timer 7200 secs
dhcp_bind(): set request timeout 7200000 msecs
dhcp_bind(): t1 renewal timer 3600 secs
dhcp_bind(): set request timeout 3600000 msecs
dhcp_bind(): t2 rebind timer 6300 secs
dhcp_bind(): set request timeout 6300000 msecs
dhcp_bind(): IP: 0x7001a8c0 SN: 0x00ffffff GW: 0x0101a8c0
dhcp_bind(): dhcp state is BOUND
I (1967) esp_netif_handlers: sta ip: 192.168.1.112, mask: 255.255.255.0, gw: 192.168.1.1
I (1977) BLUFI_EXAMPLE: STA_GOT_IP

I (1977) BLUFI_EXAMPLE: BLUFI BLE is not connected yet

I (2197) WIFI: server addr:wz.ctiot.info:6010
udp_bind(ipaddr = 0.0.0.0, port = 37352)
udp_bind: bound to 0.0.0.0, port 37352)
udp_send
udp_send: added header in given pbuf 0x3fc9d8b4
udp_send: sending datagram of length 39
udp_send: UDP packet length 39
udp_send: UDP checksum 0x248c
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        59     | (v, hl, tos, len)
+-------------------------------+
|        2      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0x38ee     | (ttl, proto, chksum)
+-------------------------------+
|  192  |  168  |    1  |  112  | (src)
+-------------------------------+
|  192  |  168  |    0  |    1  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_arp_reply()
ip_input: iphdr->dest 0x7001a8c0 netif->ip_addr 0x7001a8c0 (0x1a8c0, 0x1a8c0, 0x70000000)
ip4_input: packet accepted on interface st
ip4_input:
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        75     | (v, hl, tos, len)
+-------------------------------+
|        0      |010|       0   | (id, flags, offset)
+-------------------------------+
|   63  |   17  |    0xb8e0     | (ttl, proto, chksum)
+-------------------------------+
|  192  |  168  |    0  |    1  | (src)
+-------------------------------+
|  192  |  168  |    1  |  112  | (dest)
+-------------------------------+
ip4_input: p->len 75 p->tot_len 75
udp_input: received datagram of length 55
UDP header:
+-------------------------------+
|        53     |     37352     | (src port, dest port)
+-------------------------------+
|        55     |     0x6b06    | (len, chksum)
+-------------------------------+
udp (192.168.1.112, 37352) <-- (192.168.0.1, 53)
pcb (0.0.0.0, 37352) <-- (0.0.0.0, 0)
pcb (0.0.0.0, 68) <-- (0.0.0.0, 67)
udp_input: calculating checksum
I (2347) WIFI: [IPv4]47.98.139.219 [port]6010
I (2357) WIFI: Socket:54 created, connecting to 47.98.139.219:6010
tcp_connect to port 6010
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        44     | (v, hl, tos, len)
+-------------------------------+
|        3      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |    6  |    0x3e73     | (ttl, proto, chksum)
+-------------------------------+
|  192  |  168  |    1  |  112  | (src)
+-------------------------------+
|   47  |   98  |  139  |  219  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_coarse_tmr()
ip_input: iphdr->dest 0x7001a8c0 netif->ip_addr 0x7001a8c0 (0x1a8c0, 0x1a8c0, 0x70000000)
ip4_input: packet accepted on interface st
ip4_input:
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        44     | (v, hl, tos, len)
+-------------------------------+
|        0      |010|       0   | (id, flags, offset)
+-------------------------------+
|   51  |    6  |    0xca76     | (ttl, proto, chksum)
+-------------------------------+
|   47  |   98  |  139  |  219  | (src)
+-------------------------------+
|  192  |  168  |    1  |  112  | (dest)
+-------------------------------+
ip4_input: p->len 44 p->tot_len 44
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        40     | (v, hl, tos, len)
+-------------------------------+
|        4      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |    6  |    0x3e76     | (ttl, proto, chksum)
+-------------------------------+
|  192  |  168  |    1  |  112  | (src)
+-------------------------------+
|   47  |   98  |  139  |  219  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
I (2547) WIFI: Successfully connected
I (2557) Protocol: 0x3fc9da38   fa 00 00 00 00 02 00 11  8c 7a 01 30              |.........z.0|
I (2567) Protocol: 0x3fc9da38   fa 00 00 00 00 02 00 11  8c cc 09 0a              |............|
I (2577) Protocol: 0x3fc9da38   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (2587) Protocol: 0x3fc9da38   fa 00 00 00 00 02 00 11  8c a1 05 01              |............|
I (2597) Protocol: 0x3fc9da38   fa 00 00 00 00 11 00 11  22 46 02 4d 41 43 36 30  |........"F.MAC60|
I (2607) Protocol: 0x3fc9da48   35 35 66 39 37 32 66 63  39 34 00                 |55f972fc94.|
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
I (6247) BLUFI_EXAMPLE: set rssi threshold
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
I (6647) BLUFI_EXAMPLE: rssi:-33
I (6647) Protocol: 0x3fc9e80c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (6647) BLUFI_EXAMPLE: mac:MAC6055f972fc94
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
ip4_input: UDP packet to DHCP client port 1900
ip4_input: packet not for us.
ip4_input: UDP packet to DHCP client port 1900
ip4_input: packet not for us.
ip4_input: UDP packet to DHCP client port 1900
ip4_input: packet not for us.
ip4_input: UDP packet to DHCP client port 1900
ip4_input: packet not for us.
ip4_input: UDP packet to DHCP client port 1900
ip4_input: packet not for us.
ip4_input: UDP packet to DHCP client port 1900
ip4_input: packet not for us.
ip4_input: UDP packet to DHCP client port 1900
ip4_input: packet not for us.
ip4_input: UDP packet to DHCP client port 1900
ip4_input: packet not for us.
ip4_input: UDP packet to DHCP client port 1900
ip4_input: packet not for us.
ip4_input: UDP packet to DHCP client port 1900
ip4_input: packet not for us.
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
I (11247) BLUFI_EXAMPLE: set rssi threshold
dhcp_coarse_tmr()
I (11557) BLUFI_EXAMPLE: rssi:-33
I (11567) Protocol: 0x3fc9e80c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (11567) BLUFI_EXAMPLE: mac:MAC6055f972fc94
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
ip_input: iphdr->dest 0x7001a8c0 netif->ip_addr 0x7001a8c0 (0x1a8c0, 0x1a8c0, 0x70000000)
ip4_input: packet accepted on interface st
ip4_input:
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        40     | (v, hl, tos, len)
+-------------------------------+
|    15235      |010|       0   | (id, flags, offset)
+-------------------------------+
|   51  |    6  |    0x8ef7     | (ttl, proto, chksum)
+-------------------------------+
|   47  |   98  |  139  |  219  | (src)
+-------------------------------+
|  192  |  168  |    1  |  112  | (dest)
+-------------------------------+
ip4_input: p->len 40 p->tot_len 40
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        40     | (v, hl, tos, len)
+-------------------------------+
|        5      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |    6  |    0x3e75     | (ttl, proto, chksum)
+-------------------------------+
|  192  |  168  |    1  |  112  | (src)
+-------------------------------+
|   47  |   98  |  139  |  219  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
ip_input: iphdr->dest 0x7001a8c0 netif->ip_addr 0x7001a8c0 (0x1a8c0, 0x1a8c0, 0x70000000)
ip4_input: packet accepted on interface st
ip4_input:
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        40     | (v, hl, tos, len)
+-------------------------------+
|    34906      |010|       0   | (id, flags, offset)
+-------------------------------+
|   51  |    6  |    0x4220     | (ttl, proto, chksum)
+-------------------------------+
|   47  |   98  |  139  |  219  | (src)
+-------------------------------+
|  192  |  168  |    1  |  112  | (dest)
+-------------------------------+
ip4_input: p->len 40 p->tot_len 40
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        40     | (v, hl, tos, len)
+-------------------------------+
|        6      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |    6  |    0x3e74     | (ttl, proto, chksum)
+-------------------------------+
|  192  |  168  |    1  |  112  | (src)
+-------------------------------+
|   47  |   98  |  139  |  219  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
I (16247) BLUFI_EXAMPLE: set rssi threshold
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
I (16777) BLUFI_EXAMPLE: rssi:-32
I (16777) Protocol: 0x3fc9e80c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (16787) BLUFI_EXAMPLE: mac:MAC6055f972fc94
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
ip_input: iphdr->dest 0x7001a8c0 netif->ip_addr 0x7001a8c0 (0x1a8c0, 0x1a8c0, 0x70000000)
ip4_input: packet accepted on interface st
ip4_input:
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        40     | (v, hl, tos, len)
+-------------------------------+
|    51210      |010|       0   | (id, flags, offset)
+-------------------------------+
|   51  |    6  |    0x0270     | (ttl, proto, chksum)
+-------------------------------+
|   47  |   98  |  139  |  219  | (src)
+-------------------------------+
|  192  |  168  |    1  |  112  | (dest)
+-------------------------------+
ip4_input: p->len 40 p->tot_len 40
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        40     | (v, hl, tos, len)
+-------------------------------+
|        7      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |    6  |    0x3e73     | (ttl, proto, chksum)
+-------------------------------+
|  192  |  168  |    1  |  112  | (src)
+-------------------------------+
|   47  |   98  |  139  |  219  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
ip_input: iphdr->dest 0xff01a8c0 netif->ip_addr 0x7001a8c0 (0x1a8c0, 0x1a8c0, 0xff000000)
ip4_input: packet accepted on interface st
ip4_input:
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       148     | (v, hl, tos, len)
+-------------------------------+
|    33872      |000|       0   | (id, flags, offset)
+-------------------------------+
|   64  |   17  |    0x71b8     | (ttl, proto, chksum)
+-------------------------------+
|  192  |  168  |    1  |    1  | (src)
+-------------------------------+
|  192  |  168  |    1  |  255  | (dest)
+-------------------------------+
ip4_input: p->len 148 p->tot_len 148
udp_input: received datagram of length 128
UDP header:
+-------------------------------+
|      1024     |      5001     | (src port, dest port)
+-------------------------------+
|       128     |     0x6314    | (len, chksum)
+-------------------------------+
udp (192.168.1.255, 5001) <-- (192.168.1.1, 1024)
pcb (0.0.0.0, 68) <-- (0.0.0.0, 67)
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
I (21247) BLUFI_EXAMPLE: set rssi threshold
dhcp_coarse_tmr()
I (21487) BLUFI_EXAMPLE: rssi:-32
I (21487) Protocol: 0x3fc9e83c   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (21487) BLUFI_EXAMPLE: mac:MAC6055f972fc94
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
dhcp_coarse_tmr()
tcp_slowtmr: processing active pcb
另一个路由器下.png
另一个路由器下.png (57.37 KiB) Viewed 9217 times
在另一个路由器下能捕获到ESP32C3的DHCP Discover,能获取到IP
另一个路由器下.txt
(134.68 KiB) Downloaded 1094 times

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

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Tue Mar 01, 2022 11:37 am

你抓的包只是以太网的包,至于可以抓到是因为你的无线网卡AX200 和这些设备在一个局域网,而 DHCP discovery 包是广播包,局域网的设备是都可以接收到的。至于你使用 ESP32C3 连接路由器,无线网卡没有收到 discovery 的包可能是 ESP32C3 和路由器 WIFI 连接异常,ESP32C3 发送的包路由器没有收到。至于为何没有收到,这可能只能抓 ESP32C3 和路由器之间 WIFI 包,查看 WIFI 连接过程和 ESP32C3 发包情况。

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

Re: ESP32 DHCP 获取不到IP

Postby liutao » Tue Mar 01, 2022 1:25 pm

ESP_YJM wrote:
Tue Mar 01, 2022 11:37 am
你抓的包只是以太网的包,至于可以抓到是因为你的无线网卡AX200 和这些设备在一个局域网,而 DHCP discovery 包是广播包,局域网的设备是都可以接收到的。至于你使用 ESP32C3 连接路由器,无线网卡没有收到 discovery 的包可能是 ESP32C3 和路由器 WIFI 连接异常,ESP32C3 发送的包路由器没有收到。至于为何没有收到,这可能只能抓 ESP32C3 和路由器之间 WIFI 包,查看 WIFI 连接过程和 ESP32C3 发包情况。
那该如何抓ESP32C3 和路由器之间 WIFI 包
本地接口.png
本地接口.png (38.06 KiB) Viewed 9163 times
捕获选项.png
捕获选项.png (18.02 KiB) Viewed 9163 times
我这里有这些

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

Re: ESP32 DHCP 获取不到IP

Postby liutao » Wed Mar 02, 2022 1:27 am

ESP_YJM wrote:
Tue Mar 01, 2022 11:37 am
你抓的包只是以太网的包,至于可以抓到是因为你的无线网卡AX200 和这些设备在一个局域网,而 DHCP discovery 包是广播包,局域网的设备是都可以接收到的。至于你使用 ESP32C3 连接路由器,无线网卡没有收到 discovery 的包可能是 ESP32C3 和路由器 WIFI 连接异常,ESP32C3 发送的包路由器没有收到。至于为何没有收到,这可能只能抓 ESP32C3 和路由器之间 WIFI 包,查看 WIFI 连接过程和 ESP32C3 发包情况。
是要用OmniPeek抓包吗,我去淘宝买个

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

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Wed Mar 02, 2022 2:12 am

是的,用 omnipeek 抓。

Who is online

Users browsing this forum: No registered users and 245 guests