跳到主要内容

11. 从 VPN 访问 Internet

11. 从 VPN 访问 Internet (Accessing the Internet from a VPN)

许多 VPN sites 既需要访问其他 VPN sites, 也需要访问 public Internet. 下面描述实现这一点的几种可选方式.

  1. 在某些 VPNs 中, 一个或多个 sites 会通过连接到 ISP 的 non-VRF interface 上的 "Internet gateway" (可能是 firewall) 获得 Internet access. 该 ISP 可以与提供 VPN 服务的 SP 是同一组织, 也可以不是. 往返 Internet gateway 的 traffic 随后将按照 PE router 的 default forwarding table 进行路由.

    在这种情况下, 具有 Internet access 的 sites 可能会向其 PEs 分发 default route, 这些 PEs 再将该 route 重分发给其他 PEs, 从而进入该 VPN 的其他 sites. 这为该 VPN 的所有 sites 提供 Internet access.

    为了正确处理来自 Internet 的 traffic, ISP 必须向 Internet 分发通向 VPN 内部 addresses 的 routes. 这与本文档描述的任何 route distribution procedures 完全独立. VPN 的内部结构通常不会从 Internet 可见; 这些 routes 只会通向连接该 VPN 的 Internet gateway 的 non-VRF interface.

    在此模型中, PE router 的 default forwarding table 与其任何 VRFs 之间不交换 routes. VPN route distribution procedures 与 Internet route distribution procedures 完全独立.

    注意, 尽管 VPN 的某些 sites 使用 VRF interface 与 Internet 通信, 但最终所有往返 Internet 的 packets 在离开/进入 VPN 之前都会经过 non-VRF interface, 因此我们称之为 "non-VRF Internet access".

    还要注意, non-VRF interface 所连接的 PE router 不一定需要在其 default forwarding table 中维护所有 Internet routes. default forwarding table 可以少到只有一条 route, 即 "default", 它通向另一个拥有 Internet routes 的 router (很可能是相邻 router). 此方案的一种变体是, 将 PE router 通过 non-VRF interface 接收的 packets 通过 tunnel 发送到另一个 router, 由后者维护完整的 Internet routes 集合.

  2. 某些 VPNs 可以通过 VRF interface 获得 Internet access ("VRF Internet access"). 如果 PE 通过 VRF interface 收到 packet, 且该 packet 的 destination address 不匹配 VRF 中的任何 route, 则可以将其与 PE 的 default forwarding table 进行匹配. 如果在那里匹配成功, 该 packet 可以通过 backbone 以 native 方式转发到 Internet, 而不是通过 MPLS 转发.

    为了让 traffic 能够以 native 方式沿相反方向流动 (从 Internet 到 VRF interface), 必须将 VRF 中的一些 routes 导出到 Internet forwarding table. 不言而喻, 任何此类 routes 都必须对应 globally unique addresses.

    在此方案中, default forwarding table 可以包含完整的 Internet routes 集合, 也可以少到只有一条 default route, 通向另一个在其 default forwarding table 中确实拥有完整 Internet routes 集合的 router.

  3. 假设 PE 具有在 VRF 中存储 "non-VPN routes" 的能力. 如果 packet 的 destination address 匹配某条 "non-VPN route", 则该 packet 会以 native 方式传输, 而不是通过 MPLS 传输. 如果 VRF 包含 non-VPN default route, 所有发往 public Internet 的 packets 都会匹配它, 并以 native 方式转发到该 default route 的 next hop. 在该 next hop 上, 这些 packets 的 destination addresses 将在 default forwarding table 中查找, 并可能匹配到更具体的 routes.

    只有在没有任何 CE routers 分发 default route 时, 才能使用此技术.

  4. 也可以通过让 VRF 包含 Internet routes, 经由 VRF interface 获得 Internet access. 与模型 2 相比, 这消除了第二次 lookup, 但缺点是要求在每个这样的 VRF 中复制 Internet routes.

    如果使用此技术, SP 可能希望将其面向 Internet 的 interface 设为 VRF interface, 并使用 Section 4 的技术将 Internet routes 作为 VPN-IPv4 routes 分发给其他 VRFs.

必须明确理解, 默认情况下, VRF 与 default forwarding table 之间不会交换 routes. 只有在客户与 SP 达成协议, 且符合客户 policies 时, 才会这样做.