mDNS 探索

在 GitHub 中查看來源

OTBR 會註冊名為 OpenThread BorderRouter_meshcop._udp 服務。這項服務是在 OTBR CMakeLists.txt 檔案中設定。

探索討論串網路的方法有好幾種,

DNS 服務探索 (DNS-SD)

使用 dns-sd 瀏覽 raspberrypi.local.:49155 上的服務:

dns-sd -L "OpenThread BorderRouter" _meshcop._udp local
Lookup OpenThread BorderRouter._meshcop._udp.local
DATE: ---Tue 16 Nov 2021---
13:31:03.197  ...STARTING...
13:31:03.350  OpenThread\032BorderRouter._meshcop._udp.local. can be reached at raspberrypi.local.:49155 (interface 3)

取得與 OTBR 網域名稱相關聯的 IP 位址:

dns-sd -G v4/v6 raspberrypi.local
DATE: ---Tue 16 Nov 2021---
14:21:29.485  ...STARTING...
Timestamp     A/R Flags if Hostname           Address                                      TTL
14:21:29.486  Add     3  3 raspberrypi.local. FDDE:AD11:11DE:0000:74D0:6FC9:6BE6:3582%<0>  120
14:21:29.486  Add     3  3 raspberrypi.local. FD00:0000:0000:0000:74D0:6FC9:6BE6:3582%<0>  120
14:21:29.486  Add     3  3 raspberrypi.local. FE80:0000:0000:0000:74D0:6FC9:6BE6:3582%eth0 120
14:21:29.486  Add     3  3 raspberrypi.local. FE80:0000:0000:0000:287F:87CA:F4B3:498A%eth0 120
14:21:29.486  Add     2  3 raspberrypi.local. 192.168.0.10                                 120

連線偵測 (ping) IP 位址。從 dns-sd 結果中選擇可從您的網路存取的位址,例如全域 <0> 位址 FD00::74D0:6FC9:6BE6:3582

ping -6 FD00::74D0:6FC9:6BE6:3582
PING FD00::74D0:6FC9:6BE6:3582(fd00::74d0:6fc9:6be6:3582) 56 data bytes
64 bytes from fd00::74d0:6fc9:6be6:3582: icmp_seq=1 ttl=64 time=27.1 ms
64 bytes from fd00::74d0:6fc9:6be6:3582: icmp_seq=2 ttl=64 time=3.18 ms
64 bytes from fd00::74d0:6fc9:6be6:3582: icmp_seq=3 ttl=64 time=2.76 ms

Avahi 公用程式

安裝 avahi-daemonavahi-utils

sudo apt-get install -y avahi-daemon avahi-utils

啟動 avahi-daemon

sudo service avahi-daemon start

使用 avahi-browse

avahi-browse -r -t _meshcop._udp
+ eth0 IPv6 OpenThread BorderRouter   _meshcop._udp        local
= eth0 IPv6 OpenThread BorderRouter   _meshcop._udp        local
   hostname = [raspberrypi.local]
   address = [192.168.0.10]
   port = [49155]
   txt = []

mDNS 應用程式

Google Play 中搜尋 mDNS 探索應用程式,例如: