Skip to content

Instantly share code, notes, and snippets.

@rogerwalt
Created August 27, 2018 07:36
Show Gist options
  • Save rogerwalt/96fccfc67eeaa8c7883d3984e7870cd8 to your computer and use it in GitHub Desktop.
Save rogerwalt/96fccfc67eeaa8c7883d3984e7870cd8 to your computer and use it in GitHub Desktop.
DNS OpenVPN Ubuntu Fail
Workaround from snabb, https://github.com/systemd/systemd/issues/6076
My current workaround is to do the following tricks every time I start my workplace VPN:
1. Find out the link number (a.k.a. interface index) of the ISP interface: systemd-resolve --status or ip l.
2. Connect the VPN.
3. Remove DNS settings from the ISP interface (using the link number from step 1) by sending a D-Bus command to systemd-resolved. This is an example using link number 2: sudo busctl call org.freedesktop.resolve1 /org/freedesktop/resolve1 org.freedesktop.resolve1.Manager SetLinkDNS 'ia(iay)' 2 0
4. Inspect with systemd-resolve --status to ensure that only the correct DNS servers are there.
Apparently there isn't any simple cli tool for managing systemd-resolved's settings. That busctl command isn't very user-friendly. :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment