使用全球路由表,本文目的将展示用于的配置示例访问从多协议标签交换(MPLS)的互联网-基于VPN。
在某些网络环境中,它要求访问从基于MPLS的VPN的互联网除维护之外在公司站点中的VPN连通性的继续。此配置示例着重提供从包含默认路由到互联网网关路由器的VPN路由与转发(VRF)的互联网访问(IGW)。
MPLS转发和MPLS VPN基本的了解要求充分地了解本文内容。
本文档中的信息基于以下软件和硬件版本。
思科IOS®软件版本12.1(3)T。版本12.0(5)T包括MPLS VPN功能
从3600系列的任何Cisco路由器或以上,例如Cisco 3660或7206
本文档中的信息都是基于特定实验室环境中的设备创建的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您是在真实网络上操作,请确保您在使用任何命令前已经了解其潜在影响。
在此配置示例中,这些策略到位:
有连通性的一个路由器对互联网附加对MPLS网络。它可能或可能不注入边界网关协议(BGP)路由全球路由表。
注意:PE路由器了解BGP。路由器例如(执行作为供应商核心路由器)的千兆交换路由器(GSR)根本不运行BGP。
没有VRF的需求能有从互联网(全局BGP表)的一完整路由表,因此静态默认路由在指向IGW的全局下一跳地址的VRF放置。
VPN客户使用是可路由的在全球互联网路由表里的注册的唯一地址范围。在本文讨论的访问方法不推荐客户有仅专用地址在他们的网络的地方。
这些缩略语用于本文:
CE - 客户的边缘路由器。
PE - 提供商的边缘路由器。
P - 提供商核心路由器
有关文档规则的详细信息,请参阅 Cisco 技术提示规则。
有关此配置的图示,请参阅网络图。在本示例中,CE 1 与 CE 2 在同一 VPN 内。它们配置于 customer1 VRF 下,因为不要求 VRF 拥有来自 Internet 的完整路由表(根据本文档背景理论部分中的策略)。
在 CE 1 上的 customer1 VRF 中配置有静态默认路由,指向 IGW。通过在 customer1 VRF 中设置静态默认路由,与 customer1 VRF 内的任何路由都不匹配的数据包将发送至 IGW。
注意:由于Internet网关下一跳192.168.67.1不是customer1 VRF的一部分,因此在customer1 VRF下配置了指向Internet网关接口s8/0 IP 192.168.67.1的默认路由。到192.67.1的路由168.67.1不在customer1 VRF内,因此,您需要在customer1 VRF下配置的静态默认路由内配置全局关键字。该全局关键字指定静态路由的下一跳地址在全局路由表内进行解析,而不是在 customer1 VRF 内进行解析。
下面是静态路由的示例。
ip route vrf customer1 0.0.0.0 0.0.0.0 192.168.67.1 global
在 customer1 VRF 中为静态路由设置全局关键字可确保发往 Internet 的所有数据包都路由至 Internet 网关,继而路由至 Internet。
注意:PE 1中的默认路由配置为指向Internet网关的串行接口IP地址(192.168.67.1),而不是指向环回地址(10.1.1.6)。 如果 Internet 网关与 Internet (R7) 之间出现连接故障,可避免出现路由黑洞。 如果默认路由指向 Internet 网关的环回地址,并且 Internet 网关与 R7 中断连接,所有数据包会继续路由至 Internet 网关。这是因为环回地址保持正常工作(不同于 192.168.67.1,当接口 s8/0 出现故障时,会从全局路由表中撤消该地址),默认路由继续存在于路由表中。
下一步是确保从 Internet 返回目标 CE 1 网络 11.11.11.0/24 的数据包从 Internet 网关路由至 PE 1,然后通过 MPLS 核心路由至 CE 1。实现这一任务的方法是为 CE 1 网络配置静态路由,指向 PE 1 上的全局路由表中的 Serial 8/0 接口。将其重新分配到开放最短路径优先 (OSPF) 中,以便 Internet 网关的全局路由表中有该路由。这样,Internet 网关将来自 Internet 的所有数据包路由至 PE 1,并路由至 CE 1 之外的最终目标。
下面的示例是在 PE 1 上的配置中使用的 ip route 命令。
ip route 11.11.11.0 255.255.255.0 Serial8/0 192.168.10.1
注意:在全局路由表中配置的上述静态路由是customer1 VRF中配置的静态路由,用于VPN网络层可达性信息(NLRI)。 在 PE 1 上,它的配置如下所示。
ip route vrf customer1 11.11.11.0 255.255.255.0 192.168.10.1
注:要查找有关本文档中使用的命令的其他信息,请使用命令查找工具(仅注册客户)。
本文档使用下图所示的网络设置。
本文档使用如下所示的配置。
CE 1 |
---|
version 12.2 ! hostname CE-1 ! ip subnet-zero ! interface Loopback0 ip address 10.1.1.1 255.255.255.255 ! interface Loopback2 ip address 11.11.11.1 255.255.255.0 ! interface Serial8/0 ip address 192.168.10.1 255.255.255.252 !--- The interface is connected to PE 1. ! ip classless ip route 0.0.0.0 0.0.0.0 192.168.10.2 !--- This is the default route to route all packets to PE 1. ! |
PE 1 |
---|
version 12.2 ! hostname PE-1 ! ip subnet-zero ! ip vrf customer1 !--- This configured VRF customer1. rd 100:1 !--- This configured the route distiguisher for VRF. route-target export 1:1 route-target import 1:1 !--- This configured the export and import policies into VRF. ! ip cef !--- This enabled Cisco Express Forwarding (CEF) switching. ! interface Loopback0 ip address 10.1.1.2 255.255.255.255 ! interface Ethernet0/0 !--- It is connected to P router. ip address 10.10.23.2 255.255.255.0 tag-switching ip !--- MPLS switching is enabled. ! interface Serial8/0 ! Connected to CE-1 ip vrf forwarding customer1 !--- Route forwarding based on customer1 VRF is enabled. ip address 192.168.10.2 255.255.255.252 ! router ospf 1 log-adjacency-changes redistribute static subnets network 0.0.0.0 255.255.255.255 area 0 ! router bgp 100 no synchronization bgp log-neighbor-changes neighbor 10.1.1.4 remote-as 100 !--- Neighbor relationship with PE 2 is established. neighbor 10.1.1.4 update-source Loopback0 neighbor 10.1.1.4 next-hop-self no auto-summary ! address-family ipv4 vrf customer1 !--- The address-family configuration mode specifies IPv4 unicast !---address prefixes for customer1 VRF. no auto-summary no synchronization network 11.11.11.0 mask 255.255.255.0 !--- CE 1 network 11.11.11.0/24 to PE 2 is announced. network 192.168.10.0 mask 255.255.255.252 exit-address-family ! address-family vpnv4 !--- This is the address-family VPNV4 configuration mode for !--- configuring BGP sessions. neighbor 10.1.1.4 activate neighbor 10.1.1.4 send-community extended no auto-summary exit-address-family ! ip classless ip route 11.11.11.0 255.255.255.0 Serial8/0 192.168.10.1 !--- The static route in the global routing table is pointing to !--- the interface connected to CE 1. ip route vrf customer1 0.0.0.0 0.0.0.0 192.168.67.1 global !--- The static default route under customer1 VRF, routing packets !--- outside of VPN to the Internet gateway. ! routes ip route vrf customer1 11.11.11.0 255.255.255.0 192.168.10.1 !--- The static route for network 11.11.11.0/24 (CE-1 Network) under !---customer1 VRF ensures the reachability of CE 1 network from the !--- other VPN sites. |
P |
---|
version 12.2 ! hostname P ! ip subnet-zero ! ip cef !--- CEF switching is enabled. ! interface Loopback0 ip address 10.1.1.3 255.255.255.255 ! interface Ethernet0/0 !--- This is connected to PE 1. ip address 10.10.23.3 255.255.255.0 tag-switching ip !--- MPLS switching is enabled. ! interface Ethernet1/0 !--- This is connected to PE 2. ip address 10.10.34.3 255.255.255.0 tag-switching ip ! interface Ethernet2/0 !--- This is connected to the Internet gateway. ip address 10.10.36.3 255.255.255.0 tag-switching ip ! router ospf 1 log-adjacency-changes network 0.0.0.0 255.255.255.255 area 0 |
IGW |
---|
version 12.2 ! hostname IGW ! ip subnet-zero ! ip cef !--- This enabled CEF switching. ! interface Loopback0 ip address 10.1.1.6 255.255.255.255 ! interface Ethernet2/0 !--- This is connected to P router. ip address 10.10.36.6 255.255.255.0 tag-switching ip ! interface Serial8/0 !--- This is connected to Internet R7. ip address 192.168.67.1 255.255.255.252 ! router ospf 1 log-adjacency-changes network 0.0.0.0 255.255.255.255 area 0 ! router bgp 100 no synchronization bgp log-neighbor-changes network 11.11.11.0 mask 255.255.255.0 network 22.22.22.0 mask 255.255.255.0 neighbor 192.168.67.2 remote-as 200 no auto-summary |
PE 2 |
---|
version 12.2 ! hostname PE-2 ! ip subnet-zero ! ip vrf customer1 !--- Customer1 VRF is configured. rd 100:1 !--- Route Distinguisher for VRF is configured. route-target export 1:1 route-target import 1:1 !--- This configured the import and export policies for customer1 !--- VRF. ! ip cef !--- This enabled CEF switching. ! interface Loopback0 ip address 10.1.1.4 255.255.255.255 interface Ethernet1/0 !--- Connected to P router. ip address 10.10.34.4 255.255.255.0 tag-switching ip !--- MPLS switching is enabled. ! interface Serial9/0 !--- Connected to CE 2 router. ip vrf forwarding customer1 !--- This enables VRF forwarding on the interface. ip address 192.168.20.1 255.255.255.252 ! router ospf 1 log-adjacency-changes redistribute static subnets network 0.0.0.0 255.255.255.255 area 0 ! router bgp 100 no synchronization bgp log-neighbor-changes neighbor 10.1.1.2 remote-as 100 neighbor 10.1.1.2 update-source Loopback0 neighbor 10.1.1.2 next-hop-self no auto-summary ! address-family ipv4 vrf customer1 !--- This is the address-family IPv4 configuration of customer1 VRF. no auto-summary no synchronization network 22.22.22.0 mask 255.255.255.0 !--- This announces the CE 2 network to PE 1. exit-address-family ! address-family vpnv4 !--- This is the address-family VPNV4 configuration for BGP Sessions !--- with PE 1. neighbor 10.1.1.2 activate neighbor 10.1.1.2 send-community extended no auto-summary exit-address-family ! ip classless ip route 22.22.22.0 255.255.255.0 Serial9/0 192.168.20.2 !--- This is the static route for network 22.22.22.0/24 in the global !--- routing table pointing to the interface connected to CE 2. ip route vrf customer1 0.0.0.0 0.0.0.0 192.168.67.1 global !--- This is the static default route for customer VRF !--- for destinations outside the VPN. ip route vrf customer1 22.22.22.0 255.255.255.0 192.168.20.2 !--- This is the static route within customer1 VRF for CE 2 !--- network for VPN connectivity. |
CE 2 |
---|
version 12.2 ! hostname CE-2 ! ip subnet-zero ! interface Loopback0 ip address 22.22.22.22 255.255.255.0 ! interface Serial9/0 !--- This is connected to PE 2. ip address 192.168.20.2 255.255.255.252 ! ip classless ip route 0.0.0.0 0.0.0.0 192.168.20.1 !--- This is the default route pointing to PE 2. |
本部分所提供的信息可用于确认您的配置是否正常工作。
若要验证 CE 1 与 CE 2 之间的 VPN 连接,CE 1 应能到达 CE 2 的网络 22.22.22.0/24,反之亦然。若要对此进行检查,请在 PE 1 上的 customer1 VRF 中验证到网络 22.22.22.0/24 的路由。
命令输出解释程序工具(仅限注册用户)支持某些 show 命令,使用此工具可以查看对 show 命令输出的分析。
show ip route vrf customer1命令确认从10.1.1.4(PE 2的环回地址)获知的到网络22.22.22.0/24的路由,如下面的输出中突出显示。
PE-1# show ip route vrf customer1 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is 192.168.67.1 to network 0.0.0.0 192.168.10.0/30 is subnetted, 1 subnets C 192.168.10.0 is directly connected, Serial8/0 22.0.0.0/24 is subnetted, 1 subnets B 22.22.22.0 [200/0] via 10.1.1.4, 01:00:50 11.0.0.0/24 is subnetted, 1 subnets S 11.11.11.0 [1/0] via 192.168.10.1 S* 0.0.0.0/0 [1/0] via 192.168.67.1
同样,在 PE 2,customer1 VRF 中到网络 11.11.11.0/24 的路由如下例所示。
PE-2# show ip route vrf customer1 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is 192.168.67.1 to network 0.0.0.0 192.168.10.0/30 is subnetted, 1 subnets B 192.168.10.0 [200/0] via 10.1.1.2, 01:00:09 22.0.0.0/24 is subnetted, 1 subnets S 22.22.22.0 [1/0] via 192.168.20.2 192.168.20.0/30 is subnetted, 1 subnets C 192.168.20.0 is directly connected, Serial9/0 11.0.0.0/24 is subnetted, 1 subnets B 11.11.11.0 [200/0] via 10.1.1.2, 01:00:09 S* 0.0.0.0/0 [1/0] via 192.168.67.1
现在检查 CE 1 与 CE 2 之间的连接,方法是从 CE 1 使用源 IP 地址 11.11.11.1 ping CE 2 上的主机 22.22.22.22。
CE-1# ping Protocol [ip]: Target IP address: 22.22.22.22 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y Source address or interface: 11.11.11.1 Type of service [0]: Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]: Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 22.22.22.22, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 20/20/20 ms
执行下列步骤验证从 CE1 到 Internet 的连接。
所有从 CE 1 到 Internet 或 VPN 的数据包都使用在 CE 1 中配置的、指向 PE 1 的默认路由进行路由,如下所示。
CE-1# show ip route 0.0.0.0 Routing entry for 0.0.0.0/0, supernet Known via "static", distance 1, metric 0, candidate default path Routing Descriptor Blocks: * 192.168.10.2 Route metric is 0, traffic share count is 1
传入 PE 1 接口 s8/0 的数据包使用 customer1 VRF 路由表进行路由。PE 1 在 customer1 VRF 中有一个默认路由,指向 IGW IP 地址 192.168.67.1,如 PE 1 上 show ip route vrf customer1 的输出所示。
PE-1# show ip route vrf customer1 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is 192.168.67.1 to network 0.0.0.0 192.168.10.0/30 is subnetted, 1 subnets C 192.168.10.0 is directly connected, Serial8/0 22.0.0.0/24 is subnetted, 1 subnets B 22.22.22.0 [200/0] via 10.1.1.4, 01:21:11 11.0.0.0/24 is subnetted, 1 subnets S 11.11.11.0 [1/0] via 192.168.10.1 S* 0.0.0.0/0 [1/0] via 192.168.67.1
因为 PE 1 上的默认路由配置有一个全局关键字,所以它会在其全局路由表中寻找下一跳 192.168.67.1,并路由至 IGW,如下所示。
PE-1# show ip route 192.168.67.1 Routing entry for 192.168.67.0/30 Known via "ospf 1", distance 110, metric 84, type intra area Last update from 10.10.23.3 on Ethernet0/0, 00:21:54 ago Routing Descriptor Blocks: * 10.10.23.3, from 10.1.1.6, 00:21:54 ago, via Ethernet0/0 Route metric is 84, traffic share count is 1
到达IGW的数据包将根据从R7获知的BGP路由路由到Internet。在这种情况下,您可以查看从R7获知的BGP路由,以演示与Internet的连接。下面是 IGW 路由表中从 R7 获知的 BGP 路由(网络 99.99.99.0/24)。
IGW# show ip route 99.99.99.0 Routing entry for 99.99.99.0/24 Known via "bgp 100", distance 20, metric 0 Tag 200, type external Last update from 192.168.67.2 01:37:25 ago Routing Descriptor Blocks: * 192.168.67.2, from 192.168.67.2, 01:37:25 ago Route metric is 0, traffic share count is 1 AS Hops 1
源自 CE-1 的数据包路由至 Internet。
对于要从 Internet 返回 CE 1 网络 11.11.11.0/24 的数据包,IGW 在其全局路由表中应有一个指向 PE 1 的路由。在 PE 1 的全局路由表中配置有一个静态路由,指向与 CE 1 相连的 PE 1 上的 s8/0 接口,并会重新分配到 OSPF 中。这可确保IGW的全局路由表中有一条指向PE 1的路由。PE 1上的静态路由和IGW上的OSPF学习路由如下所示。
IGW# show ip route 11.11.11.0 Routing entry for 11.11.11.0/24 Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 20 Last update from 10.10.36.3 on Ethernet2/0, 00:34:34 ago Routing Descriptor Blocks: * 10.10.36.3, from 10.1.1.2, 00:34:34 ago, via Ethernet2/0 Route metric is 20, traffic share count is 1 PE-1# show ip route 11.11.11.0 Routing entry for 11.11.11.0/24 Known via "static", distance 1, metric 0 Redistributing via ospf 1 Advertised by ospf 1 subnets Routing Descriptor Blocks: * 192.168.10.1, via Serial8/0 Route metric is 0, traffic share count is 1
现在检查从 CE 1 到 Internet 的连接,方法是对 CE 1 源地址 11.11.11.1 ping R7 IP 地址 99.99.99.1。
CE-1# ping Protocol [ip]: Target IP address: 99.99.99.1 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y Source address or interface: 11.11.11.1 Type of service [0]: Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]: Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 99.99.99.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 20/24/32 ms CE-1#
目前没有针对此配置的故障排除信息。
版本 | 发布日期 | 备注 |
---|---|---|
1.0 |
10-Aug-2005 |
初始版本 |