[systemd-devel] systemd-resolved service ignores UseDNS=false
mmorfikov at gmail.com
Tue Mar 24 20:20:28 PDT 2015
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
2. If I set the global settings via the /etc/systemd/resolved.conf file,
will this local resolver be used all the time, even when dhcp
server sends an ip address of other resolver in the network to
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
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
(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
# systemctl restart systemd-resolved.service
# cat /etc/resolv.conf
(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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 801 bytes
Desc: OpenPGP digital signature
More information about the systemd-devel