Testing whether the VPN is running?

Gisle Vanem gvanem at yahoo.no
Tue Feb 23 04:40:27 EST 2016


Cameron Simpson:

> You might also want to check that the interface is up.
> 
> My personal hack (not for a VPN, but for "being online", which turns my ssh tunnels on and off) is to look in the output
> of "netstat -rn" for a default route. This may imply that an alternative test for you is to test for a route to your
> VPN's address range?  Just an idea.

And for VPN in Windows *and* using WinPcap, one can check if this device
exist:
  \Device\NPF_GenericDialupAdapter

(controllable using 'sq query rasdial'). This works if you use
PPTP or L2TP but not OpenVPN.

BTW, a VPN on Windows doesn't come back up automatically after
a sleep/hibernation. The WOSB tool at http://www.dennisbabkin.com/wosb/
could be handy. What happens with your VPN on Linux (?) after coming
back from sleep/hibernation? Automatic or you need to script that too?

-- 
--gv


More information about the Python-list mailing list