avahi-browse -a does not show any results
I have avahi-daemon
running on a Debian 9.1 server; however, avahi-browse -a
does not display any services in my home network, consisting of a single 192.168.178.0/24
network.
I can access all clients (tested with ping
and, where applicable, ssh
) and
server# tcpdump port 5353
gives quite a bit of output from my clients, e.g.,
15:30:07.206879 IP Client-OSX.fritz.box.mdns > 224.0.0.251.mdns: 0 [20a] [9q] PTR (QM)? _services._dns-sd._udp.local. PTR (QM)? _http._tcp.local. PTR (QM)? _ipp._tcp.local. PTR (QM)? _pdl-datastream._tcp.local. PTR (QM)? _printer._tcp.local. PTR (QM)? _scanner._tcp.local. PTR (QM)? _privet._tcp.local. PTR (QM)? _http-alt._tcp.local. PTR (QM)? _ssh._tcp.local. (847)
However, my clients do not see my server nor the other way around, but the clients see each other’s services, e.g.,
client1# avahi-browse -a
+ enp0s25 IPv6 client2 SSH Remote Terminal local
+ enp0s25 IPv4 my-printer _privet._tcp local
...
/etc/avahi/avahi-daemon.conf
:
[server]
host-name=alexandria
#domain-name=local
browse-domains=fritz.box
use-ipv4=yes
use-ipv6=yes
allow-interfaces=eno1 eno2
# deny-interfaces=eth1
# check-response-ttl=no
# use-iff-running=no
enable-dbus=yes
# disallow-other-stacks=no
allow-point-to-point=yes
# cache-entries-max=4096
# clients-max=4096
# objects-per-client-max=1024
# entries-per-entry-group-max=32
ratelimit-interval-usec=1000000
ratelimit-burst=1000
[wide-area]
enable-wide-area=yes
[publish]
disable-publishing=no
#disable-user-service-publishing=no
#add-service-cookie=no
publish-addresses=yes
publish-hinfo=no
publish-workstation=no
publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
publish-resolv-conf-dns-servers=yes
publish-aaaa-on-ipv4=yes
#publish-a-on-ipv6=no
[reflector]
enable-reflector=yes
#reflect-ipv=no
[rlimits]
#rlimit-as=
rlimit-core=0
rlimit-data=4194304
rlimit-fsize=0
rlimit-nofile=768
rlimit-stack=4194304
rlimit-nproc=3
Clients run Kubuntu 16.04 and macOS.
What am I missing?
avahi-browse requires the libnss-mdns
package and the /etc/nsswitch.conf
must have in its hosts:
line two entries mdns mdns4
appended, i.e.
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns
I also added multicast to the interface by first installing net-tools
to get ifconfig
and then running
server$ ifconfig eth0 allmulti
In order to make your server visible tu Ubuntu clients, in the debian avahi daemon config file, change
publish-workstation=no
to
publish-workstation=yes
Next restart avahi-daemon
service.
After months of this not working on my laptop, I realised the issue was iptables… (In my case, had to check iptables-legacy
specifically!)
Because I connect it to conference and other public networks sometimes, having firewall rules seemed sensible. But if those block 5353/udp packets, then yeah mDNS isn’t going to work when I’m at home.
No clue whether this was your problem 4-5y ago, but … this result shows up high in "avahi sees no hosts". Hopefully my comment is going to help someone some day.
On Rocky Linux 9 (RHEL, CentOS) avahi-browse didn’t show anything for me because by default mdns is not allowed by firewall for the zone "public" which is assigned to any wireless connection.
I had to reassign my wi-fi to firewall zone "home" by running:
sudo firewall-cmd --zone=home --change-interface=wlp8s0f3u4
where "wlp8s0f3u4" is my wi-fi interface name. You can get it from
ip a
It should have a name starting with "wl"