dns server priority in systemd resolve
I'd like to understand how the priority of the dns servers works in the systemd resolve service.
For instance, when I connect to the VPN, I get the DNS servers associated with the tun0 interface (systemd-resolve --status): Code:
Link 6 (tun0) Code:
Link 2 (wlp0s20f3) This is what I get when I tell the vpn client to "use this connection only for resources on its network". But when I uncheck this, so that all the traffic goes through the vpn, there's no DNS anymore for Link 2 (the internet facing interface): Code:
Link 2 (wlp0s20f3) So how can I actually tell what dns server is currently (default) being used without turning to tcpdump, for instance? |
dig will (should) report the IP address of the name server that handled the request.
Code:
dig -x 8.8.8.8 |
I think that happens only when you're not using systemd resolve as the dns daemon. If you've tried that on Centos 7, then it doesn't matter. Try it on Ubuntu 18 or 20, for instance. It might be the same on Centos 8, haven't tested it there. It will always show you 127.0.0.53#53.
|
The posted code is from this desktop, and uses the router...which is configured in turn to use the ISPs DNS.
I get a similar response from the server, except it returns the data center's DNS. Both are current CentOS 7.8 configurations. Neither is running a DNS daemon. |
systemd-resolved seems to work in different ways depending on the distro, but:
Quote:
On Centos 7 /etc/resolv.conf is an actual file, whereas on Ubuntu 18/20 (server and desktop) it's just a symlink to /run/systemd/resolve/stub-resolv.conf. On Centos 8 as see it's the same as on Centos 7. Regardless, as long as you don't have access to the command systemd-resolve, it really doesn't matter :) |
SO anyone any ideas yet? I find the situation a little bit ridiculous, you basically don't know what your main DNS Server is on systemd-resolve, if you get several from different sources. So what are the criteria?
|
So I've finally found the answer: by default systemd-resolve will query the dns server one after another:
Code:
root@ubuntu1:~# resolvectl dns Code:
root@ubuntu1:~# resolvectl domain |
All times are GMT -5. The time now is 02:46 AM. |