Force Windows Service to Connect in Specific Order

How to customize and extend your OpenVPN installation.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
User avatar
drmacinyasha
OpenVpn Newbie
Posts: 1
Joined: Sun Aug 19, 2012 5:28 pm
Location: Sacramento, CA
Contact:

Force Windows Service to Connect in Specific Order

Post by drmacinyasha » Sun Aug 19, 2012 5:42 pm

Howdy folks,

I've managed to setup a pair of VPNs on separate networks: One for encrypting my web traffic (for when connecting at public hotspots, etc., let's call it VPN "A"), and one for accessing a private network for remote server management (VPN "B"). Both work fine, and have zero issues on any clients I've tried.

Now for the tricky part: My main portable computer is a Windows 7 laptop. My goal is to have both VPNs connect automatically at start-up via the OpenVPN service. I can launch them manually via OpenVPN-GUI, but that requires that I use admin credentials, and doesn't protect me prior to logging in, and starting up the GUI. I can start either one automatically via the service without issues, and all's well.

The problem lies in starting them both via the service simultaneously. VPN B is sitting on a server which is a good deal faster, and so it completes its authentication and connection before VPN A. VPN A then finally connects, and traffic which should get sent over VPN B, gets sent to VPN A... And just dies since B isn't going out over A.

What I'd ideally like to do is force some sort of delay or condition on VPN B, so that it starts connecting X number of seconds after VPN A starts, when both are launched via the Winows OpenVPN Service. Is there a way to do this, or possibly insert some kind of wait timer in VPN B, so that even if I'm not using VPN A (eg, I'm hardwired at home) it has to wait so many seconds after starting before it tries to connect?
One man, a lone admin, against the horde of sanity-crushing users...
Founder of Goo.im - Premium Android Developer File Hosting

Post Reply