Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Gisle Vanem Newsgroups: comp.lang.python Subject: Re: Testing whether the VPN is running? Date: Tue, 23 Feb 2016 10:40:27 +0100 Lines: 22 Message-ID: References: <8ghgpcxrd3.ln2@news.ducksburg.com> <20160223082445.GA73615@cskk.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de cJTJ44jgbnIRaSjlQel8rQPcvrB3C+zIhJ9Lw1fg14Hg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.078 X-Spam-Evidence: '*H*': 0.84; '*S*': 0.00; 'imply': 0.07; 'skip:\\ 30': 0.09; 'output': 0.13; 'received:io': 0.16; 'received:psf.io': 0.16; 'ssh': 0.16; 'too?': 0.16; 'vpn': 0.16; 'hack': 0.18; '(not': 0.20; 'windows': 0.20; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'linux': 0.26; 'turns': 0.27; 'device': 0.28; 'interface': 0.29; 'btw,': 0.29; 'query': 0.30; 'up.': 0.32; 'could': 0.35; 'but': 0.36; 'tool': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'test': 0.39; 'subject:the': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'address': 0.61; 'default': 0.61; 'back': 0.62; 'personal': 0.63; 'received:46': 0.63; 'cameron': 0.66; 'from:addr:yahoo.no': 0.84; 'message- id:@yahoo.no': 0.84; 'route': 0.84; 'subject:Testing': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.no; s=s2048; t=1456220421; bh=LtFmuvGmU+kynBnzaCvdY4WTRUo3pgu3EjJRG61j07k=; h=From:Subject:To:References:Date:In-Reply-To:From:Subject; b=O82PjhT2agH2T+Q6YUSAQY+V6VA4YCz4O7w4+vTySQMTJE7ME21sntmPHSwxT1Uf6jRAOKCpMAGzUL7FkhfbBveXBrVM4s24NZk0Vuc95KnsayWaz5FRcF7n0rAhwbnSZJ5Tc+DAUEPB2aAvZf+61uw/yuxlGST6oazvTgmyU9QlT3y6rvGRTx88KKmGS+hczlkFLNMdVGhCnrTYfS/Bz4fm8LzT/l4wulzF3TG66JbWBW5Tuq0+0qEZ5DmFMs6DMxv71lf+0saL8rVakyOgkOnRph+jpzOfN57aFHuEI3tiOyAhGHsxmDRpvGZFa5MIwGs2yFdAtKgVul4gSzg0sw== X-Yahoo-Newman-Id: 233930.56665.bm@smtp109.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: EEvxpdMVM1mpi74DqSZyNJ64c8flU2YeL3yaFtyd0PT6Um9 B1fD96MA_LnlbEnnwAAVZZ8aszz_gQFrC4dFD6QpEq5zhk5j.7CmJRgtV._6 Lb7xZ6sNFPHNIceOpxJN189DyuN2dJNLTr.25Yj8YPRA6wktO3lzs5NMAvbX vvuAQGBWDAidzD7rhSfH3PqSq6TAN9JDkPyKVdcUzOKS43selThQnvZpc5sk pPJMhVhNTYLaUvkjrfFvl0RBm4A5r5CA3hA3636veQIlTLV15pUfIhS411TB 7ztsy8geR1bhJwGjGdJY15hYxHQckaAroMacgjNtaMCr1RhNsKBqFs550krd BtO_57WZIFXrlsZFt4dZvKw8jcx7FnDEwOm569lh1IrEtI7OEYJ37QRzENRv yDbElMSgelBOcv7p3ytNOyItTIHf1HGq0YatYY3bO7lC6sOgajaWRRBLoRDq DcrcG39aTPNnZ4CawNk20lF61aa9p6kfxxb.dkCamEenY719KJu1RpJ1MR.e FJAwtt45fzBB36BItpBLd0fO1Gn2Ghfirfy.I X-Yahoo-SMTP: 8zhYLGyswBB3AGU8c4pvFIFOfA-- User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: <20160223082445.GA73615@cskk.homeip.net> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:103400 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