[systemd-devel] Replacing nss-mdns with resolved

Dan Williams dcbw at redhat.com
Fri Sep 29 15:50:01 UTC 2017


On Fri, 2017-09-29 at 16:45 +0200, Sven Köhler wrote:
> Hi,
> 
> I want to replace nss-mdns with systemd-resolved. However, I am using
> NetworkManager, not systemd-networkd. NetworkManager is configured to
> pass all DNS-related information to systemd-resolved.
> 
> Unlike networkd, NetworkManager does currently not allow to configure
> the per-link MulticastDNS setting. Also, resolved.conf doesn't allow
> to
> change the default of the per-link MulticastDNS setting. Since the
> default is "no", MulticastDNS is essentially disabled for all links.
> 
> Is NetworkManager expected to configure the per-link settings?
> Are you thinking about adding a way to change the per-link defaults?

NM only knows about the DNS information it receives from upstream
servers or that's statically configured.  It doesn't do anything with
mDNS because that's not something that's provided by your DHCP server
or IPv6 router.

But systemd-resolved provides a full-featured D-Bus interface (which is
actually how NM sends the info to resolved) which you can easily use to
poke the setting, in combination with NM "dispatcher" scripts that run
whenever a link goes up or down or changes.  This is the entire point
of "dispatcher" scripts, to run custom events of your choice that NM
doesn't need specific options for.

Drop a small dispatcher script (see 'man NetworkManager' for details)
into /etc/NetworkManager/dispatcher.d which does something like:

#!/bin/bash
if [ "$2" != "up" -a "$2" != "dhcp4-change" ]; then
    exit 0
fi

IFINDEX=$(cat /sys/class/net/${DEVICE_IP_IFACE}/ifindex
dbus-send --system --print-reply --dest=org.freedesktop.resolve1 \
    /org/freedesktop/resolve1 \
    org.freedesktop.resolve1.Manager.SetLinkMulticastDNS \
    int32:${IFINDEX} string:yes

Yeah, that gets run every time the interface comes up, while it would
be better to just run that command when the interface is first known to
the kernel.  You could do that with udev rules pretty easily too.  But
doing it with NM dispatcher scripts allows you to control *which*
networks you want this enabled for, so that you can do it for your home
network but not a coffee shop (using the CONNECTION_UUID environment
variable).

Dan

> Running networkd just to configure the per-link settings seems
> redundant, but how would I configure networkd, so that it gets along
> with NetworkManager?
> 
> 
> Kind Regards,
>   Sven
> 
> 
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list