仅在 IPv6 上提供 mDNS

仅在 IPv6 上提供 mDNS

Ubuntu 版本:Ubuntu 22.04.4 LTS

我遇到了一个奇怪的问题,即在此主机上运行 mDNS。使用 Macos 上的发现工具,我只能在 IPv6 上看到来自此主机的 mDNS 公告,而在 IPv4 上看不到任何公告。进行此故障排除的原因是我无法再将“Yahka”Homkit Bridge 仿真添加到 Apple Homekit 中。我确实看到了桥接器,但添加时会超时。

我的 avahi.daemon 状态

adieball@s01:~$ sudo systemctl status avahi-daemon.service 
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
     Loaded: loaded (/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2024-03-30 10:02:20 CET; 2 days ago
TriggeredBy: ○ avahi-daemon.socket
   Main PID: 3600 (avahi-daemon)
     Status: "avahi-daemon 0.8 starting up."
      Tasks: 2 (limit: 18917)
     Memory: 1.5M
        CPU: 3min 44.261s
     CGroup: /system.slice/avahi-daemon.service
             ├─3600 "avahi-daemon: running [s01.local]"
             └─3601 "avahi-daemon: chroot helper"

Mar 30 10:02:20 s01 avahi-daemon[3600]: Joining mDNS multicast group on interface enp0s31f6.IPv4 with address 192.168.119.121.
Mar 30 10:02:20 s01 avahi-daemon[3600]: New relevant interface enp0s31f6.IPv4 for mDNS.
Mar 30 10:02:20 s01 avahi-daemon[3600]: Network interface enumeration completed.
Mar 30 10:02:20 s01 avahi-daemon[3600]: Registering new address record for fdd6:e4c8:2592:da48:6e4b:90ff:fe1c:8770 on enp0s31f6.*.
Mar 30 10:02:20 s01 avahi-daemon[3600]: Registering new address record for 192.168.119.121 on enp0s31f6.IPv4.
Mar 30 10:02:21 s01 avahi-daemon[3600]: Server startup complete. Host name is s01.local. Local service cookie is 1032175040.
Mar 30 10:02:41 s01 avahi-daemon[3600]: Files changed, reloading.
Mar 30 10:02:41 s01 avahi-daemon[3600]: No service file found in /etc/avahi/services.
Mar 30 10:02:50 s01 avahi-daemon[3600]: Files changed, reloading.
Mar 30 10:02:50 s01 avahi-daemon[3600]: No service file found in /etc/avahi/services.
adieball@s01:~$

根据此输出,它在 IPv4 和 IPv6 上注册。

使用 nmap 检查:

Starting Nmap 7.80 ( https://nmap.org ) at 2024-04-01 13:16 CEST
Nmap scan report for s01.f0rd42.local (192.168.119.121)
Host is up (0.0000040s latency).
Not shown: 997 closed ports
PORT      STATE SERVICE
111/udp   open  rpcbind
5353/udp  open  zeroconf
10000/udp open  ndmp

Nmap done: 1 IP address (1 host up) scanned in 0.10 seconds
adieball@s01:~$ sudo nmap -sU localhost
Starting Nmap 7.80 ( https://nmap.org ) at 2024-04-01 13:16 CEST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000040s latency).
Not shown: 997 closed ports
PORT      STATE         SERVICE
111/udp   open          rpcbind
5353/udp  open|filtered zeroconf
10000/udp open          ndmp

让我感到困惑的是,在对本地主机而不是其 IP 地址进行扫描时,显示的是“open|filtered”。不知道这是什么意思。为什么显示的是“zeronconf”而不是“avahi”?

adieball@s01:~$ ss -l -p '( sport = :5353 )'
Netid                State                 Recv-Q                Send-Q                               Local Address:Port                                 Peer Address:Port                Process                
udp                  UNCONN                0                     0                                          0.0.0.0:mdns                                      0.0.0.0:*                                          
udp                  UNCONN                0                     0                                          0.0.0.0:mdns                                      0.0.0.0:*                                          
udp                  UNCONN                0                     0                                          0.0.0.0:mdns                                      0.0.0.0:*                                          
udp                  UNCONN                0                     0                                          0.0.0.0:mdns                                      0.0.0.0:*                                          
udp                  UNCONN                0                     0                                             [::]:mdns                                         [::]:*                                          
udp                  UNCONN                0                     0                                             [::]:mdns                                         [::]:*           

avahi-browse 提供:

adieball@s01:~$ avahi-browse -v _hap._tcp
Server version: avahi 0.8; Host name: s01.local
E Ifce Prot Name                                          Type                 Domain
+ enp0s31f6 IPv6 HomekitServer 6A42                            _hap._tcp            local
+ enp0s31f6 IPv6 HomePodSensor 381340                          _hap._tcp            local
+ enp0s31f6 IPv6 HomePodSensor 418146                          _hap._tcp            local
+ enp0s31f6 IPv6 HomePodSensor 969802                          _hap._tcp            local
+ enp0s31f6 IPv6 HomePodSensor 870291                          _hap._tcp            local
+ enp0s31f6 IPv6 HomePodSensor 627075                          _hap._tcp            local
+ enp0s31f6 IPv6 Philips Hue HomeKit                           _hap._tcp            local
+ enp0s31f6 IPv6 Basestation 5GP18C7TA13E6                     _hap._tcp            local
+ enp0s31f6 IPv4 HomekitServer 6A42                            _hap._tcp            local
+ enp0s31f6 IPv4 Basestation 5GP18C7TA13E6                     _hap._tcp            local
+ enp0s31f6 IPv4 HomePodSensor 627075                          _hap._tcp            local
+ enp0s31f6 IPv4 Homebridge 42AF 5A20                          _hap._tcp            local
: Cache exhausted
: All for now

据我所知,一切正常。顺便说一句:此处涉及的服务是“HomekitServer 6A42”

来自不同设备的发现结果(在同一网络上运行的 MacOS) 在此处输入图片描述

当尝试将 HomekitServer”添加到 iOS 上的 Homekit(smae 网络)时,我确实看到该设备可用,但当我尝试添加它时,它会永远尝试添加并以“不可用”结束。有趣的是:在此添加过程中,名称在 iOS 中更改为“Bridge”,而不是“HomekitServer”

注意:Ubuntu 和作为活动桥运行的 AppleTV 都通过同一网络上的以太网连接

我们非常欢迎任何有关进一步排除故障的帮助。

相关内容