[关闭]
@seandor 2016-06-28T03:01:45.000000Z 字数 5967 阅读 3063

BFD测试及配置方法小结

BFD 测试


1. 引子

IGP路由协议如OSPF,ISIS本身就具有故障检测的能力,这些协议通常通过互相发送Hello报文用于协商和建立邻居。邻居建立完成后,Hello包仍然会每隔一定的时间发送一次并回复收到的Hello报文,这种行为就像设备的心跳一样,只要心跳一直存在就标明设备功能正常,反之如果发送出去的Hello包一直没有收到回复,那么协议就认为邻居挂了。这种设备间互相发送Hello包的机制被称为慢Hello机制,它的缺点是只能提供秒级的检测,对于时延敏感的业务(如语音业务),超过1秒的延迟也是无法忍受的。而BFD提供了一种快速故障检测的方法。

2. BFD简介

BFD(Bidirectional Forwaring Detection)是一个用于检测网络故障的协议,可以实现毫秒级的检测。BFD的原理和IGP协议自带的Hello报文类似,简单来说就是高速地发送Hello报文,因此可以更快地检测到故障。

BFD可以为多种上层应用(如OSPF,ISIS协议,MSPW业务等)提供故障检测服务。BFD的测试和配置方法大同小异,这里简要总结一下BFD在我司CITRANS 8000系列设备上的测试及配置方法。

3. BFD测试方法及详细配置命令

3.1 BFD for IP

原理简介: 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,这样就可以通过断一根纤得到多个测试结果,从而大大提高测试效率。

测试拓扑

上图仅适用于单跳检测。

配置命令:

3.2 BFD for BGP单跳和多跳

BFD for BGP原理简介
BGP协议通过周期性的向对等体发送Keepalive报文来实现邻居检测机制,但这种机制检测到故障所需时间比较长,超过1秒钟。当数据达到Gbit/s速率级别时,将会导致大量的数据丢失。因此,BGP协议通过引入BFD与BGP联动功能,利用BFD的快速检测机制,迅速发现BGP对等体间链路的故障,并报告给BGP协议,从而实现BGP路由的快速收敛。

3.2.1 BFD for BGP单跳

原理简介: 涉及两台设备,设备间配置E-BGP邻居。

测试方法: 测试环境和上面BFD for IP的环境一样,都是通过两根光纤,仪表打流,形成ECMP,断开其中一根光纤,测试BFD for BGP单跳的倒换时间。

配置命令:
均在BGP视图下配置:

  1. ! B1
  2. router bgp 100
  3. bgp router-id 1.1.1.1
  4. neighbor 20.0.1.2 remote-as 101
  5. neighbor 20.0.1.2 update-source 20.0.1.1
  6. neighbor 20.0.1.2 fall-over bfd
  7. neighbor 20.0.1.2 bfd interval mintx 30 minrx 30 multiplier 3
  8. neighbor 20.0.2.2 remote-as 101
  9. neighbor 20.0.2.2 update-source 20.0.2.1
  10. neighbor 20.0.2.2 fall-over bfd
  11. neighbor 20.0.2.2 bfd interval mintx 30 minrx 30 multiplier 3
  12. exit
  13. ! B2
  14. router bgp 101
  15. bgp router-id 2.2.2.2
  16. neighbor 20.0.1.1 remote-as 100
  17. neighbor 20.0.1.1 update-source 20.0.1.2
  18. neighbor 20.0.1.1 fall-over bfd
  19. neighbor 20.0.1.1 bfd interval mintx 30 minrx 30 multiplier 3
  20. neighbor 20.0.2.1 remote-as 100
  21. neighbor 20.0.2.1 update-source 20.0.2.2
  22. neighbor 20.0.2.1 fall-over bfd
  23. neighbor 20.0.2.1 bfd interval mintx 30 minrx 30 multiplier 3
  24. exit
3.2.2 BFD for BGP多跳

原理简介:

测试方法:测试环境如下图所示,DUT1和DUT2,DUT2和DUT4,DUT1和DUT3,DUT3和DUT4互相建立IBGP邻居,并配置BFD for BGP多跳。使用仪表以DUT1 port1为源,DUT4 port1 为目的打流,保证流量形成ECMP,制造节点DUT2或DUT3故障,这时BFD for BGP多跳应该能快速检测到故障,并触发倒换。

4个设备.png-38.5kB

该实验拓扑可以进行本文中的大部分测试项目

配置命令:
均在BGP视图下配置:

  1. ! B1
  2. router bgp 100
  3. bgp router-id 1.1.1.1
  4. neighbor 2.2.2.2 remote-as 100
  5. neighbor 2.2.2.2 update-source 1.1.1.1
  6. neighbor 2.2.2.2 fall-over bfd multihop
  7. neighbor 2.2.2.2 bfd interval mintx 30 minrx 30 multiplier 3
  8. exit

3.3 BFD for PW

3.3.1 BFD for PW

原理简介: BFD为PW提供快速故障检测。

测试方法: 使用三台设备,利用主备PW测试。DUT1到DUT2为PW主用路径,DUT1到DUT3为备用PW路径,仪表打流,默认的是走主用路径;制造主用路径链路故障,触发PW主备倒换。

此处开始“两台设备”均指BFD for IP所用图示,两台以上设备均指BFD for BGP所用图示。

