配置私网IP路由FRR示例
VPN site中的多个CE接入到同一台PE上时,配置私网IP FRR特性,当PE与CE之间转发不通时,可以快速将流量切换到另一条PE与CE相连的链路上。
组网需求
同一站点的不同私网CE对等体通过BGP接入到同一PE,PE通过CE对等体学到了多条到达同一私网前缀的IP VPN路由。当希望这些路由为主备关系时,可以配置私网IP路由的FRR。配置私网IP路由FRR功能后,PE上会生成去往该私网前缀的主备路由。当进行私网IP数据转发时,当主路由所在链路发生故障时,流量可以快速切换到备份路由所在的链路上。
如图7-57所示,PE与CE1、CE2之间建立EBGP邻居,PE到DeviceA的Loopback1有两条BGP路由可达,Link_A为最优路由所在的路径,Link_B为次优路由所在的路径。要求在PE上配置私网IP FRR特性,使链路Link_A出现转发故障时,IP流量可以快速切换到Link_B上。
配置注意事项
VPN FRR场景,主路径故障恢复后,会进行路径回切。在这个过程中,可能由于各个节点IGP收敛时序不同,造成回切丢包。为了解决这个问题,需要执行route-select delay delay-value命令,配置选路延迟功能,保证在主路径设备上的转发表项刷新稳定后再进行回切。具体的回切延迟时间delay-value与设备上实际路由数量等因素有关,用户需要根据实际情况合理配置。
配置思路
采用如下的思路配置私网IP路由FRR功能:
VPN站点内配置IGP,使得DeviceA的Loopback接口路由可以发送到CE1,CE2。
在PE上配置实例vpna,将GE1/0/0、GE2/0/0绑定到vpna上。
PE与CE1、CE2之间分别建立EBGP对等体。CE1、CE2上将IGP路由引入到BGP中,BGP路由引入到IGP中。
PE上使能私网BGP Auto FRR功能。
数据准备
为完成此配置例,需准备如下的数据:
PE上的VPN实例名称(vpna),VPN实例IPv4地址族的属性,如:RD(100:1),VPN Target(100:100)
CE1、CE2上将IGP路由引入到BGP中时,附加的MED值。
操作步骤
- VPN站点内配置路由器上各接口的IP地址
配置过程略,具体配置请参见后面的配置文件。
- VPN站点内配置IGP,使得DeviceA的Loopback接口路由可以发送到CE1,CE2。这里以OSPF为例
# 配置CE1。
[~CE1] ospf 1
[*CE1-ospf] area 0
[*CE1-ospf-1-area-0.0.0.0] network 10.3.1.0 0.0.0.255
[*CE1-ospf-1-area-0.0.0.0] quit
[*CE1-ospf] quit
[*CE1] commit
CE2、DeviceA上的配置与CE1类似,具体配置请参见后面的配置文件。
配置完成后,CE上运行命令display ip routing-table可以查看到CE1、CE2学习到DeviceA的Loopack 1接口路由。以CE1为例:
<CE1> display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Destinations : 12 Routes : 12 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 Direct 0 0 D 10.1.1.2 GigabitEthernet1/0/0 10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet1/0/0 10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet1/0/0 11.11.11.11/32 OSPF 10 1 D 10.3.1.2 GigabitEthernet2/0/0 10.3.1.0/24 Direct 0 0 D 10.3.1.1 GigabitEthernet2/0/0 10.3.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet2/0/0 10.3.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet2/0/0 10.4.1.0/24 OSPF 10 2 D 10.3.1.2 GigabitEthernet2/0/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
- 在PE上配置VPN实例,并将连接CE的接口与VPN实例绑定
# 在PE上配置VPN实例vpna,并将vpna与接口GE1/0/0和GE2/0/0绑定。
<PE> system-view
[~PE] ip vpn-instance vpna
[*PE-vpn-instance-vpna] ipv4-family
[*PE-vpn-instance-vpna-af-ipv4] route-distinguisher 100:1
[*PE-vpn-instance-vpna-af-ipv4] vpn-target 100:100
[*PE-vpn-instance-vpna-af-ipv4] quit
[*PE-vpn-instance-vpna] quit
[*PE] interface gigabitethernet 1/0/0
[*PE-GigabitEthernet1/0/00] ip binding vpn-instance vpna
[*PE-GigabitEthernet1/0/0] ip address 10.1.1.1 24
[*PE-GigabitEthernet1/0/0] quit
[*PE] interface gigabitethernet 2/0/0
[*PE-GigabitEthernet2/0/0] ip binding vpn-instance vpna
[*PE-GigabitEthernet2/0/0] ip address 10.2.1.1 24
[*PE-GigabitEthernet2/0/0] commit
[~PE] quit
- 配置PE与CE之间建立EBGP邻居
# 配置PE。
[~PE] bgp 100
[*PE-bgp] ipv4-family vpn-instance vpna
[*PE-bgp-vpna] peer 10.1.1.2 as-number 65410
[*PE-bgp-vpna] peer 10.2.1.2 as-number 65410
[*PE-bgp-vpna] quit
[*PE-bgp] commit
[*PE-bgp] quit
# 配置CE1。
[*CE1] bgp 65410
[*CE1-bgp] peer 10.1.1.1 as-number 100
[*CE1-bgp] commit
[*CE1-bgp] quit
# 配置CE2。
[*CE2] bgp 65410
[*CE2-bgp] peer 10.2.1.1 as-number 100
[*CE2-bgp] commit
[~CE2-bgp] quit
配置完成后,PE上运行命令display bgp vpnv4 vpn-instance vpna peer,可以看到PE与CE之间的EBGP对等体状态为Established,说明PE与CE之间的EBGP对等体已建立。
<PE> display bgp vpnv4 vpn-instance vpna peer BGP local router ID : 1.1.1.9 Local AS number : 100 Total number of peers : 2 Peers in established state : 2 Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv 10.1.1.2 4 65410 21 23 0 00:17:47 Established 1 10.2.1.2 4 65410 51 64 0 00:15:03 Established 1
- CE上配置BGP路由与OSPF路由的交互
# 配置CE1。
[*CE1] bgp 65410
[*CE1-bgp] network 11.11.11.11 32
[*CE1-bgp] quit
[*CE1] ospf 1
[*CE1-ospf-1] import-route bgp
[*CE1-ospf-1] quit
[*CE1] commit
# 配置CE2。
[*CE2] bgp 65410
[*CE2-bgp] network 11.11.11.11 32
[*CE2-bgp] quit
[*CE2] ospf 1
[*CE2-ospf-1] import-route bgp
[*CE2-ospf-10] quit
[*CE2] commit
配置完成后,PE上运行命令display ip routing-table vpn-instance可以查看到DeviceA上的Loopback接口路由。
<PE> display ip routing-table vpn-instance vpna display ip routing-table vpn-instance vpna Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : vpna Destinations : 8 Routes : 8 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet1/0/0 10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet1/0/0 10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet1/0/0 11.11.11.11/32 EBGP 255 1 RD 10.1.1.2 GigabitEthernet1/0/0 10.2.1.0/24 Direct 0 0 D 10.2.1.1 GigabitEthernet2/0/0 10.2.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet2/0/0 10.2.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet2/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
- PE上使能私网BGP Auto FRR功能
# 配置PE。
[~PE] bgp 100
[~PE-bgp] ipv4-family vpn-instance vpna
[*PE-bgp-vpna] auto-frr
[*PE-bgp-vpna] route-select delay 300
[*PE-bgp-vpna] quit
[*PE-bgp] quit
[*PE] commit
BGP-VPN实例IPv4地址下配置auto-frr命令,只适用于PE与CE之间运行BGP协议的组网。
- 检查配置结果
PE上运行命令display ip routing-table vpn-instance,可以看到PE上到11.11.11.11/32的路由下一跳为10.1.1.2,且有备份下一跳、备份出接口。
<PE> display ip routing-table vpn-instance vpna 11.11.11.11 verbose Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : vpna Summary Count : 1 Destination: 11.11.11.11/32 Protocol: EBGP Process ID: 0 Preference: 255 Cost: 1 NextHop: 10.1.1.2 Neighbour: 0.0.0.0 State: Active Adv Relied Age: 00h35m31s Tag: 0 Priority: low Label: NULL QoSInfo: 0x0 IndirectID: 0xc7 RelayNextHop: 10.1.1.2 Interface: GigabitEthernet1/0/0 TunnelID: 0x0 Flags: RD BkNextHop: 10.2.1.2 BkInterface: GigabitEthernet2/0/0 BkLabel: NULL SecTunnelID: 0x0 BkPETunnelID: 0x0 BkPESecTunnelID: 0x0 BkIndirectID: 0xc8
CE1的GE2/0/0接口下执行shutdown命令模拟链路故障。
[~CE1] interface Gigabitethernet2/0/0
[*CE1-GigabitEthernet2/0/0] shutdown
[*CE1-GigabitEthernet2/0/0] commit
[~CE1] quit
PE上再次运行命令display ip routing-table vpn-instance,可以看到PE上到11.11.11.11/32的路由下一跳为10.2.1.2,且没有备份下一跳、备份出接口。
<PE> display ip routing-table vpn-instance vpna 11.11.11.11 verbose Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : vpna Summary Count : 1 Destination: 11.11.11.11/32 Protocol: EBGP Process ID: 0 Preference: 255 Cost: 1 NextHop: 10.2.1.2 Neighbour: 0.0.0.0 State: Active Adv Relied Age: 00h00m04s Tag: 0 Priority: low Label: NULL QoSInfo: 0x0 IndirectID: 0xc8 RelayNextHop: 10.2.1.2 Interface: GigabitEthernet2/0/0 TunnelID: 0x0 Flags: RD
综上所述,私网IP路由 FRR功能已经生效。
配置文件
- PE的配置文件
# sysname PE # ip vpn-instance vpna ipv4-family route-distinguisher 100:1 apply-label per-instance vpn-target 100:100 export-extcommunity vpn-target 100:100 import-extcommunity # interface GigabitEthernet1/0/0 undo shutdown ip binding vpn-instance vpna ip address 10.1.1.1 255.255.255.0 # interface GigabitEthernet2/0/0 undo shutdown ip binding vpn-instance vpna ip address 10.2.1.1 255.255.255.0 # bgp 100 # ipv4-family unicast undo synchronization # ipv4-family vpn-instance vpna auto-frr route-select delay 300 peer 10.1.1.2 as-number 65410 peer 10.2.1.2 as-number 65410 # return
- CE1的配置文件
# sysname CE1 # interface GigabitEthernet1/0/0 undo shutdown ip address 10.1.1.2 255.255.255.0 # interface GigabitEthernet2/0/0 undo shutdown ip address 10.3.1.1 255.255.255.0 # bgp 65410 peer 10.1.1.1 as-number 100 # ipv4-family unicast undo synchronization network 11.11.11.11 255.255.255.255 peer 10.1.1.1 enable # ospf 1 import-route bgp area 0.0.0.0 network 10.3.1.0 0.0.0.255 # return
- CE2的配置文件
# sysname CE2 # interface GigabitEthernet1/0/0 undo shutdown ip address 10.2.1.2 255.255.255.0 # interface GigabitEthernet2/0/0 undo shutdown ip address 10.4.1.1 255.255.255.0 # bgp 65410 peer 10.2.1.1 as-number 100 # ipv4-family unicast undo synchronization network 11.11.11.11 255.255.255.255 peer 10.2.1.1 enable # ospf 1 import-route bgp area 0.0.0.0 network 10.4.1.0 0.0.0.255 # return
DeviceA的配置文件
# sysname DeviceA # interface GigabitEthernet1/0/0 undo shutdown ip address 10.3.1.2 255.255.255.0 # interface GigabitEthernet2/0/0 undo shutdown ip address 10.4.1.2 255.255.255.0 # interface LoopBack1 ip address 11.11.11.11/128 # ospf 1 area 0.0.0.0 network 11.11.11.11 0.0.0.0 network 10.3.1.0 0.0.0.255 network 10.4.1.0 0.0.0.255 # return