05-H3C_BFD典型配置举例
本章节下载: 05-H3C_BFD典型配置举例 (369.79 KB)
BFD配置举例
Copyright © 2018新华三技术有限公司 版权所有,保留一切权利。 非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部,并不得以任何形式传播。本文档中的信息可能变动,恕不另行通知。 |
本文档介绍了BFD配置举例。
本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。
本文假设您已了解BFD特性以及OSPF、IS-IS等路由协议。
不支持BFD for interface。
不支持echo报文。
某公司内部网络如图1所示,从Device A到Device B有两条转发路径,下一跳分别为Device B和Device C。由于Device A和Device B之间物理距离较远,通过一个二层交换机L2 Switch作为中继。假设Device A和Device B均支持BFD,要求在Device A上使用静态路由与BFD联动技术,实现当Device B与二层交换机L2 Switch之间的链路出现故障(如链路down)时,Device A能快速感知,并将流量切换到Device C的链路上。
图1 静态路由与BFD联动配置组网图
设备 |
接口 |
IP地址 |
设备 |
接口 |
IP地址 |
Device A |
Vlan-int10 |
192.168.10.101/24 |
Device B |
Vlan-int10 |
192.168.10.102/24 |
|
Vlan-int20 |
192.168.20.101/24 |
|
Vlan-int30 |
192.168.30.101/24 |
|
Vlan-int40 |
192.168.40.101/24 |
|
Vlan-int50 |
192.168.50.101/24 |
Device C |
Vlan-int20 |
192.168.20.102/24 |
|
|
|
|
Vlan-int30 |
192.168.30.102/24 |
|
|
|
该配置需要两端设备均支持BFD,才能够使用控制报文方式。
本举例是在S5560G-CMW710-R7724版本上进行配置和验证的。
(1) 配置Device A各接口的IP地址
<DeviceA> system-view
[DeviceA] vlan 10
[DeviceA-vlan10] port ten-gigabitethernet 1/0/25
[DeviceA-vlan10] quit
[DeviceA] interface vlan-interface 10
[DeviceA-Vlan-interface10] ip address 192.168.10.101 24
[DeviceA-Vlan-interface10] quit
(2) 请参考以上方法配置4.1 图1中其它接口的IP地址,配置步骤这里省略
(1) 配置Device A
# 配置Device A到192.168.50.0/24网段的静态路由,Device A到Device B的流量优先走Device A –> L2 Switch–> Device B链路,当此链路发生故障时,流量切换到Device A –> Device C–> Device B链路上。
[DeviceA] ip route-static 192.168.50.0 24 vlan-interface 10 192.168.10.102 bfd control-packet
[DeviceA] ip route-static 192.168.50.0 24 vlan-interface 20 192.168.20.102 preference 65
(2) 配置Device B
# 配置Device B到192.168.40.0/24网段的静态路由,Device B到Device A的流量优先走Device B –> L2 Switch–> Device A链路,当此链路发生故障时,流量切换到Device B –> Device C–> Device A链路上。
[DeviceB] ip route-static 192.168.40.0 24 vlan-interface 10 192.168.10.101 bfd control-packet
[DeviceB] ip route-static 192.168.40.0 24 vlan-interface 30 192.168.30.102 preference 65
(3) 配置Device C
# 配置Device C到192.168.40.0/24和192.168.50.0/24网段的静态路由。
[DeviceC] ip route-static 192.168.40.0 24 vlan-interface 20 192.168.20.101
[DeviceC] ip route-static 192.168.50.0 24 vlan-interface 30 192.168.30.101
# 配置接口接收BFD 控制报文的最小时间间隔为100ms,单跳BFD检测时间倍数为3。
[DeviceA] interface vlan-interface 10
[DeviceA-Vlan-interface10] bfd min-control-interval 100
[DeviceA-Vlan-interface10] bfd detect-multiplier 3
[DeviceA-Vlan-interface10] quit
# 配置接口接收BFD 控制报文的最小时间间隔为100ms,单跳BFD检测时间倍数为3。
[DeviceB] interface vlan-interface 10
[DeviceB-Vlan-interface10] bfd min-control-interval 100
[DeviceB-Vlan-interface10] bfd detect-multiplier 3
[DeviceB-Vlan-interface10] quit
(1) Device A和Device B设备及之间的链路均正常工作时
# 在Device A查看静态路由信息。
[DeviceA] display ip routing-table protocol static
Summary Count : 2
Static Routing table Status : <Active>
Summary Count : 2
Destination/Mask Proto Pre Cost NextHop Interface
192.168.50.0/24 Static 60 0 192.168.10.102 Vlan10
Static Routing table Status : <Inactive>
Summary Count : 0
以上显示信息表示Device A经过L2 Switch到达Device B。
# 查看BFD会话。
[DeviceA] display bfd session
Total Session Num: 1 Up Session Num: 1 Init Mode: Active
IPv4 session working Under Ctrl Mode:
LD/RD SourceAddr DestAddr State Holdtime Interface
67 192.168.10.101 192.168.10.102 Up 300ms Vlan10
以上显示信息表示BFD会话已经创建。
(2) Device B与L2 Switch之间的链路出现故障时
# 查看静态路由。
[DeviceA] display ip routing-table protocol static
Summary Count : 1
Static Routing table Status : <Active>
Summary Count : 1
Destination/Mask Proto Pre Cost NextHop Interface
192.168.50.0/24 Static 65 0 192.168.20.102 Vlan20
Static Routing table Status : <Inactive>
Summary Count : 0
以上显示信息表示Device A经过Device C到达Device B。
· Device A:
#
vlan 10
#
vlan 20
#
vlan 40
#
interface Vlan-interface10
ip address 192.168.10.101 255.255.255.0
bfd min-control-interval 100
bfd detect-multiplier 3
#
interface Vlan-interface20
ip address 192.168.20.101 255.255.255.0
#
interface Vlan-interface40
ip address 192.168.40.101 255.255.255.0
#
interface Ten-GigabitEthernet1/0/25
port access vlan 10
#
interface Ten-GigabitEthernet1/0/26
port access vlan 20
#
interface Ten-GigabitEthernet1/0/27
port access vlan 40
#
ip route-static 192.168.50.0 24 Vlan-interface10 192.168.10.102 bfd control-packet
ip route-static 192.168.50.0 24 Vlan-interface20 192.168.20.102 preference 65
#
· Device B:
#
vlan 10
#
vlan 30
#
vlan 50
#
interface Vlan-interface10
ip address 192.168.10.102 255.255.255.0
bfd min-control-interval 100
bfd detect-multiplier 3
#
interface Vlan-interface30
ip address 192.168.30.101 255.255.255.0
#
interface Vlan-interface50
ip address 192.168.50.101 255.255.255.0
#
interface Ten-GigabitEthernet1/0/25
port access vlan 10
#
interface Ten-GigabitEthernet1/0/26
port access vlan 30
#
interface Ten-GigabitEthernet1/0/7
port access vlan 50
#
ip route-static 192.168.40.0 24 Vlan-interface10 192.168.10.101 bfd control-packet
ip route-static 192.168.40.0 24 Vlan-interface30 192.168.30.102 preference 65
#
· Device C:
#
vlan 20
#
vlan 30
#
interface Vlan-interface20
ip address 192.168.20.102 255.255.255.0
#
interface Vlan-interface30
ip address 192.168.30.102 255.255.255.0
#
interface Ten-GigabitEthernet1/0/25
port access vlan 20
#
interface Ten-GigabitEthernet1/0/26
port access vlan 30
#
ip route-static 192.168.40.0 24 Vlan-interface20 192.168.20.101
ip route-static 192.168.50.0 24 Vlan-interface30 192.168.30.101
#
如图2所示,某公司通过Device B将两个相距较远的部门连接。Device A、Device C、Device D上运行RIP,建立RIP邻居关系,保证网络层相互可达。
公司希望在Device A上使用RIP与BFD联动技术,实现当Device C与Device B之间的链路出现故障(如链路down)时,BFD能够快速感知并通告RIP协议。
已知Device C支持BFD功能,公司希望使用RIP与BFD联动技术,采用BFD控制报文方式实现当Device A或Device C与Device B之间的链路出现故障时,BFD能够快速感知并通告RIP协议。
现要求通过在Device A和Device C上配置RIP与BFD联动功能,实现:
当链路出现故障时设备能够快速感知并通告RIP协议,快速切换到Device D链路进行通信。
图2 RIP与BFD联动配置组网图
设备 |
接口 |
IP地址 |
设备 |
接口 |
IP地址 |
Device A |
Vlan-int300 |
192.168.3.1/24 |
Device B |
Vlan-int100 |
192.168.1.2/24 |
|
Vlan-int100 |
192.168.1.1/24 |
|
Vlan-int200 |
192.168.2.1/24 |
Device C |
Vlan-int200 |
192.168.2.2/24 |
Device D |
Vlan-int300 |
192.168.3.2/24 |
|
Vlan-int400 |
192.168.4.2/24 |
|
Vlan-int400 |
192.168.4.1/24 |
两端设备均需支持BFD,才能够使用控制报文方式。
本举例是在S5560G-CMW710-R7724版本上进行配置和验证的。
(1) 配置Device A各接口的IP地址
<DeviceA> system-view
[DeviceA] vlan 300
[DeviceA-vlan300] port ten-gigabitethernet 1/0/25
[DeviceA-vlan300] quit
[DeviceA] interface vlan-interface 300
[DeviceA-Vlan-interface300] ip address 192.168.3.1 24
[DeviceA-Vlan-interface300] quit
(2) 请参考以上方法配置5.1 图2中其它接口的IP地址,配置步骤这里省略
# 配置RIP基本功能,并引入静态路由,使Device A与Device C互有路由发送
(1) 配置Device A。
<DeviceA> system-view
[DeviceA] rip 1
[DeviceA-rip-1] version 2
[DeviceA-rip-1] undo summary
[DeviceA-rip-1] network 192.168.1.0
[DeviceA-rip-1] network 101.1.1.0
[DeviceA-rip-1] peer 192.168.2.2
[DeviceA-rip-1] undo validate-source-address
[DeviceA-rip-1] import-route static
[DeviceA-rip-1] quit
[DeviceA] interface vlan-interface 100
[DeviceA-Vlan-interface100] rip bfd enable
[DeviceA-Vlan-interface100] quit
[DeviceA] rip 2
[DeviceA-rip-2] version 2
[DeviceA-rip-2] undo summary
[DeviceA-rip-2] network 192.168.3.0
[DeviceA-rip-2] quit
(2) 配置Device C。
<DeviceC> system-view
[DeviceC] rip 1
[DeviceC-rip-1] version 2
[DeviceC-rip-1] undo summary
[DeviceC-rip-1] network 192.168.2.0
[DeviceC-rip-1] network 192.168.4.0
[DeviceC-rip-1] network 100.1.1.0
[DeviceC-rip-1] peer 192.168.1.1
[DeviceC-rip-1] undo validate-source-address
[DeviceC-rip-1] import-route static
[DeviceC-rip-1] quit
[DeviceC] interface vlan-interface 200
[DeviceC-Vlan-interface200] rip bfd enable
[DeviceC-Vlan-interface200] quit
(3) 配置Device D。
<DeviceD> system-view
[DeviceD] rip 1
[DeviceD-rip-1] version 2
[DeviceD-rip-1] undo summary
[DeviceD-rip-1] network 192.168.3.0
[DeviceD-rip-1] network 192.168.4.0
# 配置Device A。
[DeviceA] interface vlan-interface 100
[DeviceA-Vlan-interface100] bfd min-control-interval 500
[DeviceA-Vlan-interface100] bfd detect-multiplier 7
[DeviceA-Vlan-interface100] quit
# 配置Device C。
[DeviceC] interface vlan-interface 200
[DeviceC-Vlan-interface200] bfd min-control-interval 500
[DeviceC-Vlan-interface200] bfd detect-multiplier 7
[DeviceC-Vlan-interface200] quit
# 配置Device A。
[DeviceA] ip route-static 192.168.2.0 24 vlan-interface 100 192.168.1.2
[DeviceA] quit
# 配置Device C。
[DeviceC] ip route-static 192.168.1.0 24 vlan-interface 200 192.168.2.1
# 显示Device A的BFD信息。
<DeviceA> display bfd session
Total Session Num: 1 Up Session Num: 1 Init Mode: Active
IPv4 session working under Ctrl mode:
LD/RD SourceAddr DestAddr State Holdtime Interface
513/513 192.168.1.1 192.168.2.2 Up 1700ms vlan100
# 显示Device A上学到的路由100.1.1.0/24,可以看到Device A经过Device B到达Device C。
<DeviceA> display ip routing-table 100.1.1.0 24
Summary count : 1
Destination/Mask Proto Pre Cost NextHop Interface
100.1.1.0/24 RIP 100 1 192.168.2.2 vlan-interface 100
Device B和Device C之间的链路发生故障后:
# 显示Device A上学到的路由100.1.1.0/24,可以看到Device A经过Device D到达Device C。
<DeviceA> display ip routing-table 100.1.1.0 24
Summary count : 1
Destination/Mask Proto Pre Cost NextHop Interface
100.1.1.0/24 RIP 100 2 192.168.3.2 vlan-interface 300
· Device A:
#
rip 1
undo summary
version 2
network 192.168.1.0
network 101.1.1.0
peer 192.168.2.2
undo validate-source-address
import-route static
#
rip 2
version 2
undo summary
network 192.168.3.0
#
vlan 100
#
vlan 300
#
interface Vlan-interface100
bfd min-control-interval 500
bfd detect-multiplier 7
#
interface Vlan-interface300
ip address 192.168.3.1 255.255.255.0
#
interface Vlan-interface100
ip address 192.168.1.1 255.255.255.0
rip bfd enable
#
interface Ten-GigabitEthernet1/0/25
port access vlan 100
#
interface Ten-GigabitEthernet1/0/26
port access vlan 300
#
ip route-static 192.168.2.0 24 Vlan-interface100 192.168.1.2
#
· Device C:
#
rip 1
undo summary
version 2
network 192.168.2.0
network 192.168.4.0
network 100.1.1.0
peer 192.168.1.1
undo validate-source-address
import-route static
#
vlan 200
#
vlan 400
#
interface Vlan-interface200
bfd min-control-interval 500
bfd detect-multiplier 7
ip address 192.168.2.2 255.255.255.0
rip bfd enable
#
interface Vlan-interface400
ip address 192.168.4.2 255.255.255.0
#
interface Ten-GigabitEthernet1/0/25
port access vlan 200
#
interface Ten-GigabitEthernet1/0/26
port access vlan 400
#
ip route-static 192.168.1.0 24 Vlan-interface200 192.168.2.1
#
· Device D:
#
rip 1
undo summary
version 2
network 192.168.3.0
network 192.168.4.0
#
vlan 300
#
vlan 400
#
interface Vlan-interface300
ip address 192.168.3.2 255.255.255.0
#
interface Vlan-interface400
ip address 192.168.4.1 255.255.255.0
#
interface Ten-GigabitEthernet1/0/25
port access vlan 300
#
interface Ten-GigabitEthernet1/0/26
port access vlan 400
#
如图3所示,某公司通过一台二层交换机作为中继将两个相距较远的部门连接。Device A、Device B、Device C上运行OSPF,建立OSPF邻居关系,保证网络层相互可达。
已知Device A和Device C都支持BFD功能,要求使用OSPF与BFD联动技术,采用BFD控制报文方式实现当Device A或Device C与二层交换机之间的链路出现故障(如链路down)时,BFD能够快速感知并通告OSPF协议。
现要求通过在Device A和Device C上配置OSPF与BFD联动功能,实现:
· 监测通过L2 Switch通信的链路;
· 当链路出现故障时设备能够快速感知并通告OSPF协议,快速切换到Device B链路进行通信。
图3 OSPF与BFD联动配置组网图
设备 |
接口 |
IP地址 |
设备 |
接口 |
IP地址 |
Device A |
Vlan-int10 |
10.1.0.101/24 |
Device B |
Vlan-int20 |
192.168.0.102/24 |
|
Vlan-int20 |
192.168.0.101/24 |
|
Vlan-int30 |
13.1.1.101/24 |
|
Vlan-int100 |
120.1.1.1/24 |
|
|
|
Device C |
Vlan-int10 |
10.1.0.102/24 |
|
|
|
|
Vlan-int30 |
13.1.1.102/24 |
|
|
|
|
Vlan-int100 |
121.1.1.1/24 |
|
|
|
Device A和Device C都支持BFD,可以使用BFD控制报文方式建立起BFD会话。
本举例是在S5560G-CMW710-R7724版本上进行配置和验证的。
(1) 配置Device A各接口的IP地址
<DeviceA> system-view
[DeviceA] vlan 10
[DeviceA-vlan10] port ten-gigabitethernet 1/0/25
[DeviceA-vlan10] quit
[DeviceA] interface vlan-interface 10
[DeviceA-Vlan-interface10] ip address 10.1.0.101 24
[DeviceA-Vlan-interface11] undo shutdown
[DeviceA-Vlan-interface10] quit
(2) 请参考以上方法配置6.1 图3中其它接口的IP地址,具体配置步骤略
(1) 配置Device A
# 配置Device A的OSPF基本功能,并使能OSPF的BFD功能。
[DeviceA] ospf
[DeviceA-ospf-1] area 0
[DeviceA-ospf-1-area-0.0.0.0] network 10.1.0.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.0] network 120.1.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.0] quit
[DeviceA-ospf-1] quit
[DeviceA] interface vlan-interface 10
[DeviceA-Vlan-interface10] ospf bfd enable
[DeviceA-Vlan-interface10] quit
(2) 配置Device B
# 配置Device B的OSPF基本功能。
[DeviceB] ospf
[DeviceB-ospf-1] area 0
[DeviceB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] network 13.1.1.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] quit
[DeviceB-ospf-1] quit
(3) 配置Device C
# 配置Device C的OSPF基本功能,并使能OSPF的BFD功能。
[DeviceC] ospf
[DeviceC-ospf-1] area 0
[DeviceC-ospf-1-area-0.0.0.0] network 10.1.0.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.0] network 13.1.1.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.0] network 121.1.1.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.0] quit
[DeviceC-ospf-1] quit
[DeviceC] interface vlan-interface 10
[DeviceC-Vlan-interface10] ospf bfd enable
[DeviceC-Vlan-interface10] quit
# 配置发送和接收单跳BFD控制报文的最小时间间隔都为100ms,单跳BFD检测时间倍数为3。
[DeviceA] interface vlan-interface 10
[DeviceA-Vlan-interface10] bfd min-control-interval 100
[DeviceA-Vlan-interface10] bfd detect-multiplier 3
[DeviceA-Vlan-interface10] quit
(2) 配置Device C
# 配置发送和接收单跳BFD控制报文的最小时间间隔都为100ms,单跳BFD检测时间倍数为3。
[DeviceC] interface vlan-interface 10
[DeviceC-Vlan-interface10] bfd min-control-interval 100
[DeviceC-Vlan-interface10] bfd detect-multiplier 3
[DeviceC-Vlan-interface10] quit
# 检查Device A连接的主机host A(120.1.1.2)到Device C连接的主机host C(121.1.1.2)是否可达。
<host A> ping 121.1.1.2
PING 121.1.1.2 (121.1.1.2): 56 data bytes
56 bytes from 121.1.1.2: seq=0 ttl=128 time=22.43 ms
56 bytes from 121.1.1.2: seq=1 ttl=128 time=7.17 ms
56 bytes from 121.1.1.2: seq=2 ttl=128 time=8.91 ms
56 bytes from 121.1.1.2: seq=3 ttl=128 time=7.45 ms
56 bytes from 121.1.1.2: seq=4 ttl=128 time=9.11 ms
--- 121.1.1.2 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 7.17/11.01/22.43 ms
# 查看Device A 上OSPF邻居信息,显示Device A和Device C已建立OSPF邻居关系。
[DeviceA] display ospf peer verbose
OSPF Process 1 with Router ID 2.2.2.2
Neighbors
Area 0.0.0.0 interface 10.1.0.101(Vlan-interface10)'s neighbors
Router ID: 1.1.1.1 Address: 10.1.0.102 GR State: Normal
State: Full Mode: Nbr is slave Priority: 1
DR: 10.1.0.101 BDR: 10.1.0.102 MTU: 0
Options is 0x42 (-|O|-|-|-|-|E|-)
Dead timer due in 39 sec
Neighbor is up for 00:09:01
Authentication Sequence: [ 0 ]
Neighbor state change count: 5
BFD status: Enabled(Control mode)
# 查看 Device A和Device C上BFD会话信息,显示BFD会话已被创建,且状态为Up。
[DeviceA] display bfd session verbose
Total Session Num: 1 Up Session Num: 1 Init Mode: Active
IPv4 session working in control packet mode:
Local Discr: 2049 Remote Discr: 2049
Source IP: 10.1.0.101 Destination IP: 10.1.0.102
Session State: Up Interface: Vlan-interface10
Min Tx Inter: 100ms Act Tx Inter: 100ms
Min Rx Inter: 100ms Detect Inter: 300ms
Rx Count: 36 Tx Count: 36
Connect Type: Direct Running Up for: 00:04:48
Hold Time: 300ms Auth mode: None
Detect Mode: Async Slot: 0
Protocol: OSPF
Version: 1
Diag Info: No Diagnostic
[DeviceC] display bfd session verbose
Total Session Num: 1 Up Session Num: 1 Init Mode: Active
IPv4 session working in control packet mode:
Local Discr: 2049 Remote Discr: 2049
Source IP: 10.1.0.102 Destination IP: 10.1.0.101
Session State: Up Interface: Vlan-interface10
Min Tx Inter: 100ms Act Tx Inter: 100ms
Min Rx Inter: 100ms Detect Inter: 300ms
Rx Count: 3971 Tx Count: 3776
Connect Type: Direct Running Up for: 00:06:52
Hold Time: 300ms Auth mode: None
Detect Mode: Async Slot: 0
Protocol: OSPF
Version: 1
Diag Info: No Diagnostic
# 在Device A上查看121.1.1.0/24的路由信息,可以看出Device A和Device C是通过L2 Switch进行通信的。
<DeviceA> display ip routing-table 121.1.1.0 verbose
Summary Count : 1
Destination: 121.1.1.0/24
Protocol: O_INTRA
Process ID: 1
SubProtID: 0x1 Age: 04h20m37s
Cost: 1 Preference: 10
IpPre: N/A QosLocalID: N/A
Tag: 0 State: Active Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x26000002 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x1008c OrigNextHop: 10.1.0.102
Label: NULL RealNextHop: 10.1.0.102
BkLabel: NULL BkNextHop: N/A
Tunnel ID: Invalid Interface: Vlan-interface10
BkTunnel ID: Invalid BkInterface: N/A
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A PathID: 0x0
# 当Device C和二层交换机之间的链路状态变为Down,BFD快速检测到链路发生变化并立刻通告OSPF。
%Oct 9 15:22:23:154 2013 DeviceC BFD/5/BFD_CHANGE_FSM: Sess[10.1.0.102/10.1.0.101, LD/RD:2049/2049, Interface:Vlan10, SessType:Ctrl, LinkType:INET] , Sta: UP-> DOWN, Diag: 1 (Control Detection Time Expired).
%Oct 9 15:22:23:155 2013 DeviceC OSPF/5/OSPF_NBR_CHG: OSPF 1 Neighbor 10.1.0.101(Vlan-interface10) from FULL to DOWN.
# 在Device A上查看121.1.1.0/24的路由信息,可以看出Device A和Device C已经切换到Device B进行通信。
<DeviceA> display ip routing-table 121.1.1.0 verbose
Summary Count : 1
Destination: 121.1.1.0/24
Protocol: O_INTRA
Process ID: 1
SubProtID: 0x1 Age: 04h20m37s
Cost: 2 Preference: 10
IpPre: N/A QosLocalID: N/A
Tag: 0 State: Active Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x26000002 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x1008c OrigNextHop: 192.168.0.102
Label: NULL RealNextHop: 192.168.0.102
BkLabel: NULL BkNextHop: N/A
Tunnel ID: Invalid Interface: Vlan-interface20
BkTunnel ID: Invalid BkInterface: N/A
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A PathID: 0x0
· Device A:
#
ospf 1
area 0.0.0.0
network 10.1.0.0 0.0.0.255
network 120.1.1.0 0.0.0.255
network 192.168.0.0 0.0.0.255
#
vlan 10
#
vlan 20
#
vlan 100
#
interface Vlan-interface10
ip address 10.1.0.101 255.255.255.0
ospf bfd enable
bfd min-control-interval 100
bfd detect-multiplier 3
#
interface Vlan-interface20
ip address 192.168.0.101 255.255.255.0
#
interface Vlan-interface100
ip address 120.1.1.1 255.255.255.0
#
interface Ten-GigabitEthernet1/0/25
port access vlan 10
#
interface Ten-GigabitEthernet1/0/26
port access vlan 20
#
interface Ten-GigabitEthernet1/0/27
port access vlan 100
#
· Device B:
#
ospf 1
area 0.0.0.0
network 13.1.1.0 0.0.0.255
network 192.168.0.0 0.0.0.255
#
vlan 20
#
vlan 30
#
interface Vlan-interface20
ip address 192.168.0.102 255.255.255.0
#
interface Vlan-interface30
ip address 13.1.1.101 255.255.255.0
#
interface Ten-GigabitEthernet1/0/25
port access vlan 20
#
interface Ten-GigabitEthernet1/0/26
port access vlan 30
#
· Device C:
#
ospf 1
area 0.0.0.0
network 10.1.0.0 0.0.0.255
network 13.1.1.0 0.0.0.255
network 121.1.1.0 0.0.0.255
#
vlan 10
#
vlan 30
#
vlan 100
#
interface Vlan-interface10
ip address 10.1.0.102 255.255.255.0
ospf bfd enable
bfd min-control-interval 100
bfd detect-multiplier 3
#
interface Vlan-interface30
ip address 13.1.1.102 255.255.255.0
#
interface Vlan-interface100
ip address 121.1.1.1 255.255.255.0
#
interface Ten-GigabitEthernet1/0/25
port access vlan 10
#
interface Ten-GigabitEthernet1/0/26
port access vlan 30
#
interface Ten-GigabitEthernet1/0/27
port access vlan 100
#
如图4所示,某公司通过一台二层交换机作为中继将两个相距较远的部门连接。Device A、Device B、Device C上运行IS-IS,建立IS-IS邻居关系,保证网络层相互可达。
已知Device A和Device C都支持BFD功能,公司希望使用IS-IS与BFD联动技术,采用BFD控制报文方式实现当Device A或Device C与二层交换机之间的链路出现故障(如链路down)时,BFD能够快速感知并通告IS-IS协议。
现要求通过在Device A和Device C上配置IS-IS与BFD联动功能,实现:
· 监测通过L2 Switch通信的链路;
· 当链路出现故障时设备能够快速感知并通告IS-IS协议,快速切换到Device B链路进行通信。
图4 IS-IS与BFD联动配置组网图
设备 |
接口 |
IP地址 |
设备 |
接口 |
IP地址 |
Device A |
Vlan-int10 |
10.1.0.101/24 |
Device B |
Vlan-int20 |
192.168.0.102/24 |
|
Vlan-int20 |
192.168.0.101/24 |
|
Vlan-int30 |
13.1.1.101/24 |
|
Vlan-int100 |
120.1.1.1/24 |
|
|
|
Device C |
Vlan-int10 |
10.1.0.102/24 |
|
|
|
|
Vlan-int30 |
13.1.1.102/24 |
|
|
|
|
Vlan-int100 |
121.1.1.1/24 |
|
|
|
Device A和Device C都支持BFD,可以使用BFD控制报文方式建立起BFD会话。
本举例是在S5560G-CMW710-R7724版本上进行配置和验证的。
(1) 配置Device A各接口的IP地址
<DeviceA> system-view
[DeviceA] vlan 10
[DeviceA-vlan10] port ten-gigabitethernet 1/0/25
[DeviceA-vlan10] quit
[DeviceA] interface vlan-interface 10
[DeviceA-Vlan-interface10] ip address 10.1.0.101 24
[DeviceA-Vlan-interface10] quit
(2) 请参考以上方法配置图4中其它接口的IP地址,配置步骤这里省略
(1) 配置Device A
# 配置Device A的IS-IS基本功能,并使能IS-IS的BFD功能。
[DeviceA] isis
[DeviceA-isis-1] network-entity 10.0000.0000.0001.00
[DeviceA-isis-1] quit
[DeviceA] interface vlan-interface 20
[DeviceA-Vlan-interface20] isis enable
[DeviceA-Vlan-interface20] quit
[DeviceA] interface vlan-interface 10
[DeviceA-Vlan-interface10] isis enable
[DeviceA-Vlan-interface10] isis bfd enable
[DeviceA-Vlan-interface10] quit
[DeviceA] interface vlan-interface 100
[DeviceA-Vlan-interface100] isis enable
[DeviceA-Vlan-interface100] quit
(2) 配置Device B
# 配置Device B的IS-IS基本功能。
[DeviceB] isis
[DeviceB-isis-1] network-entity 10.0000.0000.0003.00
[DeviceB-isis-1] quit
[DeviceB] interface vlan-interface 20
[DeviceB-Vlan-interface20] isis enable
[DeviceB-Vlan-interface20] quit
[DeviceB] interface vlan-interface 30
[DeviceB-Vlan-interface30] isis enable
[DeviceB-Vlan-interface30] quit
(3) 配置Device C
# 配置Device C的IS-IS基本功能,并使能IS-IS的BFD功能。
[DeviceC] isis
[DeviceC-isis-1] network-entity 10.0000.0000.0002.00
[DeviceC-isis-1] quit
[DeviceC] interface vlan-interface 10
[DeviceC-Vlan-interface10] isis enable
[DeviceC-Vlan-interface10] isis bfd enable
[DeviceC-Vlan-interface10] quit
[DeviceC] interface vlan 30
[DeviceC-Vlan-interface30] isis enable
[DeviceC-Vlan-interface30] quit
[DeviceC] interface vlan-interface 100
[DeviceC-Vlan-interface100] isis enable
[DeviceC-Vlan-interface100] quit
# 配置发送和接收单跳BFD控制报文的最小时间间隔都为100ms,单跳BFD检测时间倍数为3。
[DeviceA] interface vlan-interface 10
[DeviceA-Vlan-interface10] bfd min-control-interval 100
[DeviceA-Vlan-interface10] bfd detect-multiplier 3
[DeviceA-Vlan-interface10] quit
(2) 配置Device C
# 配置发送和接收单跳BFD控制报文的最小时间间隔都为100ms,单跳BFD检测时间倍数为3。
[DeviceC] interface vlan 10
[DeviceC-Vlan-interface10] bfd min-control-interval 100
[DeviceC-Vlan-interface10] bfd detect-multiplier 3
[DeviceC-Vlan-interface10] quit
# 查看Device A上IS-IS邻居信息,显示Device A和Device C已建立IS-IS邻居关系。
[DeviceA] display isis peer verbose
Peer information for IS-IS(1)
-----------------------------
System ID: 0000.0000.0002
Interface: Vlan10 Circuit Id: 0000.0000.0002.01
State: Up HoldTime: 6s Type: L1(L1L2) PRI: 64
Area address(es): 00
Peer IP address(es): 10.1.0.102
Peer local circuit ID: 1
Peer circuit SNPA address: ce9d-d91d-d100
Uptime: 00:01:19
Adj protocol: IPv4
Graceful Restart capable
Restarting signal: No
Suppress adjacency advertisement: No
Local topology:
0
Remote topology:
0
# 查看Device A和Device C上BFD会话信息,显示BFD会话已被创建,且状态为Up。
[DeviceA] display bfd session verbose
Total Session Num: 1 Up Session Num: 1 Init Mode: Active
IPv4 session working in control packet mode:
Local Discr: 2049 Remote Discr: 2049
Source IP: 10.1.0.101 Destination IP: 10.1.0.102
Session State: Up Interface: Vlan-interface10
Min Tx Inter: 100ms Act Tx Inter: 100ms
Min Rx Inter: 100ms Detect Inter: 300ms
Rx Count: 3 Tx Count: 3
Connect Type: Direct Running Up for: 00:06:09
Hold Time: 300ms Auth mode: None
Detect Mode: Async Slot: 0
Protocol: ISIS_BR_L1/ISIS_BR_L2
Version: 1
Diag Info: No Diagnostic
[DeviceC] display bfd session verbose
Total Session Num: 1 Up Session Num: 1 Init Mode: Active
IPv4 session working in control packet mode:
Local Discr: 2049 Remote Discr: 2049
Source IP: 10.1.0.102 Destination IP: 10.1.0.101
Session State: Up Interface: Vlan-interface10
Min Tx Inter: 100ms Act Tx Inter: 100ms
Min Rx Inter: 100ms Detect Inter: 300ms
Rx Count: 3 Tx Count: 3
Connect Type: Direct Running Up for: 00:07:10
Hold Time: 300ms Auth mode: None
Detect Mode: Async Slot: 0
Protocol: ISIS_BR_L1/ISIS_BR_L2
Version: 1
Diag Info: No Diagnostic
# 在Device A上查看121.1.1.0/24的路由信息,可以看出Device A和Device C是通过L2 Switch进行通信的。
<DeviceA> display ip routing-table 121.1.1.0 verbose
Summary Count : 1
Destination: 121.1.1.0/24
Protocol: IS_L1
Process ID: 1
SubProtID: 0x1 Age: 04h20m37s
Cost: 20 Preference: 15
IpPre: N/A QosLocalID: N/A
Tag: 0 State: Active Adv
OrigTblID: 0x2 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x26000002 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x1008c OrigNextHop: 10.1.0.102
Label: NULL RealNextHop: 10.1.0.102
BkLabel: NULL BkNextHop: N/A
Tunnel ID: Invalid Interface: Vlan-interface10
BkTunnel ID: Invalid BkInterface: N/A
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A PathID: 0x0
# 当Device C和二层交换机之间的链路Down了,BFD快速检测到链路发生变化并立刻通告IS-IS。
%Oct 9 16:11:24:163 2013 DeviceC BFD/5/BFD_CHANGE_FSM: Sess[10.1.0.102/10.1.0.101, LD/RD:2049/2049, Interface:Vlan10, SessType:Ctrl, LinkType:INET] , Sta: UP-> DOWN, Diag: 1 (Control Detection Time Expired).
%Oct 9 16:11:24:164 2013 DeviceC ISIS/5/ISIS_NBR_CHG: IS-IS 1, Level-1 adj
acency 0000.0000.0001 (Vlan-interface10), state change to: DOWN.
%Oct 9 16:11:24:164 2013 DeviceC ISIS/5/ISIS_NBR_CHG: IS-IS 1, Level-2 adj
acency 0000.0000.0001 (Vlan-interface10), state change to: DOWN.
# 在Device A上查看121.1.1.0/24的路由信息,可以看出Device A和Device C已经切换到Device B进行通信。
<DeviceA> display ip routing-table 121.1.1.0 verbose
Summary Count : 1
Destination: 121.1.1.0/24
Protocol: IS_L1
Process ID: 1
SubProtID: 0x1 Age: 04h20m37s
Cost: 2 Preference: 10
IpPre: N/A QosLocalID: N/A
Tag: 0 State: Active Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x26000002 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x1008c OrigNextHop: 192.168.0.102
Label: NULL RealNextHop: 192.168.0.102
BkLabel: NULL BkNextHop: N/A
Tunnel ID: Invalid Interface: Vlan-interface20
BkTunnel ID: Invalid BkInterface: N/A
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A PathID: 0x0
· Device A:
#
isis 1
network-entity 10.0000.0000.0001.00
#
vlan 10
#
vlan 20
#
vlan 100
#
interface Vlan-interface10
ip address 10.1.0.101 255.255.255.0
isis enable 1
isis bfd enable
bfd min-control-interval 100
bfd detect-multiplier 3
#
interface Vlan-interface20
ip address 192.168.0.101 255.255.255.0
isis enable 1
#
interface Vlan-interface100
ip address 120.1.1.1 255.255.255.0
isis enable 1
#
interface Ten-GigabitEthernet1/0/25
port access vlan 10
#
interface Ten-GigabitEthernet1/0/26
port access vlan 20
#
interface Ten-GigabitEthernet1/0/27
port access vlan 100
#
· Device B:
#
isis 1
network-entity 10.0000.0000.0003.00
#
vlan 20
#
vlan 30
#
interface Vlan-interface20
ip address 192.168.0.102 255.255.255.0
isis enable 1
#
interface Vlan-interface30
ip address 13.1.1.101 255.255.255.0
isis enable 1
#
interface Ten-GigabitEthernet1/0/25
port access vlan 20
#
interface Ten-GigabitEthernet1/0/26
port access vlan 30
#
· Device C:
#
isis 1
network-entity 10.0000.0000.0002.00
#
vlan 10
#
vlan 30
#
vlan 100
#
interface Vlan-interface10
ip address 10.1.0.102 255.255.255.0
isis enable 1
isis bfd enable
bfd min-control-interval 100
bfd detect-multiplier 3
#
interface Vlan-interface30
ip address 13.1.1.102 255.255.255.0
isis enable 1
#
interface Vlan-interface100
ip address 121.1.1.1 255.255.255.0
isis enable 1
#
interface Ten-GigabitEthernet1/0/25
port access vlan 10
#
interface Ten-GigabitEthernet1/0/26
port access vlan 30
#
interface Ten-GigabitEthernet1/0/27
port access vlan 100
#
如图5所示,某公司的两个部门相距较远,Device A和Device F分别作为这两个部门的出口设备,现通过部署BGP,使两个部门可以进行业务通信。已知Device B和Device D都支持BFD功能,公司希望使用BGP与BFD联动技术,采用BFD控制报文方式检测AS 200与AS 300之间通信的主链路状态,实现当Device B或Device D之间的链路出现故障(如链路down)时,BFD能够快速感知并通告BGP协议。具体要求如下:
· 在AS 100内使用OSPF作为IGP;
· 配置Device B<->Device C<->Device D链路作为主链路,负责转发Device A和Device F之间的流量,并采用BFD控制报文的方式检测主链路;
· 当主链路发生故障时,BFD能够快速检测并通告BGP协议,使得迅速切换到Device B<->Device E<->Device D这条路径进行通信。
图5 BGP与BFD联动配置组网图
设备 |
接口 |
IP地址 |
设备 |
接口 |
IP地址 |
Device A |
Vlan-int100 |
120.1.0.1/24 |
Device D |
Vlan-int20 |
10.2.0.101/24 |
Device B |
Vlan-int10 |
10.1.0.101/24 |
|
Vlan-int40 |
13.1.1.101/24 |
|
Vlan-int30 |
192.168.0.101/24 |
|
Vlan-int100 |
120.2.0.2/24 |
|
Vlan-int100 |
120.1.0.2/24 |
Device E |
Vlan-int30 |
192.168.0.102/24 |
Device C |
Vlan-int10 |
10.1.0.102/24 |
|
Vlan-int40 |
13.1.1.102/24 |
|
Vlan-int20 |
10.2.0.102/24 |
Device F |
Vlan-int100 |
120.2.0.1/24 |
· Device B和Device D都支持BFD,可以使用BFD控制报文方式建立起BFD会话。
· 为了使Device B<->Device C<->Device D成为主链路,需要通过路由策略配置其路由开销低于链路Device B<->Device E<->Device D的路由开销。
本举例是在S5560G-CMW710-R7724版本上进行配置和验证的。
设备上各接口IP地址的配置步骤这里省略。
(1) 配置Device B
[DeviceB] ospf
[DeviceB-ospf-1] import-route direct
[DeviceB-ospf-1] area 0
[DeviceB-ospf-1-area-0.0.0.0] network 10.1.0.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] quit
[DeviceB-ospf-1] quit
(2) 配置Device C
[DeviceC] ospf
[DeviceC-ospf-1] area 0
[DeviceC-ospf-1-area-0.0.0.0] network 10.1.0.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.0] network 10.2.0.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.0] quit
[DeviceC-ospf-1] quit
(3) 配置Device D
[DeviceD] ospf
[DeviceD-ospf-1] import-route direct
[DeviceD-ospf-1] area 0
[DeviceD-ospf-1-area-0.0.0.0] network 10.2.0.0 0.0.0.255
[DeviceD-ospf-1-area-0.0.0.0] network 13.1.1.0 0.0.0.255
[DeviceD-ospf-1-area-0.0.0.0] quit
[DeviceD-ospf-1] quit
(4) 配置Device E
[DeviceE] ospf
[DeviceE-ospf-1] area 0
[DeviceE-ospf-1-area-0.0.0.0] network 13.1.1.0 0.0.0.255
[DeviceE-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[DeviceE-ospf-1-area-0.0.0.0] quit
[DeviceE-ospf-1] quit
(1) 配置Device A
# 启动BGP,指定本地AS号为200。
[DeviceA] bgp 200
[DeviceA-bgp-default] router-id 1.1.1.1
# 配置Device A和Device B建立EBGP连接。
[DeviceA-bgp-default] peer 120.1.0.2 as-number 100
# 创建BGP IPv4单播地址族,并进入BGP IPv4单播地址族视图。
[DeviceA-bgp-default] address-family ipv4 unicast
# 在BGP IPv4单播地址族视图下,将本地路由表中到达120.1.0.0/24网段的路由添加到BGP路由表中。
[DeviceA-bgp-default-ipv4] network 120.1.0.0 255.255.255.0
# 使能Device A与对等体120.1.0.2交换IPv4单播路由信息的能力。
[DeviceA-bgp-default-ipv4] peer 120.1.0.2 enable
[DeviceA-bgp-default-ipv4] quit
(2) 配置Device B
# 启动BGP,指定本地AS号为100。
[DeviceB] bgp 100
[DeviceB-bgp-default] router-id 2.2.2.2
# 配置Device B和Device A建立EBGP连接。
[DeviceB-bgp-default] peer 120.1.0.1 as-number 200
# 配置Device B和Device D建立IBGP连接。
[DeviceB-bgp-default] peer 10.2.0.101 as-number 100
[DeviceB-bgp-default] peer 13.1.1.101 as-number 100
# 创建BGP IPv4单播地址族,并进入BGP IPv4单播地址族视图。
[DeviceB-bgp-default] address-family ipv4 unicast
# 使能Device B与对等体10.2.0.101交换IPv4单播路由信息的能力。
[DeviceB-bgp-default-ipv4] peer 10.2.0.101 enable
# 在BGP IPv4单播地址族视图下,配置向对等体10.2.0.101发布BGP路由时,将下一跳属性修改为自身的地址。
[DeviceB-bgp-default-ipv4] peer 10.2.0.101 next-hop-local
# 使能Device B与对等体13.1.1.101交换IPv4单播路由信息的能力。
[DeviceB-bgp-default-ipv4] peer 13.1.1.101 enable
# 在BGP IPv4单播地址族视图下,配置向对等体13.1.1.101发布BGP路由时,将下一跳属性修改为自身的地址。
[DeviceB-bgp-default-ipv4] peer 13.1.1.101 next-hop-local
# 使能Device B与对等体120.1.0.1交换IPv4单播路由信息的能力。
[DeviceB-bgp-default-ipv4] peer 120.1.0.1 enable
[DeviceB-bgp-default-ipv4] quit
(3) 配置Device D
# 启动BGP,指定本地AS号为100。
[DeviceD] bgp 100
[DeviceD-bgp-default] router-id 4.4.4.4
# 配置Device D和Device B建立IBGP连接。
[DeviceD-bgp-default] peer 10.1.0.101 as-number 100
[DeviceD-bgp-default] peer 192.168.0.101 as-number 100
# 配置Device D和Device F建立EBGP连接。
[DeviceD-bgp-default] peer 120.2.0.1 as-number 300
# 创建BGP IPv4单播地址族,并进入BGP IPv4单播地址族视图。
[DeviceD-bgp-default] address-family ipv4 unicast
# 使能Device D与对等体10.1.0.101交换IPv4单播路由信息的能力。
[DeviceD-bgp-default-ipv4] peer 10.1.0.101 enable
# 在BGP IPv4单播地址族视图下,配置向对等体10.1.0.101发布BGP路由时,将下一跳属性修改为自身的地址。
[DeviceD-bgp-default-ipv4] peer 10.1.0.101 next-hop-local
# 使能Device D与对等体192.168.0.101交换IPv4单播路由信息的能力。
[DeviceD-bgp-default-ipv4] peer 192.168.0.101 enable
# 在BGP IPv4单播地址族视图下,配置向对等体192.168.0.101发布BGP路由时,将下一跳属性修改为自身的地址。
[DeviceD-bgp-default-ipv4] peer 192.168.0.101 next-hop-local
# 使能Device D与对等体120.2.0.1交换IPv4单播路由信息的能力。
[DeviceD-bgp-default-ipv4] peer 120.2.0.1 enable
[DeviceD-bgp-default-ipv4] quit
(4) 配置Device F
#启动BGP,指定本地AS号为300。
[DeviceF] bgp 300
[DeviceF-bgp-default] router-id 6.6.6.6
# 配置Device F和Device D建立EBGP连接。
[DeviceF-bgp-default] peer 120.2.0.2 as-number 100
# 创建BGP IPv4单播地址族,并进入BGP IPv4单播地址族视图。
[DeviceF-bgp-default] address-family ipv4 unicast
# 在BGP IPv4单播地址族视图下,将本地路由表中到达120.2.0.0/24网段的路由添加到BGP路由表中。
[DeviceF-bgp-default-ipv4] network 120.2.0.0 255.255.255.0
# 使能Device F与对等体120.2.0.2交换IPv4单播路由信息的能力。
[DeviceF-bgp-default-ipv4] peer 120.2.0.2 enable
[DeviceF-bgp-default-ipv4] quit
(1) 配置Device B
# 创建ACL 2000,允许源IP地址为120.1.0.0/24的报文通过。
[DeviceB] acl basic 2000
[DeviceB-acl-ipv4-basic-2000] rule permit source 120.1.0.0 0.0.0.255
[DeviceB-acl-ipv4-basic-2000] quit
# 配置向对等体10.2.0.101发布的路由设置本地优先级为200,并配置IBGP路由优先级为100。
[DeviceB] route-policy local-pre permit node 10
[DeviceB-route-policy-local-pre] if-match ip address acl 2000
[DeviceB-route-policy-local-pre] apply local-preference 200
[DeviceB-route-policy-local-pre] quit
[DeviceB] bgp 100
[DeviceB-bgp-default] address-family ipv4 unicast
[DeviceB-bgp-default-ipv4] peer 10.2.0.101 route-policy local-pre export
[DeviceB-bgp-default-ipv4] preference 255 100 130
[DeviceB-bgp-default-ipv4] quit
(2) 配置Device D
# 创建ACL 2000,允许源IP地址为120.2.0.0/24的报文通过。
[DeviceD] acl basic 2000
[DeviceD-acl-ipv4-basic-2000] rule permit source 120.2.0.0 0.0.0.255
[DeviceD-acl-ipv4-basic-2000] quit
# 配置向对等体10.1.0.101发布的路由设置本地优先级为200,并配置IBGP路由优先级为100。
[DeviceD] route-policy local-pre permit node 10
[DeviceD-route-policy-local-pre] if-match ip address acl 2000
[DeviceD-route-policy-local-pre] apply local-preference 200
[DeviceD-route-policy-local-pre] quit
[DeviceD] bgp 100
[DeviceD-bgp-default] address-family ipv4 unicast
[DeviceD-bgp-default-ipv4] peer 10.1.0.101 route-policy local-pre export
[DeviceD-bgp-default-ipv4] preference 255 100 130
[DeviceD-bgp-default-ipv4] quit
(1) 配置Device B
[DeviceB] bgp 100
[DeviceB-bgp-default] peer 10.2.0.101 bfd
[DeviceB-bgp-default] quit
(2) 配置Device D
[DeviceD] bgp 100
[DeviceD-bgp-default] peer 10.1.0.101 bfd
[DeviceD-bgp-default] quit
# 从Device A上ping Device F的IP地址,可以互通。
[DeviceA] ping 120.2.0.1
Ping 120.2.0.1 (120.2.0.1): 56 data bytes, press CTRL_C to break
56 bytes from 120.2.0.1: icmp_seq=0 ttl=252 time=1.189 ms
56 bytes from 120.2.0.1: icmp_seq=1 ttl=252 time=1.095 ms
56 bytes from 120.2.0.1: icmp_seq=2 ttl=252 time=1.086 ms
56 bytes from 120.2.0.1: icmp_seq=3 ttl=252 time=1.097 ms
56 bytes from 120.2.0.1: icmp_seq=4 ttl=252 time=1.089 ms
--- Ping statistics for 120.2.0.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.086/1.111/1.189/0.039 ms
# 在Device B上通过命令display bgp peer查看BGP对等体信息,可以看到Device B与Device D建立IBGP连接,Device B与Device A建立EBGP连接,且均处于Established状态。
[DeviceB] display bgp peer ipv4
BGP local router ID: 2.2.2.2
Local AS number: 100
Total number of peers: 3 Peers in established state: 3
* - Dynamically created peer
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
10.2.0.101 100 6 4 0 1 00:00:56 Established
13.1.1.101 100 6 5 0 1 00:00:56 Established
120.1.0.1 200 6 5 0 1 00:00:56 Established
# 查看Device B上BFD会话信息,显示BFD会话已被创建,且状态为Up。
[DeviceB] display bfd session verbose
Total Session Num: 1 Up Session Num: 1 Init Mode: Active
IPv4 session working in control packet mode:
Local Discr: 2049 Remote Discr: 2049
Source IP: 10.1.0.101 Destination IP: 10.2.0.101
Session State: UP Interface: N/A
Min Tx Inter: 400ms Act Tx Inter: 400ms
Min Rx Inter: 400ms Detect Inter: 2000ms
Rx Count: 56 Tx Count: 56
Connect Type: Indirect Running Up for: 00:00:00
Hold Time: 0ms Auth mode: None
Detect Mode: Async Slot: 0
Protocol: BGP
Version: 1
Diag Info: No Diagnostic
# 在Device B上查看120.2.0.0/24的路由信息,可以看出Device B通过Device B<->Device C<->Device D这条路径与120.2.0.0/24网段通信。
[DeviceB] display ip routing-table 120.2.0.0 24 verbose
Summary Count : 3
Destination: 120.2.0.0/24
Protocol: BGP instance default
Process ID: 0
SubProtID: 0x1 Age: 00h24m48s
Cost: 0 Preference: 100
IpPre: N/A QosLocalID: N/A
Tag: 0 State: Active Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 300
NibID: 0x15000001 LastAs: 300
AttrID: 0x1 Neighbor: 10.2.0.101
Flags: 0x10060 OrigNextHop: 10.2.0.101
Label: NULL RealNextHop: 10.1.0.102
BkLabel: NULL BkNextHop: N/A
Tunnel ID: Invalid Interface: Vlan-interface10
BkTunnel ID: Invalid BkInterface: N/A
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A PathID: 0x0
Destination: 120.2.0.0/24
Protocol: O_ASE2
Process ID: 1
SubProtID: 0x8 Age: 00h26m19s
Cost: 1 Preference: 150
IpPre: N/A QosLocalID: N/A
Tag: 1 State: Inactive Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x13000005 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x41 OrigNextHop: 10.1.0.102
Label: NULL RealNextHop: 10.1.0.102
BkLabel: NULL BkNextHop: N/A
Tunnel ID: Invalid Interface: Vlan-interface10
BkTunnel ID: Invalid BkInterface: N/A
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A PathID: 0x0
Destination: 120.2.0.0/24
Protocol: O_ASE2
Process ID: 1
SubProtID: 0x8 Age: 00h26m19s
IpPre: N/A QosLocalID: N/A
Cost: 1 Preference: 150
Tag: 1 State: Inactive Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x13000003 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x41 OrigNextHop: 192.168.0.102
Label: NULL RealNextHop: 192.168.0.102
BkLabel: NULL BkNextHop: N/A
Tunnel ID: Invalid Interface: Vlan-interface30
BkTunnel ID: Invalid BkInterface: N/A
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A PathID: 0x0
# 在Device B<->Device C<->Device D链路发生故障后,从Device A上ping Device F的IP地址,可以互通。
[DeviceA] ping 120.2.0.1
Ping 120.1.0.1 (120.2.0.1): 56 data bytes, press CTRL_C to break
56 bytes from 120.2.0.1: icmp_seq=0 ttl=252 time=0.680 ms
56 bytes from 120.2.0.1: icmp_seq=1 ttl=252 time=0.295 ms
56 bytes from 120.2.0.1: icmp_seq=2 ttl=252 time=0.423 ms
56 bytes from 120.2.0.1: icmp_seq=3 ttl=252 time=0.464 ms
56 bytes from 120.2.0.1: icmp_seq=4 ttl=252 time=0.445 ms
--- Ping statistics for 120.2.0.1 ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.295/0.461/0.680/0.124 ms
# 在Device B上查看120.2.0.0/24的路由信息,可以看出Device B通过Device B<->Device E<->Device D这条路径与120.2.0.0/24网段通信。
[DeviceB] display ip routing-table 120.2.0.0 24 verbose
Summary Count : 2
Destination: 120.2.0.0/24
Protocol: BGP instance default
Process ID: 0
SubProtID: 0x1 Age: 00h00m18s
Cost: 0 Preference: 100
IpPre: N/A QosLocalID: N/A
Tag: 0 State: Active Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 300
NibID: 0x15000001 LastAs: 300
AttrID: 0x1 Neighbor: 10.2.0.101
Flags: 0x10060 OrigNextHop: 10.2.0.101
Label: NULL RealNextHop: 192.168.0.102
BkLabel: NULL BkNextHop: N/A
Tunnel ID: Invalid Interface: Vlan-interface30
BkTunnel ID: Invalid BkInterface: N/A
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A PathID: 0x0
Destination: 120.2.0.0/24
Protocol: O_ASE2
Process ID: 1
SubProtID: 0x8 Age: 00h00m18s
Cost: 1 Preference: 150
IpPre: N/A QosLocalID: N/A
Tag: 1 State: Inactive Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x13000001 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x41 OrigNextHop: 192.168.0.102
Label: NULL RealNextHop: 192.168.0.102
BkLabel: NULL BkNextHop: N/A
Tunnel ID: Invalid Interface: Vlan-interface30
BkTunnel ID: Invalid BkInterface: N/A
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A PathID: 0x0
· Device A:
#
vlan 100
#
interface Vlan-interface100
ip address 120.1.0.1 255.255.255.0
#
bgp 200
router-id 1.1.1.1
peer 120.1.0.2 as-number 100
#
address-family ipv4 unicast
network 120.1.0.0 255.255.255.0
peer 120.1.0.2 enable
#
· Device B:
#
ospf 1
import-route direct
area 0.0.0.0
network 10.1.0.0 0.0.0.255
network 192.168.0.0 0.0.0.255
#
vlan 10
#
vlan 30
#
vlan 100
#
interface Vlan-interface10
ip address 10.1.0.101 255.255.255.0
#
interface Vlan-interface30
ip address 192.168.0.101 255.255.255.0
#
interface Vlan-interface100
ip address 120.1.0.2 255.255.255.0
#
bgp 100
router-id 2.2.2.2
peer 10.2.0.101 as-number 100
peer 10.2.0.101 bfd
peer 13.1.1.101 as-number 100
peer 120.1.0.1 as-number 200
#
address-family ipv4 unicast
preference 255 100 130
peer 10.2.0.101 enable
peer 10.2.0.101 next-hop-local
peer 10.2.0.101 route-policy local-pre export
peer 13.1.1.101 enable
peer 13.1.1.101 next-hop-local
peer 120.1.0.1 enable
#
route-policy local-pre permit node 10
if-match ip address acl 2000
apply local-preference 200
#
acl basic 2000
rule 0 permit source 120.1.0.0 0.0.0.255
#
· Device C:
#
ospf 1
area 0.0.0.0
network 10.1.0.0 0.0.0.255
network 10.2.0.0 0.0.0.255
#
vlan 10
#
vlan 20
#
interface Vlan-interface10
ip address 10.1.0.102 255.255.255.0
#
interface Vlan-interface20
ip address 10.2.0.102 255.255.255.0
#
· Device D
#
ospf 1
import-route direct
area 0.0.0.0
network 10.2.0.0 0.0.0.255
network 13.1.1.0 0.0.0.255
#
vlan 20
#
vlan 40
#
vlan 100
#
interface Vlan-interface20
ip address 10.2.0.101 255.255.255.0
#
interface Vlan-interface40
ip address 13.1.1.101 255.255.255.0
#
interface Vlan-interface100
ip address 120.2.0.2 255.255.255.0
#
bgp 100
router-id 4.4.4.4
peer 10.1.0.101 as-number 100
peer 10.1.0.101 bfd
peer 120.2.0.1 as-number 300
peer 192.168.0.101 as-number 100
#
address-family ipv4 unicast
preference 255 100 130
peer 10.1.0.101 enable
peer 10.1.0.101 next-hop-local
peer 10.1.0.101 route-policy local-pre export
peer 192.168.0.101 enable
peer 192.168.0.101 next-hop-local
peer 120.2.0.1 enable
#
route-policy local-pre permit node 10
if-match ip address acl 2000
apply local-preference 200
#
acl basic 2000
rule 0 permit source 120.2.0.0 0.0.0.255
#
· Device E:
#
ospf 1
area 0.0.0.0
network 13.1.1.0 0.0.0.255
network 192.168.0.0 0.0.0.255
#
vlan 30
#
vlan 40
#
interface Vlan-interface30
ip address 192.168.0.102 255.255.255.0
#
interface Vlan-interface40
ip address 13.1.1.102 255.255.255.0
#
· Device F:
#
vlan 100
#
interface Vlan-interface100
ip address 120.2.0.1 255.255.255.0
#
bgp 300
router-id 6.6.6.6
peer 120.2.0.2 as-number 100
#
address-family ipv4 unicast
network 120.2.0.0 255.255.255.0
peer 120.2.0.2 enable
#
· H3C S5560-EI-G系列交换机 三层技术-IP路由配置指导-R7724
· H3C S5560-EI-G系列交换机 三层技术-IP路由命令参考-R7724
· H3C S5560-EI-G系列交换机 可靠性配置指导-R7724
· H3C S5560-EI-G系列交换机 可靠性命令参考-R7724
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!