配置命令:分别在设备和仪表互联口下配置PW,在全局模式下配置BFD for PW。(备用配置略)

  1. interface gigabitethernet 0/3/1/16.99
  2. l2transport
  3. vlan-type dot1q 99
  4. mpls l2-circuit VC_B1_B2_101 101 2.2.2.2 control-word bfd encapsulation tagged
  5. exit
  6. mpls static-bfd pw-name VC_B1_B2_101 local-discriminator 101 remote-discriminator 201 bind-bfd standard-tpm encap-type 1
  7. ! dynamic bfd
  8. interface gigabitethernet 0/3/1/16.99
  9. l2transport
  10. vlan-type dot1q 99
  11. mpls l2-circuit VC_B1_B2_101 101 2.2.2.2 control-word bfd encapsulation raw vccv cc 4 bfd-cv-type 2
  12. exit
  13. mpls dynamic-bfd pw-name VC_B1_B2_101 bind-bfd standard-tpm encap-type 1 lsp-ping-disable
3.3.2 BFD for MS-PW

原理简介: BFD为PW提供快速故障检测。

测试方法: 使用四台设备,利用主备MS-PW测试。DUT1-DUT2-DUT4为MS-PW主用路径,DUT1-DUT3-DUT4为备用MS-PW路径,仪表打流,默认的是走主用路径;制造主用路径任意节点或链路故障,触发MS-PW主备倒换。

配置命令:分为起始节点和中间节点两部分配置。BFD配置仅在起始节点。动态BFD的配置方法参考BFD for PW。

  1. ! start node or end node
  2. interface gigabitethernet 0/3/1/16.98
  3. l2transport
  4. vlan-type dot1q 98
  5. mpls l2-circuit VC_B1_B2_501 501 2.2.2.2 control-word bfd encapsulation tagged
  6. mpls l2-circuit VC_B1_B3_502 502 3.3.3.3 control-word bfd secondary redundancy encapsulation tagged
  7. exit
  8. ! middle node
  9. mpls ss-pw VC_B1_B2_501 501 1.1.1.1 control-word bfd encap-tagged
  10. mpls ss-pw VC_B4_B2_503 503 4.4.4.4 control-word bfd encap-tagged
  11. mpls ms-pw vc_B1_B4_1 VC_B1_B2_501 VC_B4_B2_503
  12. ! bfd config
  13. mpls static-bfd pw-name VC_B1_B2_501 local-discriminator 203 remote-discriminator 101 bind-bfd standard-tpm encap-type 1
  14. mpls static-bfd pw-name VC_B1_B3_502 local-discriminator 204 remote-discriminator 102 bind-bfd standard-tpm encap-type 1

3.4 BFD for LDP && BFD for RSVP LSP

3.4.1 BFD for LDP

原理简介: BFD为LDP LSP提供快速故障检测。

测试方法:

配置命令:只需要在设备LDP进程中使能即可。

  1. targeted-peer ipv4 1.1.1.1
  2. bfd enable
  3. exit
3.4.2 BFD for RSVP LSP

原理简介: BFD为LDP RSVP LSP提供快速故障检测。

测试方法: 使用两台设备,全局使能rsvp;配置并使能IGP-TE,如果使用ISIS,目前只支持P2P类型的接口;配置Tunnel并绑定路径规则;配置BFD for Tunnel相关参数。通过在Tunnel中配置主路径,仪表打流,默认走在主用路径,制造主用路径故障,触发Tunnel主备倒换。

配置命令: Tunel路径规则中的IP地址为,路由表中下一跳IP地址。

  1. router rsvp
  2. exit
  3. router isis 100
  4. mpls traffic-eng router-id 1.1.1.1
  5. mpls traffic-eng level-2
  6. capability cspf 1
  7. exit
  8. interface gigabitethernet 0/3/1/1.100
  9. enable-rsvp
  10. exit
  11. interface gigabitethernet 0/3/1/2.100
  12. enable-rsvp
  13. exit
  14. rsvp-path p_main
  15. 20.0.1.2 include strict
  16. exit
  17. !
  18. rsvp-path p_backup
  19. 20.0.2.2 include strict
  20. exit
  21. interface tunnel 1
  22. description from-B1
  23. from 1.1.1.1
  24. to 2.2.2.2
  25. path p_main
  26. path p_backup secondary
  27. protect-type hot-standby
  28. mpls te commit
  29. exit
  30. mpls static-bfd tunnel-if-name tunnel1 lsp-main local-discriminator 1 remote-discriminator 1 bind-bfd standard-tpm
  31. mpls static-bfd tunnel-if-name tunnel1 lsp-backup local-discriminator 3 remote-discriminator 3 bind-bfd standard-tpm
  32. interface gigabitethernet 0/3/1/16.97
  33. l2transport
  34. vlan-type dot1q 97
  35. mpls l2-circuit B1_B2_100 100 2.2.2.2 tunnelif-name tunnel1 encapsulation raw
  36. exit

原理简介: BFD为link提供快速故障检测。

测试方法: 使用两台设备,配置lag,并绑定成员口。

配置命令: 224.0.0.184为默认组播地址。

  1. B1:
  2. interface lag 2
  3. no l2transport
  4. ip address 14.1.1.1/24
  5. lag-mode lacp-load
  6. lag-arithmetic source-destination-ip
  7. lag-mac-address 5490.9860.0001
  8. exit
  9. interface gigabitethernet 0/3/1/10
  10. lag 2 member
  11. bfd 1.1.1.1 224.0.0.184 local-discriminator 14 remote-discriminator 14 process-interface-status
  12. exit
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注