Python Script to dial a VPN connection, automate VPN routing table updates.

Rolander, Dan Dan.Rolander at
Fri Mar 23 21:04:15 CET 2001

Have you looked at the win32ras module? There is a Dial method.

Also, I have Windows 2000 with a VPN connection to my office over DSL. I
don't have to "dial" to setup a connection. I just use my LAN. Not sure
what's going on with your setup. Perhaps it's due to your client. I use
CheckPoint SecuRemote.


-----Original Message-----
From: Warren Postma [mailto:warren-postma at]
Sent: Friday, March 23, 2001 2:38 PM
To: python-list at
Subject: Python Script to dial a VPN connection, automate VPN routing
table updates.

Sorry for the nearly-off-topic nature of this post, but ....

I work from home now, and there's something in Windows 2000 that's
annoyingly manual:

I have a permanent internet connection via @home cable modem, and I "dial"
through that to create a VPN connection to the office.  The problems are

(1) Windows won't accept or save my userid, password and the domain name, so
I have to enter it manually.

(2) After connecting, I have two default gateways in my routing tables
(ROUTE PRINT) and I need to update it so only the traffic that is destined
to the office goes through that interface.  The IP addresses I get given are
different each time, making a batch file insufficient, so voila, a perfect
use for python.

So after solving #2 above in Python, I wondered, does anyone know how, in
Python win32 extensions, one might dial an RAS connection, and if it's
possible to do so  through the win32 API somewhere or through COM? Then I
could solve #1 above as well.

Anyone else think this might make a nice little Python applet if I build in
some more VPN/RAS stuff and maybe even Gui-fy it a bit in wxPython or

Warren Postma


More information about the Python-list mailing list