alfredopalhares / openvpn-update-resolv-conf

Script that updates DNS settings are pushed by the OpenVPN server
462 stars 129 forks source link

What if I need and have systemd-resolved disabled? #37

Open ikwyl6 opened 2 years ago

ikwyl6 commented 2 years ago

I'm running dnsmasq on my server and in order to do this I need to disable systemd-resolved for it to work properly and resolve internal and external IPs. So if I have this disabled (resolved), is there a way to still have this script update or restart openvpn when I get a disconnection and then a re-connection? My main issue if my /etc/resolv.conf gets updated when openvpn starts to use the vpn's DNS IP, but when there is a lag in ping and openvpn wants to restart, it doesn't update the /etc/resolv.conf to be my service provider's DNS IP and it doesn't resolve the vpn's connection IP because it's using it's internal IP from resolv.conf.

ap-wtioit commented 2 years ago

I had another related issue, that i resolved by adding the hosts to be resolved when vpn is restarting to /etc/hosts. But i think your wanted behaviour can be triggered by --up-restart which according to the manual should trigger the down and up scripts also for restarts. Found this via https://superuser.com/a/975365/458656 and that sounds like it could work.