Google Cloud VPN:NAT 后面的多个隧道

Google Cloud VPN:NAT 后面的多个隧道

我想使用 IPSec VPN 将多个独立的 NAT 网络连接到 VPC 网络。我不完全理解 Google 的文档,我在这里寻求一些澄清 :) 文档在这里:https://cloud.google.com/vpn/docs/resources/troubleshooting#gateways_behind_nat

我的设置如下:

| net1 | --- | router1 | --- \
                               \  priv        onprem       pub   
| net2 | --- | router2 | ----  | ---- | main_router NAT | ----------- >
                               /
| netN | --- | routerN | --- / 

    pub
> ----------- | Cloud VPN gateway(s) | --- | VPC Network |

我希望从每个本地routerN到云 VPC 网络都有单独的隧道,可能使用N云网关。我不完全了解这是否可以通过云 VPN 实现。有人可以解释一下吗?:)

router1 behind NAT <-- IPSec --> Cloud VPN gateway1
router2 behind NAT <-- IPSec --> Cloud VPN gateway2
...

谨致问候
Kamil

答案1

我设法在 NAT 后面每个设备使用一个 Cloud VPN 从单个公共 IP 地址运行多个隧道。

| net1 | --- | router1 | --- \
                               \  priv        onprem       pub   
| net2 | --- | router2 | ----  | ---- | main_router NAT | ----------- >
                               /
| netN | --- | routerN | --- / 

       /--> | Cloud VPN Gateway for router1 |
----> |--   | Cloud VPN Gateway for router2 |
       \--  | Cloud VPN Gateway for routerN |

方法如下:

  • NAT 后面每个启动 IPSec 隧道的设备(router1如图router2 ...所示)都应将其身份验证 ID 公布为 NAT 路由器的公网 IP(main_router NAT)。不是它的私人地址。
  • NAT 路由器必须允许来自 Google Cloud VPN 网关的端口 500 和 4500。

现在最重要的部分:在主 NAT 路由器上设置 D-NAT 规则,将来自每个 Cloud VPN 网关的流量定向到建立特定隧道的设备的私有 IP。换句话说,必须N DNAT为隧道设置规则N。这样,IKE来自 Cloud VPN 的每个初始对话都可以传送到适当的routerN。每个后续流量都捕获在ESTABLISHED,RELATED节下。

我查看了路由器上的规则计数等,其工作原理与我上面描述的一样。IPSec 隧道是拆分隧道,这意味着 Cloud VPN 网关将尝试联系网关配置中指定的地址 - 在我们的例子中,该地址始终是相同的公共 IP 地址main_router NAT。我们main_router NAT必须将数据包(基于源 IP 地址)从特定网关转发到特定的内部路由器。

答案2

Cloud VPN 仅支持通过 UDP 封装进行 NAT 遍历 (NAT-T) 的一对一 NAT。
不支持一对多 NAT 和基于端口的地址转换。换句话说,Cloud VPN 无法连接到共享单个公共 IP 地址的多个本地或对等 VPN 网关。

使用一对一 NAT 时,必须将本地 VPN 网关配置为使用公共 IP 地址而不是其内部(私有)地址来标识自己。

当您配置 Cloud VPN 隧道以连接到本地 VPN 网关时,您需要指定一个外部 IP 地址。Cloud VPN 要求本地 VPN 网关使用其外部 IP 地址作为其身份。此内容对此进行了说明关联在 Google 的公共文档网站上。

相关内容