image.png

配置sw A

<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 10 30
[SwitchA]  interface gigabitethernet 1/0/1
[SwitchA-GigabitEthernet1/0/1] port link-type trunk
[SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 10
[SwitchA-GigabitEthernet1/0/1] quit
[SwitchA]  interface gigabitethernet 1/0/2
[SwitchA-GigabitEthernet1/0/2] port link-type trunk
[SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 30
[SwitchA-GigabitEthernet1/0/2] quit

配置vlan接口

[SwitchA]  interface vlanif 10
[SwitchA-Vlanif10] ip address 10.1.1.1 24
[SwitchA-Vlanif10] quit
[SwitchA]  interface vlanif 30
[SwitchA-Vlanif30] ip address 10.3.3.1 24
[SwitchA-Vlanif30] quit

开启ospf

[SwitchA] ospf 1 router-id 10.10.10.1
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] network 10.3.3.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit

[SwitchB] ospf 1 router-id 10.10.10.2
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 10.2.2.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] network 10.3.3.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] network 172.16.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] quit


[SwitchC] ospf 1 router-id 10.10.10.3
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] network 10.2.2.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit

查看邻居关系

[SwitchA] 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.2  BDR: 10.1.1.1  MTU: 0
   Dead timer due  in 38  sec
   Retrans timer interval: 5
   Neighbor  is up  for 00:00:15
   Authentication Sequence: [ 0 ]
 
                  Neighbors
 
 Area 0.0.0.0  interface 10.3.3.1(Vlanif30)'s neighbors
 Router ID: 10.10.10.2       Address: 10.3.3.2
   State: Full  Mode:Nbr  is Master  Priority: 1
   DR: 10.3.3.2  BDR: 10.3.3.1  MTU: 0
   Dead timer due  in 25  sec
   Retrans timer interval: 5
   Neighbor  is up  for 00:00:59
   Authentication Sequence: [ 0 ]

看路由出口172,流量走的ab

[SwitchA] display ospf routing
 
          OSPF Process 1 with Router ID 10.10.10.1
                   Routing Tables
 
 Routing  for Network
 Destination        Cost  Type       NextHop         AdvRouter       Area
 10.1.1.0/24        1     Transit    10.1.1.1        10.10.10.1      0.0.0.0
 10.3.3.0/24        1     Transit    10.3.3.1        10.10.10.1      0.0.0.0
 10.2.2.0/24        2     Transit    10.1.1.2        10.10.10.3      0.0.0.0
 10.2.2.0/24        2     Transit    10.3.3.2        10.10.10.3      0.0.0.0
 172.16.1.0/24      2     Stub       10.3.3.2        10.10.10.2      0.0.0.0
 
 Total Nets: 5
 Intra Area: 5  Inter Area: 0  ASE: 0  NSSA: 0

分别在abc上配置bsd联动ospf


[SwitchA] bfd    //全局使能BFD功能
[SwitchA-bfd] quit
[SwitchA] ospf 1
[SwitchA-ospf-1] bfd all-interfaces enable    //在OSPF进程下使能BFD特性
[SwitchA-ospf-1] quit

[SwitchB] bfd    //全局使能BFD功能
[SwitchB-bfd] quit
[SwitchB] ospf 1
[SwitchB-ospf-1] bfd all-interfaces enable    //在OSPF进程下使能BFD特性
[SwitchB-ospf-1] quit

[SwitchC] bfd    //全局使能BFD功能
[SwitchC-bfd] quit
[SwitchC] ospf 1
[SwitchC-ospf-1] bfd all-interfaces enable    //在OSPF进程下使能BFD特性
[SwitchC-ospf-1] quit

查看bsd会话状态

[SwitchA] display ospf bfd session all
 
          OSPF Process 1 with Router ID 10.10.10.1
  Area 0.0.0.0  interface 10.1.1.1(Vlanif10)'s BFD Sessions
 
 NeighborId:10.10.10.3       AreaId:0.0.0.0          Interface:Vlanif10
 BFDState:up                 rx    :1000             tx       :1000
 Multiplier:3                BFD Local Dis:8195      LocalIpAdd:10.1.1.1
 RemoteIpAdd:10.1.1.2        Diagnostic Info:No diagnostic information
 
  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:8194      LocalIpAdd:10.3.3.1
 RemoteIpAdd:10.3.3.2         Diagnostic Info:No diagnostic information

最后验证,shutdown傻瓜交换机,再次查看路由,是否切换