Microsoft PPTP + Cisco PIX + Split Tunnel
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > WebserverTalk Community > VPN > Microsoft PPTP + Cisco PIX + Split Tunnel




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Microsoft PPTP + cisco PIX + Split Tunnel  
mark.stradling@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-14-07 12:13 AM


 '=======================================
===================================
'
' VBScript Source File -- Created with SAPIEN Technologies
PrimalScript 4.1
'
' NAME: Microsoft PPTP Split Tunnel Fix
'
' AUTHOR: Mark Stradling (mark_stradling@hotmail.com)
' DATE  : 6/13/2007
'
' COMMENT: When using Micro$oft PPTP VPN - if you disable "use default
gateway on remote network"
' you are then unable to route traffic to any network other than the
subnet defined by your
' VPN IP address. To get around this, run this script after connecting
to VPN.
'
' How it works
' This script checks the systems IP address. It identifies the VPN IP
by matching
' the first 3 octets. After determining the assigned VPN IP address it
then adds
' windows routing table entries that point the routing table to locate
specified
' subnets by using the assigned VPN IP address.
' It is necessary to find the VPN IP address first as this should be
' the gateway for subnets on the other side of the VPN tunnel
 '=======================================
===================================

strComputer = "."

Set objRegEx1 = New RegExp

'---------------
' # Start here: Replace the value after .Pattern with the first 3
octets of the VPN Pool
' # Example: VPN Pool is 10.10.10.1 - 10.10.10.254 = enter 10.10.10.
in place of 172.16.16.
'---------------
With objRegEx1
.Pattern = "172.16.16."
.IgnoreCase = True
.Global = True
End With

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root
\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled
= True")

For Each objItem in colItems
For Each strAddress in objItem.IPAddress
varMatch = objRegEx1.test(strAddress)
If varMatch Then
strVPNIP = straddress
Else
End If
Next
Next

Set wshShell = CreateObject("WScript.Shell")

strRouteAdd = "Route add"

'----------------------------------------------------
'# Enter the networks you would like to route to through the VPN
tunnel
'# Copy the syntax used below
'# Example: If you wanted to route to 10.10.0.0 255.255.0.0 through
the VPN enter
'# strNet4 = "10.10.0.0 mask 255.255.0.0"
'# increment strNet# for each new network
'----------------------------------------------------

strNet1 = "192.168.2.0 mask 255.255.255.0"
strNet2 = "192.168.65.0 mask 255.255.255.0"
strNet3 = "192.168.12.0 mask 255.255.255.0"

'----------------------------------------------------
'# For each entry above - create a matching entry of the one below
'# You may copy and paste - just make sure to modify the strNet# value
'# to match with each network you added above
'# Example: To add the network used in previous example type
'# wshShell.Run(strRouteAdd & " " & strNet4 & " " & strVPNIP)
'# NOTE: I add strNet4 to match my strNet4 entry made above
'----------------------------------------------------
wshShell.Run(strRouteAdd & " " & strNet1 & " " & strVPNIP)
wshShell.Run(strRouteAdd & " " & strNet2 & " " & strVPNIP)
wshShell.Run(strRouteAdd & " " & strNet3 & " " & strVPNIP)

WScript.Quit






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 07:41 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register