@seandor
2016-06-28T03:01:45.000000Z
字数 5967
阅读 3063
BFD
测试
IGP路由协议如OSPF,ISIS本身就具有故障检测的能力,这些协议通常通过互相发送Hello报文用于协商和建立邻居。邻居建立完成后,Hello包仍然会每隔一定的时间发送一次并回复收到的Hello报文,这种行为就像设备的心跳一样,只要心跳一直存在就标明设备功能正常,反之如果发送出去的Hello包一直没有收到回复,那么协议就认为邻居挂了。这种设备间互相发送Hello包的机制被称为慢Hello机制,它的缺点是只能提供秒级的检测,对于时延敏感的业务(如语音业务),超过1秒的延迟也是无法忍受的。而BFD提供了一种快速故障检测的方法。
BFD(Bidirectional Forwaring Detection)是一个用于检测网络故障的协议,可以实现毫秒级的检测。BFD的原理和IGP协议自带的Hello报文类似,简单来说就是高速地发送Hello报文,因此可以更快地检测到故障。
BFD可以为多种上层应用(如OSPF,ISIS协议,MSPW业务等)提供故障检测服务。BFD的测试和配置方法大同小异,这里简要总结一下BFD在我司CITRANS 8000系列设备上的测试及配置方法。
原理简介: BFD为IP层提供故障检测。按我司测试用例的细分,BFD for IP包括了BFD for ip(connected), BFD for 静态路由, BFD for IGP。BFD检测IP链路支持单跳河多跳检测:
测试方法: 按下图所示的拓扑搭建测试环境。举例来说,如果要测BFD for IP,BFD for 静态路由,BFD for OSPF,BFD for ISIS的倒换时间等,只需要在DUT1和DUT2上分别建立相同数量的VRF,并将互联的两条物理链路按VLAN划分相同数量的子接口并加入对应的VRF,这样就可以将不同的BFD配置隔离开来,仪表将设备串起来打流,会在两条物理链路上形成ECMP,这样就可以通过断一根纤得到多个测试结果,从而大大提高测试效率。
上图仅适用于单跳检测。
配置命令:
bfd 1.1.1.1(src-ip) 1.1.1.2(dst-ip)
BFD for 静态路由,需要先配置静态路由,再配置对应的BFD:
! B1
ip route 50.0.0.0/24 gigabitethernet 0/1/1/19.100 1.1.1.5
ip static 50.0.0.0/24 1.1.1.5 source 1.1.1.6 fall-over bfd /*local-discriminator 1 remote-discriminator 1*/ bfd-interval mintx 3 minrx 3 multiplier 3
! B2
ip route 10.0.0.0/24 gigabitethernet 0/1/1/20.100 1.1.1.6
ip static 10.0.0.0/24 1.1.1.6 source 1.1.1.5 fall-over bfd /*local-discriminator 1 remote-discriminator 1*/ bfd-interval mintx 3 minrx 3 multiplier 3
BFD for IGP, 这里主要介绍OSPF和ISIS两种IGP协议上BFD的配置方法。OSPF和ISIS的BFD都是直接在相应接口下配置:
! OSPF
ip ospf bfd
bfd interval mintx 30 minrx 30
! ISIS
isis bfd
bfd interval mintx 30 minrx 30
BFD for BGP原理简介
BGP协议通过周期性的向对等体发送Keepalive报文来实现邻居检测机制,但这种机制检测到故障所需时间比较长,超过1秒钟。当数据达到Gbit/s速率级别时,将会导致大量的数据丢失。因此,BGP协议通过引入BFD与BGP联动功能,利用BFD的快速检测机制,迅速发现BGP对等体间链路的故障,并报告给BGP协议,从而实现BGP路由的快速收敛。
原理简介: 涉及两台设备,设备间配置E-BGP邻居。
测试方法: 测试环境和上面BFD for IP的环境一样,都是通过两根光纤,仪表打流,形成ECMP,断开其中一根光纤,测试BFD for BGP单跳的倒换时间。
配置命令:
均在BGP视图下配置:
! B1
router bgp 100
bgp router-id 1.1.1.1
neighbor 20.0.1.2 remote-as 101
neighbor 20.0.1.2 update-source 20.0.1.1
neighbor 20.0.1.2 fall-over bfd
neighbor 20.0.1.2 bfd interval mintx 30 minrx 30 multiplier 3
neighbor 20.0.2.2 remote-as 101
neighbor 20.0.2.2 update-source 20.0.2.1
neighbor 20.0.2.2 fall-over bfd
neighbor 20.0.2.2 bfd interval mintx 30 minrx 30 multiplier 3
exit
! B2
router bgp 101
bgp router-id 2.2.2.2
neighbor 20.0.1.1 remote-as 100
neighbor 20.0.1.1 update-source 20.0.1.2
neighbor 20.0.1.1 fall-over bfd
neighbor 20.0.1.1 bfd interval mintx 30 minrx 30 multiplier 3
neighbor 20.0.2.1 remote-as 100
neighbor 20.0.2.1 update-source 20.0.2.2
neighbor 20.0.2.1 fall-over bfd
neighbor 20.0.2.1 bfd interval mintx 30 minrx 30 multiplier 3
exit
原理简介:
测试方法:测试环境如下图所示,DUT1和DUT2,DUT2和DUT4,DUT1和DUT3,DUT3和DUT4互相建立IBGP邻居,并配置BFD for BGP多跳。使用仪表以DUT1 port1为源,DUT4 port1 为目的打流,保证流量形成ECMP,制造节点DUT2或DUT3故障,这时BFD for BGP多跳应该能快速检测到故障,并触发倒换。
该实验拓扑可以进行本文中的大部分测试项目
配置命令:
均在BGP视图下配置:
! B1
router bgp 100
bgp router-id 1.1.1.1
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source 1.1.1.1
neighbor 2.2.2.2 fall-over bfd multihop
neighbor 2.2.2.2 bfd interval mintx 30 minrx 30 multiplier 3
exit
原理简介: BFD为PW提供快速故障检测。
测试方法: 使用三台设备,利用主备PW测试。DUT1到DUT2为PW主用路径,DUT1到DUT3为备用PW路径,仪表打流,默认的是走主用路径;制造主用路径链路故障,触发PW主备倒换。
此处开始“两台设备”均指BFD for IP所用图示,两台以上设备均指BFD for BGP所用图示。
配置命令:分别在设备和仪表互联口下配置PW,在全局模式下配置BFD for PW。(备用配置略)
interface gigabitethernet 0/3/1/16.99
l2transport
vlan-type dot1q 99
mpls l2-circuit VC_B1_B2_101 101 2.2.2.2 control-word bfd encapsulation tagged
exit
mpls static-bfd pw-name VC_B1_B2_101 local-discriminator 101 remote-discriminator 201 bind-bfd standard-tpm encap-type 1
! dynamic bfd
interface gigabitethernet 0/3/1/16.99
l2transport
vlan-type dot1q 99
mpls l2-circuit VC_B1_B2_101 101 2.2.2.2 control-word bfd encapsulation raw vccv cc 4 bfd-cv-type 2
exit
mpls dynamic-bfd pw-name VC_B1_B2_101 bind-bfd standard-tpm encap-type 1 lsp-ping-disable
原理简介: BFD为PW提供快速故障检测。
测试方法: 使用四台设备,利用主备MS-PW测试。DUT1-DUT2-DUT4为MS-PW主用路径,DUT1-DUT3-DUT4为备用MS-PW路径,仪表打流,默认的是走主用路径;制造主用路径任意节点或链路故障,触发MS-PW主备倒换。
配置命令:分为起始节点和中间节点两部分配置。BFD配置仅在起始节点。动态BFD的配置方法参考BFD for PW。
! start node or end node
interface gigabitethernet 0/3/1/16.98
l2transport
vlan-type dot1q 98
mpls l2-circuit VC_B1_B2_501 501 2.2.2.2 control-word bfd encapsulation tagged
mpls l2-circuit VC_B1_B3_502 502 3.3.3.3 control-word bfd secondary redundancy encapsulation tagged
exit
! middle node
mpls ss-pw VC_B1_B2_501 501 1.1.1.1 control-word bfd encap-tagged
mpls ss-pw VC_B4_B2_503 503 4.4.4.4 control-word bfd encap-tagged
mpls ms-pw vc_B1_B4_1 VC_B1_B2_501 VC_B4_B2_503
! bfd config
mpls static-bfd pw-name VC_B1_B2_501 local-discriminator 203 remote-discriminator 101 bind-bfd standard-tpm encap-type 1
mpls static-bfd pw-name VC_B1_B3_502 local-discriminator 204 remote-discriminator 102 bind-bfd standard-tpm encap-type 1
原理简介: BFD为LDP LSP提供快速故障检测。
测试方法:
配置命令:只需要在设备LDP进程中使能即可。
targeted-peer ipv4 1.1.1.1
bfd enable
exit
原理简介: BFD为LDP RSVP LSP提供快速故障检测。
测试方法: 使用两台设备,全局使能rsvp;配置并使能IGP-TE,如果使用ISIS,目前只支持P2P类型的接口;配置Tunnel并绑定路径规则;配置BFD for Tunnel相关参数。通过在Tunnel中配置主路径,仪表打流,默认走在主用路径,制造主用路径故障,触发Tunnel主备倒换。
配置命令: Tunel路径规则中的IP地址为,路由表中下一跳IP地址。
router rsvp
exit
router isis 100
mpls traffic-eng router-id 1.1.1.1
mpls traffic-eng level-2
capability cspf 1
exit
interface gigabitethernet 0/3/1/1.100
enable-rsvp
exit
interface gigabitethernet 0/3/1/2.100
enable-rsvp
exit
rsvp-path p_main
20.0.1.2 include strict
exit
!
rsvp-path p_backup
20.0.2.2 include strict
exit
interface tunnel 1
description from-B1
from 1.1.1.1
to 2.2.2.2
path p_main
path p_backup secondary
protect-type hot-standby
mpls te commit
exit
mpls static-bfd tunnel-if-name tunnel1 lsp-main local-discriminator 1 remote-discriminator 1 bind-bfd standard-tpm
mpls static-bfd tunnel-if-name tunnel1 lsp-backup local-discriminator 3 remote-discriminator 3 bind-bfd standard-tpm
interface gigabitethernet 0/3/1/16.97
l2transport
vlan-type dot1q 97
mpls l2-circuit B1_B2_100 100 2.2.2.2 tunnelif-name tunnel1 encapsulation raw
exit
原理简介: BFD为link提供快速故障检测。
测试方法: 使用两台设备,配置lag,并绑定成员口。
配置命令: 224.0.0.184为默认组播地址。
B1:
interface lag 2
no l2transport
ip address 14.1.1.1/24
lag-mode lacp-load
lag-arithmetic source-destination-ip
lag-mac-address 5490.9860.0001
exit
interface gigabitethernet 0/3/1/10
lag 2 member
bfd 1.1.1.1 224.0.0.184 local-discriminator 14 remote-discriminator 14 process-interface-status
exit