Ubuntu 20.04 DNS settings for tun0 device are reset after a period of time
hrkristian opened this issue · 3 comments
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
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
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
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?