I had an issue like this. I built a Powershell script that runs and sets all the necessary routes, security options, password, and the registry key needed for this to work. I have multiple sites so you can comment out what you dont need if only one.
This checks for the registry entry and adds if not there, deletes all current VPN connections with the same name (in case you need to make an edit,) then recreates them base on the names, routes via CDIN, and sets the password. Hope this helps. This allows me to hit all of my MX networks at all my sites with no issues.
$check_instal = (Get-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\PolicyAgent').AssumeUDPEncapsulationContextOnSendRule
$TunnelType = "L2tp"
$AuthMethod = @("MSChapv2","Pap")
$EncryptionLevel = "Required"
$IdleDisconnect = 1800
$sharedkey = "yourpassword"
if ($check_instal -Match 2) { #Is the system configured for UDPVPN?
# Cisco VPN is already set.
} else {
$RegistryPath = "HKLM:\System\CurrentControlSet\Services\PolicyAgent"
$RegName = "AssumeUDPEncapsulationContextOnSendRule"
$Regvalue = 2
New-ItemProperty -Path $RegistryPath -Name $RegName -Value $Regvalue -PropertyType DWORD -Force
}
function create_VPN ($VPNConnectName, $ServerAddress, $TunnelType, $AuthMethod, $sharedkey) {
try {
Remove-VpnConnection -Name $VPNConnectName -AllUserConnection -Force -erroraction 'silentlycontinue'
Add-VpnConnection -Name $VPNConnectName -ServerAddress $ServerAddress -TunnelType $TunnelType -AllUserConnection -AuthenticationMethod $AuthMethod -EncryptionLevel Optional -L2tpPsk $sharedkey -RememberCredential -Force
} catch {
# Save the error, which is a [System.Management.Automation.ErrorRecord]
# instance. To save just a the *message* (a string), use
# err = "$_"
#$err = $_
}
Set-VpnConnection $VPNConnectName -SplitTunneling $True -AllUserConnection
Add-VpnConnectionRoute -ConnectionName $VPNConnectName -DestinationPrefix CDINOFROUTE
Add-VpnConnectionRoute -ConnectionName $VPNConnectName -DestinationPrefix CDINOFROUTE
Add-VpnConnectionRoute -ConnectionName $VPNConnectName -DestinationPrefix CDINOFROUTE
Add-VpnConnectionRoute -ConnectionName $VPNConnectName -DestinationPrefix CDINOFROUTE
Start-Sleep -Milliseconds 100
}
#Create VPN Connection
$VPNConnectName = "name of vpn 1"
$ServerAddress = "paste MX URL here"
create_VPN $VPNConnectName $ServerAddress $TunnelType $AuthMethod $sharedkey $IdleDisconnect
#Create VPN Connection
$VPNConnectName = "name of vpn 2"
$ServerAddress = "paste MX URL here"
create_VPN $VPNConnectName $ServerAddress $TunnelType $AuthMethod $sharedkey $IdleDisconnect
#Create VPN Connection
$VPNConnectName = "name of vpn 3"
$ServerAddress = "paste MX URL here"
create_VPN $VPNConnectName $ServerAddress $TunnelType $AuthMethod $sharedkey $IdleDisconnect
#Set "Register this connection's addresses in DNS" to True and sets appropriate DNS settings for all connections
$RASPhoneBook = “C:\ProgramData\Microsoft\Network\Connections\Pbk\rasphone.pbk”
(Get-Content $RASPhoneBook) -Replace ‘IpDnsFlags=0’, ‘IpDnsFlags=1’ |
Set-Content $RASPhoneBook