In Figure 1, four switches communicate using RIP on a small-sized network. Services are transmitted through the primary link SwitchA→SwitchB→SwitchD. Reliability must be improved for data transmitted from SwitchA to SwitchB so that services can be rapidly switched to another path when the primary link fails.
In this scenario, ensure that all connected interfaces have STP disabled. If STP is enabled and VLANIF interfaces of switches are used to construct a Layer 3 ring network, an interface on the network will be blocked. As a result, Layer 3 services on the network cannot run normally.
The configuration roadmap is as follows:
Configure IP address for each interface to ensure network reachability.
Enable RIP on each switch to implement network connections between processes.
Configure one-arm static BFD on SwitchA. BFD can rapidly detect the link status and help RIP speed up route convergence to implement fast link switching.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 10 20 [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type trunk [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 [SwitchA-GigabitEthernet0/0/1] quit [SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] port link-type trunk [SwitchA-GigabitEthernet0/0/2] port trunk allow-pass vlan 20 [SwitchA-GigabitEthernet0/0/2] quit
[SwitchA] interface vlanif 10 [SwitchA-Vlanif10] ip address 10.2.2.1 24 [SwitchA-Vlanif10] quit [SwitchA] interface vlanif 20 [SwitchA-Vlanif20] ip address 10.3.3.1 24 [SwitchA-Vlanif20] quit
# Configure SwitchA.
[SwitchA] rip 1 [SwitchA-rip-1] version 2 [SwitchA-rip-1] network 10.0.0.0 [SwitchA-rip-1] quit
# Configure SwitchB.
[SwitchB] rip 1 [SwitchB-rip-1] version 2 [SwitchB-rip-1] network 10.0.0.0 [SwitchB-rip-1] network 172.16.0.0 [SwitchB-rip-1] quit
# Configure SwitchC.
[SwitchC] rip 1 [SwitchC-rip-1] version 2 [SwitchC-rip-1] network 10.0.0.0 [SwitchC-rip-1] quit
# Configure SwitchD.
[SwitchD] rip 1 [SwitchD-rip-1] version 2 [SwitchD-rip-1] network 172.16.0.0 [SwitchD-rip-1] quit
# After completing the preceding operations, run the display rip neighbor command. The command output shows that SwitchA, SwitchB, and SwitchC have established neighbor relationships with each other. In the following example, the display on SwitchA is used.
[SwitchA] display rip 1 neighbor
---------------------------------------------------------------------
IP Address Interface Type Last-Heard-Time
---------------------------------------------------------------------
10.2.2.2 Vlanif10 RIP 0:0:10
Number of RIP routes : 2
10.3.3.2 Vlanif20 RIP 0:0:8
Number of RIP routes : 1
# Run the display ip routing-table command. The command output shows that the devices have imported routes from each other. In the following example, the display on SwitchA is used.
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 8 Routes : 9 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.2.2.0/24 Direct 0 0 D 10.2.2.1 Vlanif10 10.2.2.1/32 Direct 0 0 D 127.0.0.1 Vlanif10 10.3.3.0/24 Direct 0 0 D 10.3.3.1 Vlanif20 10.3.3.1/32 Direct 0 0 D 127.0.0.1 Vlanif20 10.4.4.0/24 RIP 100 1 D 10.2.2.2 Vlanif10 RIP 100 1 D 10.3.3.2 Vlanif20 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 172.16.1.0/24 RIP 100 1 D 10.2.2.2 Vlanif10
The preceding command output shows that the next-hop address and outbound interface of the route to destination 172.16.1.0/24 are 10.2.2.2 and VLANIF10, and traffic is transmitted over the active link SwitchA->SwitchB.
# Configure one-arm BFD on SwitchA.
[SwitchA] bfd [SwitchA-bfd] quit [SwitchA] bfd 1 bind peer-ip 10.2.2.2 interface vlanif 10 source-ip 10.1.1.1 one-arm-echo [SwitchA-bfd-session-1] discriminator local 1 [SwitchA-bfd-session-1] min-echo-rx-interval 200 [SwitchA-bfd-session-1] commit [SwitchA-bfd-session-1] quit
The source IP address 10.1.1.1 can be configured as the IP address of another interface (such as loopback interface) on the device. This parameter must be configured. Otherwise, the BFD session cannot be set up.
# Enable static BFD on VLANIF 10.
[SwitchA] interface vlanif 10 [SwitchA-Vlanif10] rip bfd static [SwitchA-Vlanif10] quit
# After the configurations are completed, run the display bfd session all command on SwitchA. The command output shows that a static BFD session has been set up.
[SwitchA] display bfd session all
--------------------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
--------------------------------------------------------------------------------
1 - 10.2.2.2 Up S_IP_IF Vlanif10
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 1/0
# Run the shutdown command on GigabitEthernet0/0/1 of SwitchB to simulate a fault in the active link.
The link fault is simulated to verify the configuration. In actual situations, the operation is not required.
[SwitchB] interface gigabitethernet 0/0/1 [SwitchB-GigabitEthernet0/0/1] shutdown
# Check the routing table of SwitchA.
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 6 Routes : 6 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.3.3.0/24 Direct 0 0 D 10.3.3.1 Vlanif20 10.3.3.1/32 Direct 0 0 D 127.0.0.1 Vlanif20 10.4.4.0/24 RIP 100 1 D 10.3.3.2 Vlanif20 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 172.16.1.0/24 RIP 100 2 D 10.3.3.2 Vlanif20
The preceding command output shows that the standby link SwitchA->SwitchC->SwitchB is used after the active link fails, and the next-hop address and outbound interface of the route to destination 172.16.1.0/24 are 10.3.3.2 and VLANIF20.
SwitchA configuration file
# sysname SwitchA # vlan batch 10 20 # bfd # interface Vlanif10 ip address 10.2.2.1 255.255.255.0 rip bfd static # interface Vlanif20 ip address 10.3.3.1 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 20 # bfd 1 bind peer-ip 10.2.2.2 interface Vlanif10 source-ip 10.1.1.1 one-arm-echo discriminator local 1 min-echo-rx-interval 200 commit # rip 1 version 2 network 10.0.0.0 # return
SwitchB configuration file
# sysname SwitchB # vlan batch 10 30 40 # interface Vlanif10 ip address 10.2.2.2 255.255.255.0 # interface Vlanif30 ip address 10.4.4.1 255.255.255.0 # interface Vlanif40 ip address 172.16.1.1 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 30 # interface GigabitEthernet0/0/3 port link-type trunk port trunk allow-pass vlan 40 # rip 1 version 2 network 10.0.0.0 network 172.16.0.0 # return
SwitchC configuration file
# sysname SwitchC # vlan batch 20 30 # interface Vlanif20 ip address 10.3.3.2 255.255.255.0 # interface Vlanif30 ip address 10.4.4.2 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 30 # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 20 # rip 1 version 2 network 10.0.0.0 # return
SwitchD configuration file
# sysname SwitchD # vlan batch 40 # interface Vlanif40 ip address 172.16.1.2 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 40 # rip 1 version 2 network 172.16.0.0 # return