In the systemd-resolved manual we can read something like this: The DNS servers contacted are determined from the global settings in resolved.conf(5), the per-link static settings in .network files, and the per-link dynamic settings received over DHCP.
1. Let's say that I have set all the three settings, which one will be applied? 2. If I set the global settings via the /etc/systemd/resolved.conf file, for instance: [Resolve] DNS=127.0.2.1 FallbackDNS=208.67.222.222 208.67.220.220 will this local resolver be used all the time, even when dhcp server sends an ip address of other resolver in the network to the client? I don't know how that is supposed to work, but it looks like it doesn't work in the way I thought it would. So I added some entries to this /etc/systemd/network/50-bond0-dhcp.network file: [Match] Name=bond0 [Network] Description=Bonded network DHCP=ipv4 LinkLocalAddressing=no DNS=127.0.2.1 IPForward=true [DHCP] UseDNS=false UseMTU=false SendHostname=true UseHostname=false UseDomains=true UseRoutes=true CriticalConnection=true RequestBroadcast=true And according to the systemd-networkd manual: DNS -- a DNS server address, which must be in the format described in inet_pton(3). This option may be specified more than once. UseDNS -- when true (the default), the DNS servers received from the DHCP server will be used and take precedence over any statically configured ones. (btw, the link to inet_pton is dead) So UseDNS is set to false, and I thought the system will be using the local resolver, but it sometimes uses the local settings and sometimes not -- it depends on restarting the systemd-resolved service, for example: # ls -al /etc/resolv.conf lrwxrwxrwx 1 root root 32 2015-02-27 23:52:39 /etc/resolv.conf -> /run/systemd/resolve/resolv.conf # cat /etc/resolv.conf nameserver 127.0.2.1 nameserver 192.168.1.1 search mhouse.lh # systemctl restart systemd-resolved.service # cat /etc/resolv.conf nameserver 192.168.1.1 nameserver 127.0.2.1 search mhouse.lh (I've cut the comments for readability) As you can see, the two resolvers just switched, and it seems that my system tries to use the 192.168.1.1 , but I disabled it for testing on my router. After I ping a domain, I have 10s lag, and then ping go there and back, so it falls back to the local resolver. 3. Shouldn't there be just one resolver in the /etc/resolv.conf file? 4. How to force the system to use the one particular resolver no matter what? I know I could probably do that by creating a static file instead of a link (and maybe chattr +i if necessary), but I want to do this using the systemd native tools if that is possible of course. 5. Is the /etc/resolv.conf file necessary when using systemd?
pgpkN7WA1Tn2p.pgp
Description: OpenPGP digital signature
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel