Example for Configuring FRR for IPv4 Static Routes on the Public Network
Networking Requirements
As shown in Figure 2-13, two static routes with next hops being SwitchA and SwitchB respectively are configured on SwitchT. Link B functions as the backup of link A. If link A is faulty, traffic can be switched to link B in a timely manner.
Configuration Roadmap
The configuration roadmap is as follows:
Configure two static routes with next hops being SwitchA and SwitchB respectively on SwitchT so that the devices can communicate with each other.
Set a higher preference for link A on SwitchT to ensure that link A functions as the primary link and link B functions as the backup of link A.
Enable FRR for static routes on SwitchT so that traffic can be quickly switched to link B if link A is faulty.
Procedure
- Create VLANs, add interfaces to the VLANs, and assign IP addresses to the VLANIF interfaces. (Details are not provided here.)
- Configure device names. (Details are not provided here.)
- Configure static routes.
# Configure static routes on SwitchA.
[~SwitchA] ip route-static 172.16.1.0 24 vlanif 20 192.168.10.1
[*SwitchA] ip route-static 172.17.1.0 24 vlanif 40 192.168.11.1
[*SwitchA] commit
# Configure static routes on SwitchB.
[~SwitchB] ip route-static 172.16.1.0 24 vlanif 30 192.168.20.1
[*SwitchB] ip route-static 172.17.1.0 24 vlanif 50 192.168.21.1
[*SwitchB] commit
Configure static routes on Switch C.
[~SwitchC] ip route-static 172.16.1.0 24 vlanif 40 192.168.11.2
[*SwitchC] ip route-static 172.16.1.0 24 vlanif 50 192.168.21.2
[*SwitchC] commit
# Configure static routes on SwitchT.
[~SwitchT] ip route-static 172.17.1.0 24 vlanif 20 192.168.10.2
[*SwitchT] ip route-static 172.17.1.0 24 vlanif 30 192.168.20.2
[*SwitchT] commit
# Check the IP routing table on SwitchT. You can view that the two static routes are in load balancing mode.
[~SwitchT] display ip routing-table
Proto: Protocol Pre: Preference Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Destinations : 11 Routes : 12 Destination/Mask Proto Pre Cost Flags NextHop Interface 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 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 172.17.1.0/24 Static 60 0 D 192.168.10.2 Vlanif20 Static 60 0 D 192.168.20.2 Vlanif30 192.168.10.0/24 Direct 0 0 D 192.168.10.1 Vlanif20 192.168.10.1/32 Direct 0 0 D 127.0.0.1 Vlanif20 192.168.10.255/32 Direct 0 0 D 127.0.0.1 Vlanif20 192.168.20.0/24 Direct 0 0 D 192.168.20.1 Vlanif30 192.168.20.1/32 Direct 0 0 D 127.0.0.1 Vlanif30 192.168.20.255/32 Direct 0 0 D 127.0.0.1 Vlanif30
- Change the preferences of IPv4 static routes.
# Change the preferences of static routes on SwitchT.
[~SwitchT] ip route-static 172.17.1.0 24 vlanif 20 192.168.10.2 preference 40
[*SwitchT] commit
# Check the IP routing table on SwitchT, and you can view that preferences of the static routes are changed.
[~SwitchT] display ip routing-table
Proto: Protocol Pre: Preference Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Destinations : 10 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 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 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 172.17.1.0/24 Static 40 0 D 192.168.10.2 Vlanif20 192.168.10.0/24 Direct 0 0 D 192.168.10.1 Vlanif20 192.168.10.1/32 Direct 0 0 D 127.0.0.1 Vlanif20 192.168.10.255/32 Direct 0 0 D 127.0.0.1 Vlanif20 192.168.20.0/24 Direct 0 0 D 192.168.20.1 Vlanif30 192.168.20.1/32 Direct 0 0 D 127.0.0.1 Vlanif30 192.168.20.255/32 Direct 0 0 D 127.0.0.1 Vlanif30
- Enable FRR for IPv4 static routes.
# Enable FRR for static routes on SwitchT.
[~SwitchT] ip route-static frr
[*SwitchT] commit
# Check information about the backup outbound interface and backup next hop on SwitchT.
[~SwitchT] display ip routing-table 172.17.1.0 verbose
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Summary Count : 1 Destination: 172.17.1.0/24 Protocol: Static Process ID: 0 Preference: 40 Cost: 0 NextHop: 192.168.10.2 Neighbour: 0.0.0.0 State: Active Adv Age: 00h00m03s Tag: 0 Priority: medium Label: NULL QoSInfo: 0x0 IndirectID: 0x31000032 RelayNextHop: 0.0.0.0 Interface: Vlanif20 TunnelID: 0x0 Flags: D BkNextHop: 192.168.20.2 BkInterface: Vlanif30 BkLabel: NULL SecTunnelID: 0x0 BkPETunnelID: 0x0 BkPESecTunnelID: 0x0 BkIndirectID: 0x32000033
- If link A is faulty, traffic can be quickly switched to link B.
[~SwitchT] interface 10GE 1/0/2
[~SwitchT-10GE1/0/2] shutdown
[*SwitchT-10GE1/0/2] commit
[~SwitchT-10GE1/0/2] quit
# Check information about the route to 172.17.1.0/24 on SwitchT.
[~SwitchT] display ip routing-table 172.17.1.0 verbose
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Summary Count : 1 Destination: 172.17.1.0/24 Protocol: Static Process ID: 0 Preference: 60 Cost: 0 NextHop: 192.168.20.2 Neighbour: 0.0.0.0 State: Active Adv Age: 00h00m07s Tag: 0 Priority: medium Label: NULL QoSInfo: 0x0 IndirectID: 0x32000033 RelayNextHop: 0.0.0.0 Interface: Vlanif30 TunnelID: 0x0 Flags: D
Configuration Files
Configuration file of SwitchA
#
sysname SwitchA
#
vlan batch 20 40
#
interface Vlanif20
ip address 192.168.10.2 255.255.255.0
#
interface Vlanif40
ip address 192.168.11.2 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 20
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 40
#
ip route-static 172.16.1.0 255.255.255.0 vlanif 20 192.168.10.1
ip route-static 172.17.1.0 255.255.255.0 vlanif 40 192.168.11.1
#
return
Configuration file of SwitchB
#
sysname SwitchB
#
vlan batch 30 50
#
interface Vlanif30
ip address 192.168.20.2 255.255.255.0
#
interface Vlanif50
ip address 192.168.21.2 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 30
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 50
#
ip route-static 172.16.1.0 255.255.255.0 vlanif 30 192.168.20.1
ip route-static 172.17.1.0 255.255.255.0 vlanif 50 192.168.21.1
#
return
Configuration file of SwitchC
#
sysname SwitchC
#
vlan batch 40 50 60
#
interface Vlanif40
ip address 192.168.11.1 255.255.255.0
#
interface Vlanif50
ip address 192.168.21.1 255.255.255.0
#
interface Vlanif60
ip address 172.17.1.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 60
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 40
#
interface 10GE1/0/3
port link-type trunk
port trunk allow-pass vlan 50
#
ip route-static 172.16.1.0 255.255.255.0 vlanif 40 192.168.11.2
ip route-static 172.16.1.0 255.255.255.0 vlanif 50 192.168.21.2
#
return
Configuration file of SwitchT
#
sysname SwitchT
#
vlan batch 10 20 30
#
interface Vlanif10
ip address 172.16.1.1 255.255.255.0
#
interface Vlanif20
ip address 192.168.10.1 255.255.255.0
#
interface Vlanif30
ip address 192.168.20.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
interface 10GE1/0/3
port link-type trunk
port trunk allow-pass vlan 30
#
ip route-static frr
ip route-static 172.17.1.0 255.255.255.0 vlanif 20 192.168.10.2 preference 40
ip route-static 172.17.1.0 255.255.255.0 vlanif 30 192.168.20.2
#
return