配置静态BFD for RIP特性示例
介绍如何在RIP网络中配置静态BFD for RIP。
组网需求
RIP通过周期性的向邻居发送更新报文来实现邻居检测,缺省情况下如果经过6个更新周期(180s)的时间没有收到邻居的更新报文则认为邻居Down,即如果发生链路故障RIP能够检测到的时间为180s。
随着科技的发展,语音、视频及其它点播业务应用广泛,而这些业务对于丢包和延时非常敏感,较长的检测时间会导致大量数据丢失,无法满足电信级网络高可靠性的需求。通过配置BFD for RIP特性,可以快速检测链路的状态,故障检测时间可以达到毫秒级,提高链路状态变化时RIP的收敛速度。
如图7-11所示:
- DeviceA、DeviceB、DeviceC及DeviceD之间运行RIP协议。
- 业务流量经过主链路DeviceA→ DeviceB→DeviceD进行传输。在DeviceA和DeviceB相连的链路接口上使能静态BFD。当主链路发生故障,BFD可以快速的检测到并通知RIP,业务流量会快速切换到备份路径进行传输。
数据准备
为完成此配置例,需准备如下数据:
DeviceA:RIP进程号1,RIP版本号2,接口GE0/1/0及接口GE0/2/0的IP地址分别为2.2.2.1/24、3.3.3.1/24。
DeviceB:RIP进程号1,RIP版本号2,接口GE0/1/0、接口GE0/2/0以及接口GE0/3/0的IP地址分别为2.2.2.2/24、4.4.4.1/24、172.16.1.1/24。
DeviceC:RIP进程号1,RIP版本号2,接口GE0/1/0及接口GE0/2/0的IP地址分别为4.4.4.2/24、3.3.3.2/24。
DeviceD:RIP进程号1,RIP版本号2,接口GE0/1/0的IP地址172.16.1.2/24。
DeviceA和DeviceB之间建立BFD会话的本地标识符和远端标识符。
操作步骤
- 配置各接口的IP地址
- 配置RIP的基本功能
# 配置DeviceA。
<DeviceA> system-view
[~DeviceA] rip 1
[*DeviceA-rip-1] version 2
[*DeviceA-rip-1] network 2.0.0.0
[*DeviceA-rip-1] network 3.0.0.0
[*DeviceA-rip-1] commit
[~DeviceA-rip-1] quit
# 配置DeviceB。
<DeviceB> system-view
[~DeviceB] rip 1
[*DeviceB-rip-1] version 2
[*DeviceB-rip-1] network 2.0.0.0
[*DeviceB-rip-1] network 4.0.0.0
[*DeviceB-rip-1] network 172.16.0.0
[*DeviceB-rip-1] commit
[~DeviceB-rip-1] quit
# 配置DeviceC。
<DeviceC> system-view
[~DeviceC] rip 1
[*DeviceC-rip-1] version 2
[*DeviceC-rip-1] network 3.0.0.0
[*DeviceC-rip-1] network 4.0.0.0
[*DeviceC-rip-1] commit
[~DeviceC-rip-1] quit
# 配置DeviceD。
<DeviceD> system-view
[~DeviceD] rip 1
[*DeviceD-rip-1] version 2
[*DeviceD-rip-1] network 172.16.0.0
[*DeviceD-rip-1] commit
[~DeviceD-rip-1] quit
# 完成上述操作之后,执行命令display rip neighbor,可以查看到DeviceA、DeviceB以及DeviceC之间已经建立了邻居关系。以DeviceA的显示为例。
[~DeviceA] display rip 1 neighbor
--------------------------------------------------------------------- IP Address Interface Type Last-Heard-Time --------------------------------------------------------------------- 3.3.3.2 GigabitEthernet0/2/0 RIP 0:0:5 Number of RIP routes :2 2.2.2.2 GigabitEthernet0/1/0 RIP 0:0:5 Number of RIP routes :4
# 执行命令display ip routing-table,可以查看到完成配置的路由器之间可以互相引入路由,以DeviceA的显示为例。
[~DeviceA] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Destinations : 15 Routes : 15 Destination/Mask Proto Pre Cost Flags NextHop Interface 3.0.0.0/8 RIP 100 3 D 3.3.3.2 GigabitEthernet0/2/0 3.3.3.0/24 Direct 0 0 D 3.3.3.1 GigabitEthernet0/2/0 3.3.3.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 3.3.3.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 2.0.0.0/8 RIP 100 3 D 2.2.2.2 GigabitEthernet0/1/0 2.2.2.0/24 Direct 0 0 D 2.2.2.1 GigabitEthernet0/1/0 2.2.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 2.2.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/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 172.16.0.0/16 RIP 100 4 D 2.2.2.2 GigabitEthernet0/1/0 172.16.1.0/24 RIP 100 1 D 2.2.2.2 GigabitEthernet0/1/0 4.4.4.0/24 RIP 100 1 D 3.3.3.2 GigabitEthernet0/2/0 RIP 100 1 D 2.2.2.2 GigabitEthernet0/1/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
由路由表可以看出,去往目的地172.16.0.0/16的下一跳地址是2.2.2.2,出接口是GigabitEthernet0/1/0,流量在主链路DeviceA→DeviceB上进行传输。
- 配置静态BFD特性
# 配置DeviceA的静态BFD特性。
[~DeviceA] bfd
[*DeviceA-bfd] quit
[*DeviceA] bfd 1 bind peer-ip 2.2.2.2 interface gigabitethernet0/1/0 source-ip 2.2.2.1
[*DeviceA-bfd-session-1] discriminator local 1
[*DeviceA-bfd-session-1] discriminator remote 2
[*DeviceA-bfd-session-1] commit
[~DeviceA-bfd-session-1] quit
[~DeviceA] interface gigabitethernet0/1/0
[~HUAWEIA-GigabitEthernet0/1/0] rip bfd static
# 配置DeviceB的静态BFD特性。
[~DeviceB] bfd
[*DeviceB-bfd] quit
[*DeviceB] bfd 1 bind peer-ip 2.2.2.1 interface gigabitethernet0/1/0 source-ip 2.2.2.2
[*DeviceB-bfd-session-1] discriminator local 2
[*DeviceB-bfd-session-1] discriminator remote 1
[*DeviceB-bfd-session-1] commit
[~DeviceB-bfd-session-1] quit
[~DeviceB] interface gigabitethernet0/1/0
[~HUAWEIB-GigabitEthernet0/1/0] rip bfd static
# 完成上述配置之后,在DeviceA上执行命令display bfd session all可以查看静态BFD会话已经建立。
[~DeviceA] display bfd session all
(w): State in WTR (*): State is invalid ------------------------------------------------------------------------------ Local Remote PeerIpAddr State Type InterfaceName ------------------------------------------------------------------------------ 1 2 2.2.2.2 Up S_IP_IF GigabitEthernet0/1/0 ------------------------------------------------------------------------------ Total UP/DOWN Session Number : 1/0
- 检查配置结果
# 在DeviceB的接口GigabitEthernet0/1/0上执行shutdown命令,模拟主链路故障。
模拟链路故障为验证需要,在实际应用中不需要执行此操作。
[~DeviceB] interface gigabitethernet0/1/0
[~DeviceB-GigabitEthernet0/1/0] shutdown
[*DeviceB-GigabitEthernet0/1/0] commit
# 查看DeviceA的BFD会话信息,可以看到DeviceA及DeviceB之间不存在BFD会话信息。
# 查看DeviceA的路由表。
[~DeviceA] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Destinations : 8 Routes : 8 Destination/Mask Proto Pre Cost Flags NextHop Interface 3.3.3.0/24 Direct 0 0 D 3.3.3.1 GigabitEthernet0/2/0 3.3.3.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 3.3.3.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/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 172.16.1.0/24 RIP 100 2 D 3.3.3.2 GigabitEthernet0/2/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
由路由表可以看出,在主链路发生故障之后备份链路DeviceA→DeviceC→DeviceB被启用,去往172.16.1.0/24的路由下一跳地址是3.3.3.2,出接口为GigabitEthernet0/2/0。
配置文件
DeviceA的配置文件
#
sysname DeviceA
#
bfd
#
interface gigabitethernet0/1/0
undo shutdown
ip address 2.2.2.1 255.255.255.0
rip bfd static
#
interface gigabitethernet0/2/0
undo shutdown
ip address 3.3.3.1 255.255.255.0
#
rip 1
version 2
network 2.0.0.0
network 3.0.0.0
#
bfd 1 bind peer-ip 2.2.2.2 interface gigabitethernet0/1/0 source-ip 2.2.2.1
discriminator local 1
discriminator remote 2
#
return
DeviceB的配置文件
#
sysname DeviceB
#
bfd
#
interface gigabitethernet0/1/0
undo shutdown
ip address 2.2.2.2 255.255.255.0
rip bfd static
#
interface gigabitethernet0/2/0
undo shutdown
ip address 4.4.4.1 255.255.255.0
#
interface gigabitethernet0/3/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
rip 1
version 2
network 2.0.0.0
network 4.0.0.0
network 172.16.0.0
#
bfd 1 bind peer-ip 2.2.2.1 interface gigabitethernet0/1/0 source-ip 2.2.2.2
discriminator local 2
discriminator remote 1
#
return
DeviceC的配置文件。
#
sysname DeviceC
#
interface gigabitethernet0/1/0
undo shutdown
ip address 4.4.4.2 255.255.255.0
#
interface gigabitethernet0/2/0
undo shutdown
ip address 3.3.3.2 255.255.255.0
#
rip 1
version 2
network 3.0.0.0
network 4.0.0.0
#
return
DeviceD的配置文件。
#
sysname DeviceD
#
interface gigabitethernet0/1/0
undo shutdown
ip address 172.16.1.2 255.255.255.0
#
rip 1
version 2
network 172.16.0.0
#
return