Raspbian - OpenVPN checking and automatical reconnect

Weekly dev snapshots are available for testing.
We talk about them here. Testing features in the dev snapshot helps the features make it to stable.
Forum rules
Please report your experience with testing branch. Include what you were using and how
If there is a problem, the more info the better!
Post Reply
OpenVpn Newbie
Posts: 1
Joined: Mon Jul 01, 2019 7:38 am

Raspbian - OpenVPN checking and automatical reconnect

Post by sunshineh » Mon Jul 01, 2019 10:55 am

OpenVPN is running on my new raspbian installation.
How can I be sure, that it is running correctly and how can the internet traffic be stopped, when the connection is broken? Is there a tool for it?

OpenVpn Newbie
Posts: 2
Joined: Fri Feb 23, 2018 9:53 am

Re: Raspbian - OpenVPN checking and automatical reconnect

Post by fdisk » Sat Aug 31, 2019 9:43 pm

This solutions works for me for ages:

1) delete defaultroute on your vpn client machine
2) add static host routes for every single vpn endpoint

Code: Select all

ip route add your.vpn.server.ip/32 via ip.of.gate.way dev eth0
3) use vpn providers dns with update-resov-conf script to prevent dns leaks

Keep in mind that you are not be able to resolve anything unless you are connected to vpn. To get around this you may need to:
- replace fqhn in openvpn configuration by their according IPs
- edit /etc/hosts and add according entry

This way full internet access is only available while vpn is successfully connected. As soon as vpn is off or fails to connect there will be no access (including DNS) but to hosts having host routes (which are required to connect to tunnel).

OpenVpn Newbie
Posts: 3
Joined: Sun Sep 29, 2019 5:12 pm

Re: Raspbian - OpenVPN checking and automatical reconnect

Post by JastrebJ21 » Mon Sep 30, 2019 5:43 am

Okay, thanks for the explanation, this will help me with my home automation network!

Post Reply