[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Web openvpn.net

Re: [Openvpn-users] How to make 2.0.x conditionally connect?

  • Subject: Re: [Openvpn-users] How to make 2.0.x conditionally connect?
  • From: Alexander Hoogerhuis <alexh@xxxxxxxx>
  • Date: Sat, 15 Dec 2007 22:25:34 +0100

Jan Just Keijser wrote:
> Use an
>   --up cmd
> script. This script is called as
>   cmd tun_dev tun_mtu link_mtu ifconfig_local_ip ifconfig_remote_ip [ 
> init | restart ]
> If the command exits with an error code openvpn aborts. So if you write 
> an 'up' script that does something like
> echo "%4" | find "192.168.1"
> if errorlevel 1 exit 0
> exit 1
> then the 'up' script will abort if the local IP is not in the 192.168.1 
> range; this should cause openvpn to stop attempting to connect. It will 
> mean that your openvpn log file will see some errors when you're at home.

As far as I gather, this will run after a successful connect and the 
TUN/TAP interface has been opened. I'm looking for something that could 
do this prior to attempting the connect. Also, this would not run if it 
fails to connect, and in case the laptop is on a customer LAN with a 
closed down firewall, it would then loop and continue to hit the 
firewall, which at some point would get me un[wanted|needed] attention.

> HTH / groetjes,
OpenVPN mailing lists