IPv4 Floating static routes can be used for the static route backup.
Figure 1 shows the IPv4 addresses and masks of each router interface and a host. Two IPv4 static routes to 10.1.5.0/24 are configured on Device A. The primary static route passes through Device B, and the floating static route passes through Device C.
When configuring an IPv4 floating static route, a next-hop address of this route must be specified if the outbound interface is of the broadcast type.
The configuration roadmap is as follows:
Configure an IPv4 address for each interface of each router.
On Devices B and C, configure IPv4 static routes to 10.1.5.0/24.
On Device A, configure IPv4 static routes to 10.1.3.0/24 and 10.1.4.0/24.
On Device A, configure two IPv4 static routes to 10.1.5.0/24 with different priorities.
On Device D, configure IPv4 static routes to 10.1.1.0/24 and 10.1.2.0/24 so that routers can communicate.
To complete the configuration, you need the following data:
On Device A, priority values of two static routes (60 for the one with 10.1.1.2 as the next hop address and 100 for the one with 10.1.2.2 as the next-hop address)
# Configure IPv4 static routes on Device B.
[~DeviceB] ip route-static 10.1.5.0 24 10.1.3.2 [*DeviceB] commit
# Configure IPv4 static routes on Device C.
[~DeviceC] ip route-static 10.1.5.0 24 10.1.4.2 [*DeviceC] commit
# Configure IPv4 static routes on Device A.
[~DeviceA] ip route-static 10.1.3.0 24 10.1.1.2 [*DeviceA] ip route-static 10.1.4.0 24 10.1.2.2 [*DeviceA] ip route-static 10.1.5.0 24 10.1.1.2 [*DeviceA] ip route-static 10.1.5.0 24 10.1.2.2 preference 100 [*DeviceA] commit
# Configure IPv4 static routes on Device D.
[~DeviceD] ip route-static 10.1.1.0 24 10.1.3.1 [*DeviceD] ip route-static 10.1.2.0 24 10.1.4.1 [*DeviceD] commit
# View information about static routes in the IP routing table of Device A.
<DeviceA> display ip routing-table protocol static Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ _public_ Routing Table : Static Destinations : 3 Routes : 3 Configured Routes : 3 Static routing table status : <Active> Destinations : 3 Routes : 3 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.3.0/24 Static 60 0 RD 10.1.1.2 GigabitEthernet0/1/1 10.1.4.0/24 Static 60 0 RD 10.1.2.2 GigabitEthernet0/1/2 10.1.5.0/24 Static 60 0 RD 10.1.1.2 GigabitEthernet0/1/1 Static routing table status : <Inactive> Destinations : 0 Routes : 0
# Use the tracert command to check the connectivity on Device A.
<DeviceA> tracert 10.1.5.1
traceroute to 10.1.5.1(10.1.5.1), max hops: 30 ,packet length: 40
1 10.1.1.2 90 ms 1 ms 1 ms
2 10.1.5.1 4 ms 1 ms 2 ms
# Run the shutdown command on GE 0/1/1 of Device A to simulate a link fault.
[~DeviceA] interface GigabitEthernet 0/1/1 [~DeviceA-GigabitEthernet0/1/1] shutdown [~DeviceA-GigabitEthernet0/1/1] commit
# View information about static routes in the IP routing table of Device A. The route to 10.1.5.0/24 switches to the floating static route with next hop 10.1.2.2.
[~DeviceA-GigabitEthernet0/1/1] quit [~DeviceA] quit <DeviceA> display ip routing-table protocol static Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ _public_ Routing Table : Static Destinations : 2 Routes : 2 Configured Routes : 2 Static routing table status : <Active> Destinations : 2 Routes : 2 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.4.0/24 Static 60 0 RD 10.1.2.2 GigabitEthernet0/1/2 10.1.5.0/24 Static 100 0 RD 10.1.2.2 GigabitEthernet0/1/2 Static routing table status : <Inactive> Destinations : 0 Routes : 0
# Use the tracert command to check the connectivity on Device A.
<DeviceA> tracert 10.1.5.1
traceroute to 10.1.5.1(10.1.5.1), max hops: 30 ,packet length: 40
1 10.1.2.2 100 ms 1 ms 1 ms
2 10.1.5.1 5 ms 1 ms 2 ms
Device A configuration file
# sysname DeviceA # interface GigabitEthernet0/1/1 undo shutdown ip address 10.1.1.1 255.255.255.0 # interface GigabitEthernet0/1/2 undo shutdown ip address 10.1.2.1 255.255.255.0 # ip route-static 10.1.3.0 24 10.1.1.2 ip route-static 10.1.4.0 24 10.1.2.2 ip route-static 10.1.5.0 24 10.1.1.2 ip route-static 10.1.5.0 24 10.1.2.2 preference 100 # return
Device B configuration file
# sysname DeviceB # interface GigabitEthernet0/1/1 undo shutdown ip address 10.1.1.2 255.255.255.0 # interface GigabitEthernet0/1/2 undo shutdown ip address 10.1.3.1 255.255.255.0 # ip route-static 10.1.5.0 24 10.1.3.2 # return
Device C configuration file
# sysname DeviceC # interface GigabitEthernet0/1/1 undo shutdown ip address 10.1.2.2 255.255.255.0 # interface GigabitEthernet0/1/2 undo shutdown ip address 10.1.4.1 255.255.255.0 # ip route-static 10.1.5.0 24 10.1.4.2 # return
Device D configuration file
# sysname DeviceD # interface GigabitEthernet0/1/1 undo shutdown ip address 10.1.3.2 255.255.255.0 # interface GigabitEthernet0/1/2 undo shutdown ip address 10.1.4.2 255.255.255.0 # interface GigabitEthernet0/1/3 undo shutdown ip address 10.1.5.1 255.255.255.0 # ip route-static 10.1.1.0 24 10.1.3.1 ip route-static 10.1.2.0 24 10.1.4.1 # return