VPN Connector

One thing I have missed for some time in Windows, is the option to automatically connect to a VPN, as soon as access to the internet is created.

So to do that, I made my own little program.

I call it “VPN Connector”, because all it does, is to activate the defined VPN connection.

In this first picture, I am home and using my own WiFi network to go online, this is a network I trust, and I got access to my LAN through this connection.
Logging on the VPN while already being on the network would be meaningless, so the program can validate it’s IP to see if it home or not.

Here I am using my iPhone 4 to go online, and the program will then detect that there were changes made to the network addresses, and it will then again validate it’s IP, and if not home, then initiate the dial to the VPN.

Real IP
  • This is the IP you are connected to the internet through.

VPN IP
  • All traffic on the internet will be seen as this IP, and this is also the IP with the VPN server.

Client
  • When logged on the VPN, this will show your IP in the local network behind the VPN server

Server
  • The IP of the VPN server on the local network.

Routine

When the program is started, it will check if it is connected to the internet, and if not, then start a 5 second timer, and ping an address every 5th second to see if it got a connection.

If it detects a connection, it will get it’s IP (External), and start to connect to the defined VPN connection. If it can’t find the connection, it will ask if you want to create it, and if you select Yes, it will create the VPN connection for you (if you filled the details into the configuration file).

After the connection is created, it will try to connect to it, and if successful, both dots will turn green under “Internet” and “VPN”, and it should then also show the IP you got on the VPN. After connected to the VPN it will check the external IP again, and you should then be able to see the external IP of the VPN server, instead of your own IP.

Configuration
#VPN Connector configuration

#Name of the connection used to connect to the VPN server
vpnName = NG28

#Username for the VPN server
vpnUser = username

#Password for the VPN server
vpnPass = password

#Home IP address
homeIP = 192.168.1.

#The following is only needed if you want the program to create the VPN connection automatically

#The external address of the VPN server
vpnAddr = bld.got-vpn-server.com

#Advanced configuration
koInternetTimer = 5000
okInternetTimer = 1000

vpnName

  • This is where you write the name of the vpn connection. You can either make the program create it, by filling in the info in the bottom of the configuration (vpnAddr, vpnUser, vpnPass), or you can create it yourself, and make the program activate it.

vpnUser

  • The username to log on with

vpnPass

  • The password to log on with

homeIP

  • You can put the entire IP in here, or a part of it. You can get your home ip by looking at “Real IP” in the program window, or by going to http://bld.is-a-geek.com/ping.php, when this IP is recognized as your home IP, it will cancel the dialing process

vpnAddr

  • If you want the program to create the VPN connection, you need to give it the address, the username and password. vpnAddr is the external address of the VPN server.

To do: (before released)

  • Save/Load configuration
  • Custom settings
  • Custom ping service
  • More testing
  • Add more than PPTP as only option for creating the connection

See how it works here

Leave a Reply