openvpn-update-resolv-conf icon indicating copy to clipboard operation
openvpn-update-resolv-conf copied to clipboard

systemd: prefer VPN DNS entries

Open mathstuf opened this issue 5 years ago • 7 comments

By setting DNSDefaultRoute=true, the VPN link's DNS is preferred over the main connection's DNS entries.

mathstuf avatar Nov 09 '19 02:11 mathstuf

Hmm. This doesn't seem to quite do what I expected…hrm.

mathstuf avatar Nov 09 '19 02:11 mathstuf

@mathstuf can you confirm this ?

alfredopalhares avatar Nov 11 '19 14:11 alfredopalhares

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.

mathstuf avatar Nov 11 '19 15:11 mathstuf

Bu,t aren't you using /etc/resolv.conf ?

alfredopalhares avatar Nov 11 '19 15:11 alfredopalhares

Yes, but it is generated by systemd-resolved. It ends up with a mismash of my main Internet connection and the VPN DNS settings.

mathstuf avatar Nov 11 '19 15:11 mathstuf

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" } } ]

alfredopalhares avatar Nov 13 '19 14:11 alfredopalhares

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.

mathstuf avatar Mar 17 '20 14:03 mathstuf