RAS Dialer Helps Manage Temporary VPN Connections

by Andrew Barber 4. October 2010 07:50

As an "end-to-end" web developer, I am often tasked with deploying web sites, and managing the servers upon which they run day-to-day. When those servers are hosted in ideal situations, I need to make a Virtual Private Network (VPN) connection to access these functionalities, in order to gain access through the firewall. To speed up this access as well as disconnecting from such resources, I wrote an extremely simple WinForms app in C#.

Lazy Developer

When I consider any task that is done lots of times, whether that be executing a set of code in a loop or typing the same things repeatedly during my day, I always seek ways that I can eliminate some time from each iteration. Clicking an icon in the notification bar, choosing a menu item, right-clicking and then choosing another item to connect - and then a similar process for disconnecting - does not seem like much. But it does add up! Also, though; sometimes a VPN connection may require some custom route commands in order to use the connection without having it be used for all Internet activity. By default, a new VPN connection in Windows will be set so that all your network activity goes through it. One of the connection options allows you to change this, but if the destination private network is more complex than a single subnet, you will then need to issue custom route commands to use the connection in this manner.

Using RASDial

RASDial (link) is a built-in Windows command that can make it easy to script a connection to a VPN or dial-up connection in Windows. You can then use the route (link) command if you need to set up custom routing as noted above. Both of these could be put into a .bat file or run in a script. But I was looking for an extra bit of help, too; to be able to very quickly disconnect when I'm done.

Security Warning

Using RASDial or the RASDialer program I have here can expose your VPN user names and passwords in clear-text in plain files on your computer. I strongly recommend assuring these files are stored in a way that protects them appropriately, and I recommend against ever using these methods of connecting to a network which does not have additional security in place beyond simply being connection to the private network at all. You have been warned!

RASDialer Tool

RASDialer is a tiny program I created which assists in quickly making RAS connections, and then quickly disconnecting them when done. It uses text files to configure the connection being made, and required route commands, if needed. A simple progress window is displayed while the program starts up. Once it starts the connection, it minimizes to an icon in the notification area. This icon can be double-clicked to shut down the connection, or right-clicked to see other options; to reconnect, or exit the program without disconnecting. An example/default RASDialer.txt file is included, and it includes instructions for use.

The program is executed by creating a shortcut to it, and passing as the sole argument the path to your connection information file. The idea here is that you create a shortcut somewhere in your Start menu, and name the shortcut such that you can quickly press your Windows/Start key in Vista/Win7 and type the name of your shortcut to quickly make the connection in a few keystrokes, without having to touch the mouse at all. If you execute the program without providing a connection information file path, it looks by default for a file called RASDialer.txt in the current directory.

Download/Other Info

RASDialer is written in C# using the .NET Framework version 3.5. The download ZIP includes the binary, and a Visual Studio 2010 project.

RASDialer.zip (514.68 kb)

Comments are closed

Links/Profile

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent those of my partners, clients or contractors in any way.

© Copyright 2012 AndrewBarber.com