openvpn-update-resolv-conf
openvpn-update-resolv-conf copied to clipboard
systemd: prefer VPN DNS entries
By setting DNSDefaultRoute=true
, the VPN link's DNS is preferred over the main connection's DNS entries.
Hmm. This doesn't seem to quite do what I expected…hrm.
@mathstuf can you confirm this ?
I couldn't get resolved to actually put the VPN entries first. It seemed like it worked, but I suspect some hash-based or pointer-based sorting letting me get lucky sometimes.
Bu,t aren't you using /etc/resolv.conf
?
Yes, but it is generated by systemd-resolved
. It ends up with a mismash of my main Internet connection and the VPN DNS settings.
Can you elaborate on your setup? Maybe this would need some work.
[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": " https://github.com/alfredopalhares/openvpn-update-resolv-conf/pull/31?email_source=notifications\u0026email_token=AABWUE6H3XTBER7YVDBUQ23QTF3CBA5CNFSM4JLCFUY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDXFUFI#issuecomment-552491541 ", "url": " https://github.com/alfredopalhares/openvpn-update-resolv-conf/pull/31?email_source=notifications\u0026email_token=AABWUE6H3XTBER7YVDBUQ23QTF3CBA5CNFSM4JLCFUY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDXFUFI#issuecomment-552491541 ", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
So it seems the proper way to do this is to call resolvectl dns
and resolvectl domain
to set up the DNS entries in the right order.