0

I am running openvpn client in my system which connects to remote openvpn server via Internet. My system is connected to two networks (multi homed) wlan0 and ppp0. Both provides internet connectivity to my system but not simultaneously. At any point of time, either wlan0 or ppp0 will be used as default gateway.


The issue is after openvpn client connected with server when i change the default gateway manually from wlan0 to ppp0 or vice versa, the openvpn client disconnect with server and restarts the connection. The following is the log when the disconnection happens.

Fri Nov 13 15:26:37 2015 write UDPv4 []: Network is unreachable (code=101)
Fri Nov 13 15:26:43 2015 [UNDEF] Inactivity timeout (--ping-restart), restarting
Fri Nov 13 15:26:43 2015 TCP/UDP: Closing socket
Fri Nov 13 15:26:43 2015 SIGUSR1[soft,ping-restart] received, process restarting
Fri Nov 13 15:26:43 2015 Restart pause, 2 second(s)

My question is what is the reason behind disconnection and reconnection? and is there any way i could change default gateway without making openvpn client to restart?

2
  • You are basically changing your default gateway. That pretty much means dropping all connections using the old one, so no - there is no way to maintain the connection if you switch connections. It might work if both connections are up at the same time and you drop one of them. If so, you could switch by bringing both connections up and then taking down the one you don't want. At least it could work via bonded or bridged interfaces.
    – MrMajestyk
    Nov 13, 2015 at 10:45
  • @MrMajestyk I would like to know the reason behind openvpn client restarts. Why can't it just use new default gateway and continue ? Why it need to be restarted ? By the way i use udp for OpenVPN instead of TCP, hence the all communication between VPN server and client will be connectionless.
    – Kumar
    Nov 16, 2015 at 6:30

1 Answer 1

0

It's impossible , because you use two differents gateways and of course when you change one of them your VPN restart again, it's a part of process. To create a game like that you need a double openvpn always active one for each connection , then you need a script to change the rule on-the-fly, and use transparent NAT then you never lost the session also if you use VOIP or others real time protocols. Hope it helps! Regards

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.