You maybe have noticed that you can configure DNS servers in your systemd-networkd settings, but these addresses don’t appear in
/etc/resolv.conf. You need to enable/start systemd-resolved, this daemon checks global DNS settings in
/etc/systemd/resolved.conf, DNS settings for each link from systemd-networkd + DNS stuff that comes from a DHCP server and writes everything into
/run/systemd/resolve/resolv.conf. You need to create a symlink to your
/etc/systemd/resolved.conf, then everything works as expected:
root@ci ~ # systemctl enable systemd-resolved
Created symlink from /etc/systemd/system/multi-user.target.wants/systemd-resolved.service to /usr/lib/systemd/system/systemd-resolved.service.
root@ci ~ # systemctl start systemd-resolved
root@ci ~ # systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2016-05-13 13:48:31 CEST; 2s ago
Main PID: 13897 (systemd-resolve)
Status: "Processing requests..."
Tasks: 1 (limit: 512)
May 13 13:48:31 ci.virtapi.org systemd: Starting Network Name Resolution...
May 13 13:48:31 ci.virtapi.org systemd-resolved: Positive Trust Anchors:
May 13 13:48:31 ci.virtapi.org systemd-resolved: . IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a418552
May 13 13:48:31 ci.virtapi.org systemd-resolved: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.arpa 17.
May 13 13:48:31 ci.virtapi.org systemd-resolved: Using system hostname 'ci'.
May 13 13:48:31 ci.virtapi.org systemd-resolved: Switching to system DNS server 22.214.171.124.
May 13 13:48:31 ci.virtapi.org systemd: Started Network Name Resolution.
root@ci ~ # cat /run/systemd/resolve/resolv.conf
# This file is managed by systemd-resolved(8). Do not edit.
# Third party programs must not access this file directly, but
# only through the symlink at /etc/resolv.conf. To manage
# resolv.conf(5) in a different way, replace the symlink by a
# static file or a different symlink.
root@ci ~ # rm /etc/resolv.conf
root@ci ~ # ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
root@ci ~ #