简介
本文档介绍使用Cisco IOS® XR软件配置从全局路由表(GRT)到VRF的路由泄漏的过程。
先决条件
要求
Cisco 建议您了解以下主题:
- 基本IP路由知识
- Cisco IOS和Cisco IOS XR命令行知识
使用的组件
此过程不限于Cisco IOS XR中的任何软件版本,因此,所有版本都可用于完成后续步骤。
本文档中的信息基于以下软件和硬件版本:
- 采用Cisco IOS XR软件的路由器
- 使用Cisco IOS软件的路由器
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
背景信息
本演示的目的是显示全局路由表与之间路由泄漏的配置 vrf
Cisco IOS XR上的路由表。
拓扑
初始验证
接口和静态路由配置
ASR9901-1
RP/0/RSP0/CPU0:ASR9901-1#show run interface gi0/0/0/0 Wed Oct 19 15:21:21.122 UTC interface GigabitEthernet0/0/0/0 cdp vrf ORANGE ipv4 address 192.168.10.1 255.255.255.0 !
RP/0/RSP0/CPU0:ASR9901-1#show run router static Tue Feb 7 19:24:42.730 UTC router static vrf ORANGE address-family ipv4 unicast 172.16.20.0/24 192.168.10.2
ASR9901-2
RP/0/RSP0/CPU0:ASR9901-2#show run int gi0/0/0/0
Wed Oct 19 15:40:18.599 UTC
interface GigabitEthernet0/0/0/0
cdp
vrf ORANGE
ipv4 address 192.168.10.2 255.255.255.0
!
RP/0/RSP0/CPU0:ASR9901-2#show run int gi0/0/0/6
Wed Oct 19 15:41:08.593 UTC
interface GigabitEthernet0/0/0/6
cdp
ipv4 address 172.16.20.1 255.255.255.0
!
CISCO 2911-3
CISCO2911-3#show run interface gigabitEthernet0/1
Building configuration...
Current configuration : 100 bytes
!
interface GigabitEthernet0/0
ip address 172.16.20.2 255.255.255.0
duplex auto
speed auto
end
CISCO2911-3#show run | section ip route
ip route 192.168.10.0 255.255.255.0 172.16.20.1
使用ping测试连接,例如,ASR9901-1可以ping通VRF ORANGE上的ASR9901-2。
RP/0/RSP0/CPU0:ASR9901-1#ping vrf ORANGE 192.168.10.2
Wed Oct 19 15:57:50.548 UTC
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/3 ms
ASR9901-2可以ping通默认vrf(GRT)上的CISCO2911-3。
RP/0/RSP0/CPU0:ASR9901-2#ping 172.16.20.2
Wed Oct 19 15:58:05.961 UTC
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.20.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
如果您尝试测试从ASR9K-1(VRF ORANGE)上的子网192.168.10.0/24到路由器2911上的子网172.16.20.0/24的可达性,此测试必须失败,因为ASR9K-2上未实施任何配置以完成VRF ORANGE与GRT之间的连接。
RP/0/RSP0/CPU0:ASR9901-1#ping 172.16.20.2 vrf ORANGE
Wed Oct 19 19:45:11.801 UTC
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.20.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
配置
第 1 步:在ASR9K-2中配置BGP进程,这是执行路由泄漏的路由器以及需要应用配置的位置。除了创建BGP进程外,还需要使用一些network语句来确保将计划泄漏的前缀安装在相应的BGP表中:
RP/0/RSP0/CPU0:ASR9901-2#show run router bgp
Wed Oct 19 20:21:55.118 UTC
router bgp 100
bgp router-id 10.10.10.10
address-family ipv4 unicast
network 172.16.20.0/24
!
address-family vpnv4 unicast
!
vrf ORANGE
rd 100:100
address-family ipv4 unicast
network 192.168.10.0/24
!
!
!
RP/0/RSP0/CPU0:ASR9901-2#
如您所见,无需创建任何BGP邻居关系,BGP需要将这些前缀放入BGP表中。
第二步:配置路由策略,这些策略旨在帮助您过滤允许泄露的前缀。在本示例中,使用route-policy GLOBAL-2-VRF和route-policy VRF-2-GLOBAL。
RP/0/RSP0/CPU0:ASR9901-2#show run route-policy GLOBAL-2-VRF
Wed Oct 19 20:37:56.548 UTC
route-policy GLOBAL-2-VRF
if destination in (172.16.20.0/24) then
pass
endif
end-policy
!
RP/0/RSP0/CPU0:ASR9901-2#show run route-policy VRF-2-GLOBAL
Wed Oct 19 20:38:10.538 UTC
route-policy VRF-2-GLOBAL
if destination in (192.168.10.0/24 le 32) then
pass
endif
end-policy
!
RP/0/RSP0/CPU0:ASR9901-2#
第三步:配置VRF并使用命令import from default-vrf route-policy <policy name>和export to default-vrf route-policy <policy name>应用上一步创建的路由策略,如下面的输出所示:
RP/0/RSP0/CPU0:ASR9901-2#show run vrf ORANGE
Wed Oct 19 20:40:38.851 UTC
vrf ORANGE
address-family ipv4 unicast
import from default-vrf route-policy GLOBAL-2-VRF
import route-target
100:100
!
export to default-vrf route-policy VRF-2-GLOBAL
export route-target
100:100
!
!
!
RP/0/RSP0/CPU0:ASR9901-2#
最终验证
提交之前的配置后,您可以验证从ASR9K-1(VRF ORANGE)上的子网192.168.10.0/24到路由器2911上的子网172.16.20.0/24的可达性,该子网最初发生故障。但是,通过适当的配置,此ping测试现在成功:
RP/0/RSP0/CPU0:ASR9901-1#ping 172.16.20.2 vrf ORANGE
Wed Oct 19 22:07:47.897 UTC
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.20.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/3 ms
RP/0/RSP0/CPU0:ASR9901-1#
A debug ip icmp
在路由器2911上配置还可以帮助验证路由器是否将回应应答发送回ASR9K-1:
CISCO2911-3#debug ip icmp
ICMP packet debugging is on
CISCO2911-3#
CISCO2911-3#
*Oct 19 21:34:20.069: ICMP: echo reply sent, src 172.16.20.2, dst 192.168.10.1, topology BASE, dscp 0 topoid 0
*Oct 19 21:34:20.073: ICMP: echo reply sent, src 172.16.20.2, dst 192.168.10.1, topology BASE, dscp 0 topoid 0
*Oct 19 21:34:20.077: ICMP: echo reply sent, src 172.16.20.2, dst 192.168.10.1, topology BASE, dscp 0 topoid 0
*Oct 19 21:34:20.077: ICMP: echo reply sent, src 172.16.20.2, dst 192.168.10.1, topology BASE, dscp 0 topoid 0
*Oct 19 21:34:20.081: ICMP: echo reply sent, src 172.16.20.2, dst 192.168.10.1, topology BASE, dscp 0 topoid 0
CISCO2911-3#
另一种验证是检查前缀是否出现在RIB和BGP表中,例如,GRT或default-vrf显示以下信息:
RP/0/RSP0/CPU0:ASR9901-2#show route
Wed Oct 19 22:15:03.930 UTC
Codes: C - connected, S - static, R - RIP, B - BGP, (>) - Diversion path
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 - ISIS, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, su - IS-IS summary null, * - candidate default
U - per-user static route, o - ODR, L - local, G - DAGR, l - LISP
A - access/subscriber, a - Application route
M - mobile route, r - RPL, t - Traffic Engineering, (!) - FRR Backup path
Gateway of last resort is not set
C 10.88.174.0/24 is directly connected, 1d20h, MgmtEth0/RSP0/CPU0/0
L 10.88.174.223/32 is directly connected, 1d20h, MgmtEth0/RSP0/CPU0/0
L 10.10.10.10/32 is directly connected, 04:33:44, Loopback100
C 172.16.20.0/24 is directly connected, 07:03:18, GigabitEthernet0/0/0/6
L 172.16.20.1/32 is directly connected, 07:03:18, GigabitEthernet0/0/0/6
B 192.168.10.0/24 is directly connected, 03:02:21, GigabitEthernet0/0/0/0 (nexthop in vrf ORANGE)
RP/0/RSP0/CPU0:ASR9901-2#
RP/0/RSP0/CPU0:ASR9901-2#show ip bgp
Wed Oct 19 22:15:13.069 UTC
BGP router identifier 10.10.10.10, local AS number 100
BGP generic scan interval 60 secs
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000000 RD version: 5
BGP main routing table version 5
BGP NSR Initial initsync version 3 (Reached)
BGP NSR/ISSU Sync-Group versions 0/0
BGP scan interval 60 secs
Status codes: s suppressed, d damped, h history, * valid, > best
i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 172.16.20.0/24 0.0.0.0 0 32768 i *> 192.168.10.0/24 0.0.0.0 0 32768 i
Processed 2 prefixes, 2 paths
RP/0/RSP0/CPU0:ASR9901-2#
现在,下一个输出显示了VRF ORANGE的信息:
RP/0/RSP0/CPU0:ASR9901-2#show route vrf ORANGE
Wed Oct 19 22:21:24.559 UTC
Codes: C - connected, S - static, R - RIP, B - BGP, (>) - Diversion path
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 - ISIS, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, su - IS-IS summary null, * - candidate default
U - per-user static route, o - ODR, L - local, G - DAGR, l - LISP
A - access/subscriber, a - Application route
M - mobile route, r - RPL, t - Traffic Engineering, (!) - FRR Backup path
Gateway of last resort is not set
B 172.16.20.0/24 is directly connected, 01:43:49, GigabitEthernet0/0/0/6 (nexthop in vrf default) C 192.168.10.0/24 is directly connected, 07:06:38, GigabitEthernet0/0/0/0
L 192.168.10.2/32 is directly connected, 07:06:38, GigabitEthernet0/0/0/0
RP/0/RSP0/CPU0:ASR9901-2#
RP/0/RSP0/CPU0:ASR9901-2#
RP/0/RSP0/CPU0:ASR9901-2#show bgp vrf ORANGE
Wed Oct 19 22:21:34.887 UTC
BGP VRF ORANGE, state: Active
BGP Route Distinguisher: 100:100
VRF ID: 0x60000003
BGP router identifier 10.10.10.10, local AS number 100
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000012 RD version: 9
BGP main routing table version 9
BGP NSR Initial initsync version 4 (Reached)
BGP NSR/ISSU Sync-Group versions 0/0
Status codes: s suppressed, d damped, h history, * valid, > best
i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 100:100 (default for vrf ORANGE)
*> 172.16.20.0/24 0.0.0.0 0 32768 i *> 192.168.10.0/24 0.0.0.0 0 32768 i
Processed 2 prefixes, 2 paths