K
K
ks_ks2012-08-07 18:18:38
VPN
ks_ks, 2012-08-07 18:18:38

How to make VPN auto-connect when disconnected?

There is a problem - you need the VPN to be always on.
Sometimes, for unknown reasons, it cuts off.
It is necessary at such moments to generally turn off
access to the network, all running applications,
and when it rises, allow it again.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
Nikolai Turnaviotov, 2012-08-07
@foxmuldercp

this will not work with cisco vpn

A
Alexey Arakelyan, 2012-08-07
@gtbear

Remove the default route, prescribe the route to the VPN server. In this case, the Internet will be only if the VPN is alive and working. Otherwise, the system will not see a single byte from the Internet.

@
@ntkt, 2012-08-08
_

As I understand it, we are talking about a VPN that is used to tunnel all Internet traffic?
There will be no “make it hurt” button, but the solution is quite simple and straightforward.
1. To block traffic, we use either iptables, or editing routes, or openvpn.net/index.php/open-source/documentation/howto.html#redirect
1.1. For iptables, we form a task (like “to allow traffic on the localhost, as well as on the tun interface without any restrictions, but only on the IP of the VPN server”).
We write down the corresponding iptables rules.
google: iptables block non-vpn traffic
The rules of iptables are hung up on a script in autoload.
All. While there is no VPN, no one goes anywhere anyway, but as soon as you get up, get hurt.
1.2. To edit routes, go to the desired script / config, which services the raising of the interface, and edit it. To do this, you have to dig deeper into what NetworkManager does (it's just a wrapper).
1.3. openvpn.net/index.php/open-source/documentation/howto.html#redirect
Perhaps NetworkManager is doing this, I don't have bounty at hand to check.
But NetworkManager obviously pulls openvpn, and adds configs here askubuntu.com/questions/29086/where-are-vpn-configuration-files-imported-by-network-manager-saved
2. We smoke manuals and choose.
3. Depending on the chosen solution, we modify scripts in autoload or up- or down- or down-pre- openvpn scripts

A
admin4eg, 2012-08-08
@admin4eg

If the usual Windows VPN, then many years ago I did like this
www.odmin4eg.ru/2009/auto-vpn-connect/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question