jonathanio / update-systemd-resolved

Helper script for OpenVPN to directly update the DNS settings of a link through systemd-resolved via DBus.
Other
761 stars 94 forks source link

Ubuntu 20.04 DNS settings for tun0 device are reset after a period of time #89

Open hrkristian opened 3 years ago

hrkristian commented 3 years ago

This issue cropped up with Ubuntu 20.04. The update-systemd-resolve script works as expected, but after a whlie (cannot say for sure but anywhere from an hour to several) the settings are lost, as if reverting back to the state before the script was run.

There's nothing special to this install of Ubuntu (was upgraded from 19.10) so it seems strange more aren't having this issue, though there are two of us that I know of in the company I'm contracted with.

My settings are entirely standard:

script-security 2 up /etc/openvpn/scripts/update-systemd-resolved down /etc/openvpn/scripts/update-systemd-resolved down-pre

fuhsjr00 commented 3 years ago

I see this problem as well, though I have observed it on both Ubuntu 18.04 and 20.04.

My config is slightly different:

script-security 2 up /etc/openvpn/scripts/update-systemd-resolved up-restart down /etc/openvpn/scripts/update-systemd-resolved down-pre

gucki commented 2 years ago

I had the same issue. Solved it by enhancing the original script to periodically check and apply the DNS settings in the background. If you like, you can try my fork: https://github.com/gucki/update-systemd-resolved

tomeon commented 1 year ago

The up-restart directive may help with some causes of forgotten DNS settings, though evidently not all of them given this comment. If you don't currently have up-restart in your config, suggest that you add it and see if that helps address the issue.

What are you using to manage your network generally? For instance, NetworkManager, or systemd-networkd?