mdns依赖IPV6?

dengbq
Posts: 38
Joined: Thu Mar 31, 2022 8:45 am

mdns依赖IPV6?

Postby dengbq » Wed Jun 22, 2022 1:35 am

IDF V4.4
测试例子为protocols\mdns.
测试两个问题:
1、如果把编译配置中的获取IPV6项去掉,则在PC上ping
ping esp32-mdns.local
Ping 请求找不到主机 esp32-mdns.local。请检查该名称,然后重试。
打开这个选项就可以了。

2、在windows上ping,返回的ipv6地址
ping esp32-mdns.local
正在 Ping esp32-mdns.local [fe80::32c6:f7ff:fe20:e29c%17] 具有 32 字节的数据:
来自 fe80::32c6:f7ff:fe20:e29c%17 的回复: 时间=46ms
来自 fe80::32c6:f7ff:fe20:e29c%17 的回复: 时间=51ms
来自 fe80::32c6:f7ff:fe20:e29c%17 的回复: 时间=75ms
在linux上ping ,返回的是ipv4地址
deng@ubuntu:~$ ping esp32-mdns.local
PING esp32-mdns.local (192.168.1.23) 56(84) bytes of data.
64 bytes from 192.168.1.23 (192.168.1.23): icmp_seq=1 ttl=255 time=81.6 ms
64 bytes from 192.168.1.23 (192.168.1.23): icmp_seq=2 ttl=255 time=98.3 ms
64 bytes from 192.168.1.23 (192.168.1.23): icmp_seq=3 ttl=255 time=121 ms
怎么二者不一样?

I (27) boot: ESP-IDF v4.4-dirty 2nd stage bootloader
I (27) boot: compile time 17:25:39
I (27) boot: chip revision: 3
I (30) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (38) boot.esp32: SPI Speed : 40MHz
I (42) boot.esp32: SPI Mode : DIO
I (47) boot.esp32: SPI Flash Size : 2MB
I (51) boot: Enabling RNG early entropy source...
I (57) boot: Partition Table:
I (60) boot: ## Label Usage Type ST Offset Length
I (68) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (75) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (82) boot: 2 factory factory app 00 00 00010000 00100000
I (90) boot: End of partition table
I (94) boot_comm: chip revision: 3, min. application chip revision: 0
I (101) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=13d80h ( 81280) map
I (139) esp_image: segment 1: paddr=00023da8 vaddr=3ffb0000 size=0382ch ( 14380) load
I (145) esp_image: segment 2: paddr=000275dc vaddr=40080000 size=08a3ch ( 35388) load
I (160) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=754d0h (480464) map
I (334) esp_image: segment 4: paddr=000a54f8 vaddr=40088a3c size=0bbc4h ( 48068) load
I (354) esp_image: segment 5: paddr=000b10c4 vaddr=50000000 size=00010h ( 16) load
I (364) boot: Loaded app from partition at offset 0x10000
I (364) boot: Disabling RNG early entropy source...
I (376) cpu_start: Pro cpu up.
I (377) cpu_start: Starting app cpu, entry point is 0x40081198
0x40081198: call_start_cpu1 at D:/Espressif/frameworks/esp-idf-v4.4/components/esp_system/port/cpu_start.c:156

I (0) cpu_start: App cpu up.
I (391) cpu_start: Pro cpu start user code
I (391) cpu_start: cpu freq: 160000000
I (391) cpu_start: Application information:
I (395) cpu_start: Project name: mdns_test
I (400) cpu_start: App version: 1
I (405) cpu_start: Compile time: Jun 22 2022 09:26:11
I (411) cpu_start: ELF file SHA256: 47522db5af2e6c03...
I (417) cpu_start: ESP-IDF: v4.4-dirty
I (422) heap_init: Initializing. RAM available for dynamic allocation:
I (429) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (435) heap_init: At 3FFB7C48 len 000283B8 (160 KiB): DRAM
I (442) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (448) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (454) heap_init: At 40094600 len 0000BA00 (46 KiB): IRAM
I (462) spi_flash: detected chip: generic
I (465) spi_flash: flash io: dio
W (469) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (483) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (552) mdns-test: mdns hostname set to: [esp32-mdns]
I (572) wifi:wifi driver task: 3ffc1c48, prio:23, stack:6656, core=0
I (572) system_api: Base MAC address is not set
I (572) system_api: read default base MAC address from EFUSE
I (592) wifi:wifi firmware version: 7679c42
I (592) wifi:wifi certification version: v7.0
I (592) wifi:config NVS flash: enabled
I (592) wifi:config nano formating: disabled
I (592) wifi:Init data frame dynamic rx buffer num: 32
I (602) wifi:Init management frame dynamic rx buffer num: 32
I (602) wifi:Init management short buffer num: 32
I (612) wifi:Init dynamic tx buffer num: 32
I (612) wifi:Init static rx buffer size: 1600
I (612) wifi:Init static rx buffer num: 10
I (622) wifi:Init dynamic rx buffer num: 32
I (622) wifi_init: rx ba win: 6
I (632) wifi_init: tcpip mbox: 32
I (632) wifi_init: udp mbox: 6
I (632) wifi_init: tcp mbox: 6
I (642) wifi_init: tcp tx win: 5744
I (642) wifi_init: tcp rx win: 5744
I (652) wifi_init: tcp mss: 1440
I (652) wifi_init: WiFi IRAM OP enabled
I (652) wifi_init: WiFi RX IRAM OP enabled
I (662) example_connect: Connecting to qksdan1...
I (672) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (782) wifi:mode : sta (30:c6:f7:20:e2:9c)
I (782) wifi:enable tsf
I (782) example_connect: Waiting for IP(s)
I (2832) wifi:new:<2,0>, old:<1,0>, ap:<255,255>, sta:<2,0>, prof:1
I (3582) wifi:state: init -> auth (b0)
I (3612) wifi:state: auth -> assoc (0)
I (3612) wifi:state: assoc -> run (10)
I (3622) wifi:state: run -> init (2a0)
I (3622) wifi:new:<2,0>, old:<2,0>, ap:<255,255>, sta:<2,0>, prof:1
I (3622) wifi:new:<2,0>, old:<2,0>, ap:<255,255>, sta:<2,0>, prof:1
I (3622) wifi:new:<2,0>, old:<2,0>, ap:<255,255>, sta:<2,0>, prof:1
I (3632) wifi:state: init -> auth (b0)
I (3642) wifi:state: auth -> assoc (0)
I (3652) wifi:state: assoc -> run (10)
I (3842) wifi:connected with qinglan1, aid = 25, channel 2, BW20, bssid = 7c:da:c3:13:dc:25
I (3842) wifi:security: WPA2-PSK, phy: bgn, rssi: -62
I (3842) wifi:pm start, type: 1

W (3862) wifi:<ba-add>idx:0 (ifx:0, 7c:da:c3:13:dc:25), tid:0, ssn:0, winSize:64
I (3882) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (4552) esp_netif_handlers: example_connect: sta ip: 192.168.1.23, mask: 255.255.255.0, gw: 192.168.1.1
I (4552) example_connect: Got IPv4 event: Interface "example_connect: sta" address: 192.168.1.23
I (4562) example_connect: Connected to example_connect: sta
I (4562) example_connect: - IPv4 address: 192.168.1.23
W (52532) wifi:<ba-add>idx:1 (ifx:0, 7c:da:c3:13:dc:25), tid:4, ssn:0, winSize:64
Attachments
123.png
123.png (18.06 KiB) Viewed 2946 times

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

Re: mdns依赖IPV6?

Postby ESP_YJM » Wed Jun 22, 2022 2:20 am

1. 请问下在 LINUX 上 ping,并且关闭 Obtain IPv6 address 能否 PING 通?
2. 能否在 Windows 上把网卡 IPv6 禁用后,只保留 IPv4,ping 下测试,是否就可以按照 IPv4 地址进行通信。

dengbq
Posts: 38
Joined: Thu Mar 31, 2022 8:45 am

Re: mdns依赖IPV6?

Postby dengbq » Wed Jun 22, 2022 3:02 am

关闭obtain IPV6后,在linux和windows上都ping不通,后缀加上了.local的

dengbq
Posts: 38
Joined: Thu Mar 31, 2022 8:45 am

Re: mdns依赖IPV6?

Postby dengbq » Wed Jun 22, 2022 3:09 am

windows上禁用ipv6后,确实返回的ipv4,看来ping优先走ipv6啊。
多谢快速回复. @ESP_YJM

Who is online

Users browsing this forum: No registered users and 96 guests