Saturday, November 7, 2015

OpenVPN connection

One of cool feature with OpenVPN is you could use multiple connection / configs with it. i.e. let's say you have 2 - 3 different config files for OpenVPN, you can configure GUI to use multiple connections for this.

Steps :

  1. Download and install latest OpenVPN GUI client  and TAP-for windows (https://openvpn.net/index.php/open-source/downloads.html): 
  2. With default installation GUI client will install one TAP interface for you, which should work for single connection at a time.
    1. For multiple VPN we need one tap device / connection
    2. "openvpn --show-adapters" will show current adapters list
    3. To add extra adapters use bat file "\Program Files\TAP-Windows\bin\addtap.bat"
  3. Now just Copy config files in "config" dir of openVPN, once you run openVPN GUI you will find all configs / connection available    


OpenVPN without username/password:

If you want to have password less login, then we can do that too.


  1. Create a file name cred.conf with username and password in each line
  2. Modify you existing config file and append "cred.conf" file name at end of  line "auth-user-pass login.config"

Deep Drive

Let's dig little deeper on what's VPN and what are these TAP devices for what they do ?


VPN:  It's a tunnel which allows your machine to connect to remote network.
            That's what we know but how does that work ?

          Will not go much deep in N/w but in short to go outside your n/w you will need to go via main gate of your network fence that's our Gateway. e.g. Let's say your address is in range 192.168.0.0/24, then you can fwd packages to others in your network 192.168.0.x directly, but for anything else will say will go via 192.168.0.1

             IPv4 Address. . . . . . . . . . . : 192.168.0.106
             Subnet Mask . . . . . . . . . . . : 255.255.255.0
             Default Gateway . . . . . . . . . : 192.168.0.1
          How to verify -- use traceroute or similar command.

         That's OK but how does this co-related to  VPN.

          We are getting there, So till now we are fine with our own n/w, Now let's say the earlier setting was of your home, now you brought you laptop to your office n/w and got different IP 10.10.x.x/18, bigger range, but still same will need one gateway.

         Now VPN helps you to bridge this gap i.e. from home network connect to your Office network. For that what they do is plug one extra network card (obviously virtual) and route traffic send via this card aka TAP device to your office external address which is pre-configured with VPN server to accept traffic with some authentication and connect to your office n/w


        Hence before connecting via VPN my "route --print 4" command will give output as :


        This interface 192.168.0.106 is physical.

        Now after connecting to VPN it's:

       We see that there is new interface 10.242.2.250 which is from our VPN.
         




   



No comments:

Post a Comment