此产品的文档集力求使用非歧视性语言。在本文档集中,非歧视性语言是指不隐含针对年龄、残障、性别、种族身份、族群身份、性取向、社会经济地位和交叉性的歧视的语言。由于产品软件的用户界面中使用的硬编码语言、基于 RFP 文档使用的语言或引用的第三方产品使用的语言,文档中可能无法确保完全使用非歧视性语言。 深入了解思科如何使用包容性语言。
思科采用人工翻译与机器翻译相结合的方式将此文档翻译成不同语言,希望全球的用户都能通过各自的语言得到支持性的内容。 请注意:即使是最好的机器翻译,其准确度也不及专业翻译人员的水平。 Cisco Systems, Inc. 对于翻译的准确性不承担任何责任,并建议您总是参考英文原始文档(已提供链接)。
本文档介绍如何配置和验证基于Cisco Nexus NXOS®的交换机之间的双向转发检测(BFD)会话。
Cisco 建议您了解以下主题:
本文档中的信息基于NXOS版本10.3(4a)。M的Cisco Nexus 9000。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
配置BFD的目的是检测并了解各种路由协议配置之间的差异。
第1步:在接口和协议上配置BFD之前,必须启用BFD功能。
交换机 1 | 交换机 2 |
|
|
第2步:配置全局BFD
交换机 1 | 交换机 2 |
|
|
注意:min_tx和msec的范围为50到999毫秒,默认值为50。倍数范围是从1到50。倍数默认为3。
第3步:在接口上配置BFD
注意:您可以为接口上的所有BFD会话配置BFD会话参数。
警告:确保在启用BFD的接口上禁用互联网控制消息协议(ICMP)重定向消息。在接口上使用no ip redirects命令或
no ipv6 redirects命令。
交换机 1 | 交换机 2 |
|
|
BFD异步模式类似于两台设备之间的握手,目的是保持它们的连接牢固。您可以在两台设备上设置它,打开它后,它们将在设定的时间开始相互发送特殊消息。这些消息具有一些重要设置,例如发送频率,以及一台设备对另一台设备的响应速度。还有一个设置决定一台设备需要多少封未接消息才能意识到连接可能存在问题。
BFD回送功能将测试数据包发送到邻居,然后让它们返回以检查问题,而不让邻居参与数据包转发。它可以使用较慢的计时器来减少控制数据包流量并测试邻居系统上的转发路径,而不会干扰邻居,从而使检测速度更快。如果两个邻居都使用回声功能,则不存在不对称。
系统日志BFD关闭原因
- Path Down:这表示两个BFD邻居之间的转发路径不再运行,可能是因为网络拥塞、硬件故障或其他问题。
2024 Apr 11 22:07:07 SW2 %BFD-5-SESSION_STATE_DOWN: BFD session 1090519062 to neighbor 172.16.1.1 on interface Vlan20 has gone down. Reason: Path Down.
- Echo Function Failed:echo功能(BFD的一项功能,发送和接收回声数据包以验证连接)失败。如果这些数据包无法成功传输或接收,则表明存在问题。
2024 Apr 11 22:17:45 SW2 %BFD-5-SESSION_STATE_DOWN: BFD session 1090519174 to neighbor 10.10.10.1 on interface Vlan10 has gone down. Reason: Echo Function Failed.
- 邻居发信号会话关闭:邻居设备发出BFD会话关闭的信号,通常是因为检测到连接结束时出现问题。
2024 Apr 11 22:03:48 SW2 %BFD-5-SESSION_STATE_DOWN: BFD session 1090519058 to neighbor 172.16.1.1 on interface Vlan20 has gone down. Reason: Neighbor Signaled Session Down.
- Control Detection Time Expired:当控制检测计时器在收到来自邻居的预期响应之前超时时会发生这种情况,表示连接存在潜在问题。
2024 Apr 11 22:19:31 SW2 %BFD-5-SESSION_STATE_DOWN: BFD session 1090519061 to neighbor 192.168.2.1 on interface Lo30 has gone down. Reason: Control Detection Time Expired.
- 管理性关闭:管理员有意关闭BFD会话,原因可能是出于维护目的或由于配置更改。
2024 Apr 11 22:13:15 SW2 %BFD-5-SESSION_STATE_DOWN: BFD session 1090519064 to neighbor 10.10.10.1 on interface Vlan10 has gone down. Reason: Administratively Down.
在路由协议上配置BFD
在OSPF上配置BFD
提示:当在OSPF下启用BFD时,它对于使用OSPF的所有接口都变为活动状态。接口采用全局配置的值。如果需要对这些值进行调整,请参阅步骤3“接口上的BFD配置”。
交换机 1 | 交换机 2 |
|
|
它还可以使用命令在OSPF接口下启用BFD
ip ospf bfd
交换机 1 | 交换机 2 |
|
|
OSPF上的BFD配置示例
SW1# show running-config ospf !Command: show running-config ospf !Running configuration last done at: Wed Apr 10 21:06:31 2024 !Time: Wed Apr 10 21:09:45 2024 version 10.3(4a) Bios:version 01.07 feature ospf router ospf 1 bfd interface Vlan10 ip router ospf 1 area 0.0.0.0 ip ospf bfd
在EIGRP上配置BFD
SW1(config)# interface vlan 20 SW1(config-if)# ip eigrp 2 bfd
提示:当在EIGRP下启用BFD时,它对于使用EIGRP的所有接口都变为活动状态。接口采用全局配置的值。如果需要对这些值进行调整,请参阅步骤3“接口上的BFD配置”。
交换机 1 | 交换机 2 |
|
|
它还可以使用命令在EIGRP接口下启用BFD
ip eigrp instance-tag bfd
交换机 1 | 交换机 2 |
|
|
EIGRP上的BFD配置示例
SW1# show running-config eigrp !Command: show running-config eigrp !Running configuration last done at: Wed Apr 10 21:24:29 2024 !Time: Wed Apr 10 21:53:08 2024 version 10.3(4a) Bios:version 01.07 feature eigrp router eigrp 2 address-family ipv4 unicast bfd interface Vlan20 ip router eigrp 2 ip eigrp 2 bfd
在BGP上配置BFD
注意:在与邻居建立BGP会话期间,更新源功能有助于BGP会话使用指定接口的主IP地址作为本地地址。此外,它使BGP能够向BFD注册为客户端。
注意:在设备上配置BFD会话时,指定“multihop”或“singlehop”将确定会话类型。如果未提供关键字,则当对等体直接连接时,会话类型默认为“singlehop”。如果对等体未连接,会话类型默认为“多跳”。
交换机 1 | 交换机 2 |
|
|
BGP上的BFD配置示例
SW1# show running-config bgp !Command: show running-config bgp !Running configuration last done at: Thu Apr 11 04:47:53 2024 !Time: Thu Apr 11 06:48:43 2024 version 10.3(4a) Bios:version 01.07 feature bgp router bgp 65001 address-family ipv4 unicast neighbor 192.168.3.1 bfd multihop remote-as 65002 update-source loopback30 ebgp-multihop 5 address-family ipv4 unicast
验证
配置BFD并将其与协议(如OSPF、EIGRP或BGP)关联后,必须自动识别BFD邻居。要进行确认,请使用命令:
show bfd neighbors
在交换机1上
SW1# show bfd neighbors OurAddr NeighAddr LD/RD RH/RS Holdown(mult) State Int Vrf Type BSID 172.16.1.1 172.16.1.2 1090519059/1090519058 Up 5219(3) Up Vlan20 default SH N/A 10.10.10.1 10.10.10.2 1090519060/1090519059 Up 5219(3) Up Vlan10 default SH N/A 192.168.2.1 192.168.3.1 1090519062/1090519061 Up 728(3) Up Lo30 default MH N/A SW1#
在交换机2上
SW2# show bfd neighbors OurAddr NeighAddr LD/RD RH/RS Holdown(mult) State Int Vrf Type BSID 172.16.1.2 172.16.1.1 1090519058/1090519059 Up 5053(3) Up Vlan20 default SH N/A 10.10.10.2 10.10.10.1 1090519059/1090519060 Up 5053(3) Up Vlan10 default SH N/A 192.168.3.1 192.168.2.1 1090519061/1090519062 Up 745(3) Up Lo30 default MH N/A
要进行确认并获取详细输出,请使用命令:
SW1# show bfd neighbors interface lo30 details OurAddr NeighAddr LD/RD RH/RS Holdown(mult) State Int Vrf Type BSID 192.168.2.1 192.168.3.1 1090519062/1090519061 Up 676(3) Up Lo30 default MH N/A Session state is Up and not using echo function Session type: Multihop Local Diag: 0, Demand mode: 0, Poll bit: 0, Authentication: None MinTxInt: 250000 us, MinRxInt: 250000 us, Multiplier: 3 Received MinRxInt: 250000 us, Received Multiplier: 3 Holdown (hits): 750 ms (0), Hello (hits): 250 ms (82590) Rx Count: 82588, Rx Interval (ms) min/max/avg: 207/1764/219 last: 73 ms ago Tx Count: 82590, Tx Interval (ms) min/max/avg: 219/219/219 last: 67 ms ago Registered protocols: bgp Uptime: 0 days 5 hrs 2 mins 2 secs, Upcount: 1 Last packet: Version: 1 - Diagnostic: 0 State bit: Up - Demand bit: 0 Poll bit: 0 - Final bit: 0 Multiplier: 3 - Length: 24 My Discr.: 1090519061 - Your Discr.: 1090519062 Min tx interval: 250000 - Min rx interval: 250000 Min Echo interval: 0 - Authentication bit: 0 Hosting LC: 1, Down reason: None, Reason not-hosted: None
SW2# show bfd neighbors interface vlan 20 details OurAddr NeighAddr LD/RD RH/RS Holdown(mult) State Int Vrf Type BSID 172.16.1.2 172.16.1.1 1090519058/1090519059 Up 4979(3) Up Vlan20 default SH N/A Session state is Up and using echo function with 500 ms interval Session type: Singlehop Local Diag: 0, Demand mode: 0, Poll bit: 0, Authentication: None MinTxInt: 500000 us, MinRxInt: 2000000 us, Multiplier: 3 Received MinRxInt: 2000000 us, Received Multiplier: 3 Holdown (hits): 6000 ms (0), Hello (hits): 2000 ms (12454) Rx Count: 12444, Rx Interval (ms) min/max/avg: 109/1919/1908 last: 1020 ms ago Tx Count: 12454, Tx Interval (ms) min/max/avg: 1906/1906/1906 last: 856 ms ago Registered protocols: eigrp Uptime: 0 days 6 hrs 35 mins 10 secs, Upcount: 2 Last packet: Version: 1 - Diagnostic: 0 State bit: Up - Demand bit: 0 Poll bit: 0 - Final bit: 0 Multiplier: 3 - Length: 24 My Discr.: 1090519059 - Your Discr.: 1090519058 Min tx interval: 500000 - Min rx interval: 2000000 Min Echo interval: 500000 - Authentication bit: 0 Hosting LC: 1, Down reason: None, Reason not-hosted: None
使用会话详细信息进行验证
SW1# sh bfd clients Client : Number of sessions bgp : 1 ospf : 1 eigrp : 1 SW1# show system internal bfd sess-store interface vlan 10 No of sessions: 1 >>>>> Check Number of sessions 0x4100001b - 0x41000019 Hosting LC: 1 10.10.10.1 -> 10.10.10.2 bsid 0 >>>>> Check IP addresses BFD_SESS_ST_SESSION_UP for 0 days 0:6:22 594 >>>>> Check uptime Vlan10 [2 0x901000a:0x43 0:10 0x1000c 0x1000c] SMAC: 4464.3c81.ddd7 DMAC: 4464.3c81.cdb7 Local TX/RX/ST(ms): 500/500/2000000 Mult: 3 EchoRx: 50000 Ver:1 Flags(0x0): Echo Auth Interop (Disabled) Auth(0 0 0) Group id 0x0 Active TX/RX/ST(ms): 2000/2000/2000000 Mult: 3 State: 3 Diag: 0x0 Flags: 0xc 0000 Auth(0 0 0) Spray DIs: 0 Port-Lcs: Module 1 has 2 links - ACL not programmed Applications: (1) ospf [0x1:0x41000119 flags 0x0] App Data : [c0a80301000] Description: 10.10.10.2 MTS Dest 0xfe000001:0x140 No-Host reason: 0x0(SUCCESS) Counters: >>>>>>>> Check the counters below Retries: LC remove(0), ACL Inst/Rem(0/0), Redisc(0) No. of ACLs Added(1) Flap counters: Ctrl Detect timer expired(0), Echo failed(0), Neigh Signaled down(0), Admin d own(0), Forwarding plane reset(0), Path down(0), Concat path down(0), Rev Concat path down(0) Last ACL added time: 58781 usecs after Thu Apr 11 22:18:19 2024 Last ACL response time: 81830 usecs after Thu Apr 11 22:18:19 2024 Last session install time: 58285 usecs after Thu Apr 11 22:18:19 2024 Last session install response time: 58717 usecs after Thu Apr 11 22:18:19 2024
使用访问列表进行验证
SW2# show system internal access-list vlan 10 input statistics slot 1 ======= INSTANCE 0x0 --------------- Tcam 12 resource usage: ---------------------- LBL M = 0x1 Bank 0 ------ IPv4 Class Policies: BFD() [Merged] Netflow profile: 0 Netflow deny profile: 0 Entries: [Index] Entry [Stats] --------------------- [0x0000:0x0003:0x0c0d] permit udp 0.0.0.0/0 0.0.0.0/0 range 3784 3785 encap 0x0 [205340] >>>>> This counter needs to increase SW2# show system internal access-list sup-redirect-stats | i i bfd 3085 BFD 12217 >>>>> This counter need to increase 3121 BFDC TCLASS PACKET 0 3146 BFDC v4 PACKET 15 3148 BFDC TCLASS V6 PACKET 0 3156 BFDC v6 PACKET 0 3158 BFDC v6 LL Ucast PACKET 0 3209 BFDC v4 multihop PACKET 383697 >>>>> This counter need to increase in multihop case 3121 BFDC TCLASS PACKET 0 3146 BFDC v4 PACKET 0 3148 BFDC TCLASS V6 PACKET 0 3156 BFDC v6 PACKET 0 3158 BFDC v6 LL Ucast PACKET 0 3209 BFDC v4 multihop PACKET 0
使用Ethanalyzer进行验证
另一种方法是执行数据包捕获,具体针对UDP端口3785进行过滤。
SW1# ethanalyzer local interface inband display-filter "udp.port==3785" limit-captured-frames 0 Capturing on 'ps-inb' 5 2024-04-11 05:26:37.294596186 10.10.10.1 → 10.10.10.1 BFD Echo 70 Originator specific content 6 2024-04-11 05:26:37.294623155 10.10.10.1 → 10.10.10.1 BFD Echo 70 Originator specific content 7 2024-04-11 05:26:37.294635837 172.16.1.1 → 172.16.1.1 BFD Echo 70 Originator specific content 8 2024-04-11 05:26:37.294653159 172.16.1.1 → 172.16.1.1 BFD Echo 70 Originator specific content 4 18 2024-04-11 05:26:37.780441619 10.10.10.1 → 10.10.10.1 BFD Echo 70 Originator specific content 19 2024-04-11 05:26:37.780461351 172.16.1.1 → 172.16.1.1 BFD Echo 70 Originator specific content 20 2024-04-11 05:26:37.780467533 10.10.10.1 → 10.10.10.1 BFD Echo 70 Originator specific content 21 2024-04-11 05:26:37.780481315 172.16.1.1 → 172.16.1.1 BFD Echo 70 Originator specific content 30 2024-04-11 05:26:38.266365493 10.10.10.1 → 10.10.10.1 BFD Echo 70 Originator specific content 31 2024-04-11 05:26:38.266392766 10.10.10.1 → 10.10.10.1 BFD Echo 70 Originator specific content
从BFD回显协议捕获的数据包中预计存在相同的源和目标IP地址,因为这些回显数据包源自本地交换机本身。
注意:如果接口下没有“no bfd echo”语句,捕获将显示包含本地来源IP地址和邻居目标IP地址的数据包,并观察BFD控制
SW2# ethanalyzer local interface inband display-filter "ip.addr==192.168.2.1" limit-captured-frames 0 Capturing on 'ps-inb' 1 2024-04-11 05:38:21.155483591 192.168.2.1 → 192.168.3.1 BFD Control 66 Diag: No Diagnostic, State: Up, Flags: 0x00 2 2024-04-11 05:38:21.182606602 192.168.3.1 → 192.168.2.1 BFD Control 66 Diag: No Diagnostic, State: Up, Flags: 0x00 11 2024-04-11 05:38:21.375187034 192.168.2.1 → 192.168.3.1 BFD Control 66 Diag: No Diagnostic, State: Up, Flags: 0x00 12 2024-04-11 05:38:21.402295701 192.168.3.1 → 192.168.2.1 BFD Control 66 Diag: No Diagnostic, State: Up, Flags: 0x00 4 14 2024-04-11 05:38:21.594612491 192.168.2.1 → 192.168.3.1 BFD Control 66 Diag: No Diagnostic, State: Up, Flags: 0x00 15 2024-04-11 05:38:21.621742431 192.168.3.1 → 192.168.2.1 BFD Control 66 Diag: No Diagnostic, State: Up, Flags: 0x00 20 2024-04-11 05:38:21.813971234 192.168.2.1 → 192.168.3.1 BFD Control 66 Diag: No Diagnostic, State: Up, Flags: 0x00 8 21 2024-04-11 05:38:21.841086554 192.168.3.1 → 192.168.2.1 BFD Control 66 Diag: No Diagnostic, State: Up, Flags: 0x00 22 2024-04-11 05:38:22.033395440 192.168.2.1 → 192.168.3.1 BFD Control 66 Diag: No Diagnostic, State: Up, Flags: 0x00 23 2024-04-11 05:38:22.060526055 192.168.3.1 → 192.168.2.1 BFD Control 66 Diag: No Diagnostic, State: Up, Flags: 0x00 28 2024-04-11 05:38:22.252709432 192.168.2.1 → 192.168.3.1 BFD Control 66 Diag: No Diagnostic, State: Up, Flags: 0x00 29 2024-04-11 05:38:22.279810427 192.168.3.1 → 192.168.2.1 BFD Control 66 Diag: No Diagnostic, State: Up, Flags: 0x00
版本 | 发布日期 | 备注 |
---|---|---|
1.0 |
25-Apr-2024 |
初始版本 |