restart openvpn from virtual machine

This forum is for general conversation and user-user networking.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
bv_hk
OpenVpn Newbie
Posts: 1
Joined: Mon Jul 31, 2017 5:43 pm

restart openvpn from virtual machine

Post by bv_hk » Mon Jul 31, 2017 6:42 pm

Hi,

First let me explain my setup:

I have a QEMU/KVM image and installed Lubuntu 16.04 on it.
Linux tv-VirtualBox 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Version of openvpn:

Code: Select all

OpenVPN 2.3.10 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Jun 22 2017
library versions: OpenSSL 1.0.2g  1 Mar 2016, LZO 2.08
Originally developed by James Yonan
Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
Compile time defines: enable_crypto=yes enable_crypto_ofb_cfb=yes enable_debug=yes enable_def_auth=yes enable_dependency_tracking=no enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown enable_fast_install=yes enable_fragment=yes enable_http_proxy=yes enable_iproute2=yes enable_libtool_lock=yes enable_lzo=yes enable_lzo_stub=no enable_maintainer_mode=no enable_management=yes enable_multi=yes enable_multihome=yes enable_pam_dlopen=no enable_password_save=yes enable_pedantic=no enable_pf=yes enable_pkcs11=yes enable_plugin_auth_pam=yes enable_plugin_down_root=yes enable_plugins=yes enable_port_share=yes enable_selinux=no enable_server=yes enable_shared=yes enable_shared_with_static_runtimes=no enable_silent_rules=no enable_small=no enable_socks=yes enable_ssl=yes enable_static=yes enable_strict=no enable_strict_options=no enable_systemd=yes enable_win32_dll=yes enable_x509_alt_username=yes with_crypto_library=openssl with_gnu_ld=yes with_mem_check=no with_plugindir='${prefix}/lib/openvpn' with_sysroot=no
NAT connection with the host - device model - virtio

---------------

I start openvpn from command line :

sudo openvpn pia_host.ovpn and then start my browser and some other online services.

Works quite well, but the problem starts when my host has a connection issue. If network connection from the host drops, then client stops as well due to timeout and doesn't automatically restarts when the host is working again.

example:

Code: Select all

18:07:49 2017 Inactivity timeout (--ping-restart), restarting
18:07:49 2017 SIGUSR1[soft,ping-restart] received, process restarting
18:08:31 2017 RESOLVE: Cannot resolve host address: pia_host.privateinternetaccess.com: Temporary failure in name resolution
the last line is then being repeated endlessly.

The method I currently use is
sudo killall openvpn (security risk..). Wait a while until ping 8.8.8.8 gives some feedback and then start openvpn again.

Because my internet connection is currently very unstable (something I will have to check with my provider - I don't trust the modem) restarting is needed often.

So my question:

Is there a method to automatically restart openvpn without killing it first or make the connection wait longer (maybe even 5 minutes) before it times out? Any advise is appreciated.

Thanks.

Post Reply