将默认网关设置为 10.0.0.1

将默认网关设置为 10.0.0.1

我在 Azure 中有一个 VM,我喜欢用它来进行开发。我使用 2 个 NIC 构建它,希望我可以拥有两个公共 IP 地址,但这在 Azure 中似乎不可能。当我使用 Juniper Network Connect 8.0 连接到我们的公司 VPN 时,我的 RDP 连接丢失,我必须通过 Azure 门户重新启动 VM 才能再次访问它。有人知道如何实现这一点吗?谢谢!

答案1

其实这个问题和 Azure 无关,问题的根源在于我们建立 VPN 连接时默认网关被更改了。

请按照以下步骤解决您的问题:

  1. 配置您的 VPN 客户端以不使用 VPN 服务器作为默认网关。
  2. 添加一些静态路由条目以确保客户端能够访问 VPN 服务器后面的子网。

答案2

您可以使用以下方式检查您的公共 IP 地址我的 IP 是什么也一样。

答案3

就我而言,默认网关已被完全删除(Azure Windows 10 win10-21h2-pro-g2 上的 VM)

将其作为自动启动脚本运行:

当 ($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

}

我已经恢复了

将默认网关设置为 10.0.0.1

route add 0.0.0.0 mask 0.0.0.0 10.0.0.1 | Out-Null

相关内容