-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto re-connect every time the conection drops. #31
Comments
Hi @githubtefo, When your wifi connection is reestablished, OpenVPN should eventually reconnect on its own. However this can take a while, so personally, I use the pkill_hup_openvpn script mentioned here. Sending the HUP signal to OpenVPN makes it try to reconnect right away. This is a solution if you're using NetworkManager, but you can achieve the same with dhcpcd-run-hooks if you're using dhcpcd. I would expect similar mechanisms to be available in other network managers. There is one case though, where the reconnection will not be possible and that's by design - when you change network devices. For instance, if you establish your VPN connection while on cable (eth0/eno0/etc.) and then switch to wifi (wlan0/etc.). In this case you will indeed have to use something like vpnfailsafe_reset.sh before reconnecting to the VPN. This is difficult to solve in vpnfailsafe itself, in a clean/simple, generally applicable and safe way (in addition to not being desirable to all users). It could be automated with a network manager hook though, with care being taken to avoid a leak when switching over. Which is your use case ? Are you changing devices ? |
Hi @wknapik, thank you for your reply. |
That should not be necessary. In fact it's a major goal for vpnfailsafe to make reconnections seamless and safe. Can you tell me what the problem is when you reconnect to your wifi network ? Can you share the OpenVPN log ? What does Let's start with that and we'll see where it goes. |
@wknapik, both pings have no respond when the connection drops out. This is the log in the terminal:
And this is the output when I kill the openvpn process (ctrl+c):
|
Hi @githubtefo, Those logs don't really help. I'm trying to establish what the exact problem is. You're saying you have no internet access after you reconnect to your wifi, but I need to know what exactly isn't working to be able to do anything about it. Is it the routing, is it the firewall, or maybe just name resolution... The next time you're connected to a VPN and you get disconnected and reconnected to your wifi network, please run the following commands and share the output:
Pasting the output here is fine by me, but if you'd rather not share it publicly, you can send me an email. My username at gmail is PS. You could also add |
Great, I sent the outputs via email. |
Hey. Sorry it took me so long to reply. I see the issue, but I'm not sure about the cause yet, it looks bizarre. I've actually used that provider before, without issues - reconnects worked just fine. I only used OpenVPN directly, without any additional applications, network managers, etc. Can you send me the OpenVPN config, or at least the Are you sure you're not using some other software that manipulates routes ? Like your VPN provider's application ? It looks like something is removing the route to your current VPN server, but there are additional routes to an IP vpnfailsafe never encountered, as far as I can tell from the logs. I have some theories, but I'd need the additional information. |
I use the default config files available in the webpage of my VPN. |
Hi! I've been using the script since a while and it works great, thank you!
But every time that my Wifi connection drops, I need to manually invoke a "clear iptables" script, followed by the command of openvpn with the vpnsailsafe script included:
sudo openvpn --config config.ovpn --script-security 2 --up /etc/openvpn/vpnfailsafe.sh --down /etc/openvpn/vpnfailsafe.sh
Is there any way to automatize this process when the connection is lost?
Thanks again!
The text was updated successfully, but these errors were encountered: