Windows, HyperV, Exchange, SQL, System Center, PowerShell, Mikrotik, IceWarp IT solution

Windows XP PPTP split tunneling custom routes problem

We are using Mikrotik routers as VPN servers for our Windows clients (XP, 7, 8). As you know, you can use your VPN connection as default gateway and route all traffic through your corporate network (default option) or disable remote default gateway and use yot VPN connection without any routing (usable in small scenarios, where you have very small corporate network with few servers and one IP subnet bridged with your vpn clients. None of these two options is suitable for bigger corporates. We need to route internet traffic through actual default gateway and have some static routes to corporate network. add classless route, but you have to use Microsoft RRAS (or any other compatible VPN servers, that can assign IPs via DHCP). Unfortunattly, Mikrotik uses custom IP pools and there is no way, how to send custom IP routes to client. So I recently started using CMAK to build custom VPN install package, to be able to add some custom routes to corporate my network. This works fine on Windows 7 and 8 but not on XP. There is problem with default interfaces. Anytime, you connect with Windows XP, it adds custom routes, but it uses its default gateway as remote gateway (instead of VPN interface address), so routing does not work. After hours spend on google, where I found no solution, I made easy powershell script. Just add it to your CMAK package as custom action after VPN connected and all works well.

$IPAddress = (Get-wmiobject Win32_NetworkAdapterConfiguration |where {($_.Description -like '*PPP*') -and ($_.IPAddress -ne $null) } |select IPAddress).IPAddress; cmd /c "route add mask $IPAddress"

config.png (60.03 kb)