Discussion:
[avahi] Multiple DHCP connected interfaces, avahi-daemon only "listens" on one
Jason Heeris
2018-06-11 06:14:26 UTC
Permalink
I've got an Ubuntu 18.04 (avahi-daemon 0.7-3.1ubuntu1) machine with
three interfaces: enp1s0f0 (PCI eth), wlp2s0 (PCI wifi),
wlx485d601f9b83 (USB wifi). Everything's managed via Netplan (no
Network Manager or ifupdown). The machine is used to connect an
eth-only device to the local wifi network by masquerading over
wlx485d601f9b83. At the moment enp1s0f0 has a static config, and both
wifi interfaces are DHCP configured. Due to some Netplan's limitations,
I have some duplicate routes that look like:

$ ip route show
default via 192.168.1.1 dev wlx485d601f9b83 proto dhcp src 192.168.1.3
metric 600
default via 192.168.1.1 dev wlp2s0 proto dhcp src 192.168.1.100 metric
600
192.168.1.0/24 dev wlx485d601f9b83 proto kernel scope link src
192.168.1.3
192.168.1.0/24 dev wlp2s0 proto kernel scope link src 192.168.1.100
192.168.1.1 dev wlx485d601f9b83 proto dhcp scope link src 192.168.1.3
metric 600
192.168.1.1 dev wlp2s0 proto dhcp scope link src 192.168.1.100 metric
600

My problem is this: I want Avahi to only use the PCI wifi interface
(wlp2s0). But if I put "allow-interfaces=wlp2s0" in
/etc/avahi/avahi-daemon.conf, suddenly I can't resolve any .local
addresses.

Before changing (ie. with no settings for either "allow-interfaces" or
"deny-interfaces"):

$ avahi-resolve --name -4 han.local
han.local 192.168.1.101

After "allow-interfaces=wlp2s0" and a restart of Avahi:

$ avahi-resolve --name -4 han.local
Failed to resolve host name 'han.local': Timeout reached

It still seems to be broadcasting though. Even after leaving it like
this for hours, I can still resolve *back* to the machine itself from
other machines, to the correct (wlp2s0) interface.

If I remove the "allow-interfaces" line, it's not a huge problem.
Issues are simply that (a) I want to keep non-masquerade traffic off
the interface and (b) for a brief moment during boot or restarting
certain services, the machine's broadcast name resolves to the address
of the wlx485d601f9b83 interface instead of the wlp2s0 interface.

But I'd really like to know what I'm doing wrong here. It seems like a
simple config change, but it's definitely not having the effect I
expected.

Cheers,
Jason
Jason Heeris
2018-06-11 09:12:49 UTC
Permalink
I was wrong about this. With "allow-interfaces=wlp2s0" it fails to
broadcast in a way that is picked up by other machines. I was seeing
cached results due to repeated restarts while I was testing. With that
setting removed, it *does* broadcast, and the name resolves to the
wlp2s0 IP address.

- Jason
Post by Jason Heeris
It still seems to be broadcasting though. Even after leaving it like
this for hours, I can still resolve *back* to the machine itself from
other machines, to the correct (wlp2s0) interface.
Loading...