????????如图1所示,SwitchA、SwitchB和SwitchC之间运行OSPF,SwitchA和SwitchB之间的交换仅作透传功能。现在需要SwitchA和SwitchB能快速感应它们之间的链路状态,当链路SwitchA-SwitchB发生故障时,业务能快速切换到备份链路SwitchA-SwitchC-SwitchB上
采用如下思路配置OSPF与BFD联动:
配置SwitchA。SwitchB和SwitchC的配置与SwitchA类似
<Huawei>system-view //进入系统视图
[SW_a]undo info-center enable //关闭信息提示
[SW_a]sysname SW_A //修改设备名
[SW_A]vlan batch 10 30 //创建vlan10 30
[SW_A]int GigabitEthernet 0/0/1 //进入接口
[SW_A-GigabitEthernet0/0/1]port link-type trunk //配置干道模式
[SW_A-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 //放行vlan10
[SW_A-GigabitEthernet0/0/1]quit //退出配置
[SW_A]int GigabitEthernet 0/0/2 //进入接口
[SW_A-GigabitEthernet0/0/2]port link-type trunk //配置干道模式
[SW_A-GigabitEthernet0/0/2]port trunk allow-pass vlan 30 //放行vlan30
[SW_A-GigabitEthernet0/0/2]quit //退出配置
[SW_A]
# 配置SwitchA。SwitchB和SwitchC的配置与SwitchA类似
[SW_A]interface Vlanif 10 //进入vlan10
[SW_A-Vlanif10]ip address 10.1.1.1 24 //配置IP地址
[SW_A-Vlanif10]quit //退出配置
[SW_A]interface Vlanif 30 //进入vlan30
[SW_A-Vlanif30]ip address 10.3.3.1 24 //配置IP地址
[SW_A-Vlanif30]quit //退出配置
[SW_A]
[SW_A]ospf 1 router-id 10.10.10.1 //配置router-id
[SW_A-ospf-1]area 0 //进入area0
[SW_A-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 //宣告1.0网段
[SW_A-ospf-1-area-0.0.0.0]network 10.3.3.0 0.0.0.255 //宣告3.0网段
[SW_A-ospf-1-area-0.0.0.0]quit //退出配置
[SW_A-ospf-1]quit //退出ospf
[SW_A]
[SW_B]ospf 1 router-id 10.10.10.2
[SW_B-ospf-1]area 0
[SW_B-ospf-1-area-0.0.0.0]network 10.2.2.0 0.0.0.255
[SW_B-ospf-1-area-0.0.0.0]network 10.3.3.0 0.0.0.255
[SW_B-ospf-1-area-0.0.0.0]network 172.16.1.0 0.0.0.255
[SW_B-ospf-1-area-0.0.0.0]quit
[SW_B-ospf-1]quit
[SW_B]
[SW_C]ospf 1 router-id 10.10.10.3
[SW_C-ospf-1]area 0
[SW_C-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[SW_C-ospf-1-area-0.0.0.0]network 10.2.2.0 0.0.0.255
[SW_C-ospf-1-area-0.0.0.0]quit
[SW_C-ospf-1]quit
[SW_C]
# 配置完成后,执行命令display ospf peer,可以看到SwitchA,SwitchB和SwitchC之间互相建立了邻接关系。以SwitchA的显示结果为例。
[SW_A]display ospf peer
OSPF Process 1 with Router ID 10.10.10.1
Neighbors
Area 0.0.0.0 interface 10.1.1.1(Vlanif10)'s neighbors
Router ID: 10.10.10.3 Address: 10.1.1.2
State: Full Mode:Nbr is Master Priority: 1
DR: 10.1.1.1 BDR: 10.1.1.2 MTU: 0
Dead timer due in 34 sec
Retrans timer interval: 5
Neighbor is up for 00:01:32
Authentication Sequence: [ 0 ]
[SW_A]
# 查看SwitchA的OSPF路由表的信息,可以看到去往SwitchB和SwitchC的路由表项。而去往目的网段172.16.1.0/24的路由下一跳地址为10.3.3.2,说明流量在链路SwitchA→SwitchB上传输
?
[SW_C]display ospf routing
OSPF Process 1 with Router ID 10.10.10.3
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.1.1.0/24 1 Stub 10.1.1.3 10.10.10.3 0.0.0.0
10.2.2.0/24 1 Transit 10.2.2.3 10.10.10.3 0.0.0.0
10.3.3.0/24 2 Stub 10.2.2.2 10.10.10.2 0.0.0.0
172.16.1.0/24 2 Stub 10.2.2.2 10.10.10.2 0.0.0.0
Total Nets: 4
Intra Area: 4 Inter Area: 0 ASE: 0 NSSA: 0
[SW_C]
[SW_A]bfd
[SW_A-bfd]quit
[SW_A]ospf 1
[SW_A-ospf-1]bfd all-interfaces enable
[SW_A-ospf-1]quit
[SW_A]
[SW_B]bfd
[SW_B-bfd]quit
[SW_B]ospf 1
[SW_B-ospf-1]bfd all-interfaces enable
[SW_B-ospf-1]q
[SW_B]
[SW_C]bfd
[SW_C-bfd]quit
[SW_C]ospf 1
[SW_C-ospf-1]bfd all-interfaces enable
[SW_C-ospf-1]quit
[SW_C]
[SW_C]display ospf bfd session all
OSPF Process 1 with Router ID 10.10.10.3
Area 0.0.0.0 interface 10.1.1.3(Vlanif10)'s BFD Sessions
NeighborId:10.10.10.1 AreaId:0.0.0.0 Interface:Vlanif10
BFDState:up rx :1000 tx :1000
Multiplier:3 BFD Local Dis:8194 LocalIpAdd:10.1.1.3
RemoteIpAdd:10.1.1.1 Diagnostic Info:No diagnostic information
Area 0.0.0.0 interface 10.2.2.3(Vlanif20)'s BFD Sessions
NeighborId:10.10.10.2 AreaId:0.0.0.0 Interface:Vlanif20
BFDState:up rx :1000 tx :1000
Multiplier:3 BFD Local Dis:8193 LocalIpAdd:10.2.2.3
RemoteIpAdd:10.2.2.2 Diagnostic Info:No diagnostic information
[SW_C]
[SW_C]int GigabitEthernet 0/0/1
[SW_C-GigabitEthernet0/0/1]shutdown
[SW_C-GigabitEthernet0/0/1]quit
[SW_C]
[SW_A]display ospf bfd session all
OSPF Process 1 with Router ID 10.10.10.1
Area 0.0.0.0 interface 10.3.3.1(Vlanif30)'s BFD Sessions
NeighborId:10.10.10.2 AreaId:0.0.0.0 Interface:Vlanif30
BFDState:up rx :1000 tx :1000
Multiplier:3 BFD Local Dis:8195 LocalIpAdd:10.3.3.1
RemoteIpAdd:10.3.3.2 Diagnostic Info:No diagnostic information
[SW_A]
111?