10

I know that systemd-resolve --status lists all my connections and their DNS servers and nmcli connection show <connection> | grep -i dns will list the priority of the DNS connections. But is there a single command I can run that will list all DNS servers and their priority/order?

15

It is stupid, but you can't!

systemd-resolved follows internal rules to choose the "correct" DNS. This might be different for each query. It uses things like if a server worked or failed in the past, interface order and even what domains allocated to each interface. It's difficult to manage with some VPN setups.

The best you can do is check the /run/systemd/resolve/resolv.conf file. That is the resolv.conf file generated by systemd-resolved.

1
  • I also gave up and install dnsmasq with rules to resolve some domains in certain servers (ie: internal DNS to the internal network dns server). This solved my problems using several VPNs and dns resolve order – higuita Jan 30 '20 at 20:48
0

It is possible to make a dns priority with

nmcli -p connection modify MY_VPN_CONNECTION ipv4.dns-priority -42

as taken from https://github.com/systemd/systemd/issues/6076

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.