I have a VM in azure I like to use for development. I built it with 2 NICs in hopes that I could have two public IP addresses, but that doesn't look possible in azure. When I connect to our corporate VPN using Juniper Network Connect 8.0 my RDP connection is lost and I have to reboot the VM through the azure portal to access it again. Does anyone have any ideas how this can be accomplished? Thanks!
3 Answers
Actually, this issue is not related to Azure. The root cause of this issue is that the default gateway has been changed when we establish a VPN connection.
Please follow the steps below to resolve your issue:
- Configure your VPN client to don't use VPN server as default gateway.
- Add some static route entries to make sure that the client is able to access the subnets behind the VPN server.
In my case default gateway was totally removed (VM on Azure Windows 10 win10-21h2-pro-g2)
Run it as autostart script:
while ($true) {
$date = Get-Date -Format "yyyyMMdd_HHmmss"
$filename = "C:\xxx\route_$date.txt"
route print | Out-File -FilePath $filename
$ip = (Invoke-WebRequest -Uri ifconfig.me -UseBasicParsing).Content.Trim()
"Public IP: $ip" | Out-File -Append -FilePath $filename
route add 0.0.0.0 mask 0.0.0.0 10.0.0.1 | Out-Null
Start-Sleep -Seconds 60
}
I have restore it with
Set the default gateway to 10.0.0.1
route add 0.0.0.0 mask 0.0.0.0 10.0.0.1 | Out-Null