Network Requirements
- On Device1, configure two static routes to reach network segment 192.168.1.0/24. One route passes Device2, and the other route passes Device3.
- Device1 first uses the route between Device1 and Device2 to forward packets. If the link is faulty, Device1 switches over to the route between Device1 and Device3 for communication.
Network Topology
![Networking for Configure a Floating Static Route](/storage/images/Document/Maipu/unicast-routing/config-floating-static-route.jpg)
Figure 3-2 Networking for Configure a Floating Static Route
Configuration Steps
Step 1: Create VLANs, and add ports to the required VLANs. (Omitted)
Step 2: Configure IP addresses for the ports. (Omitted)
Step 3: Configure static routes.
#On Device1, configure two routes to network segment 192.168.1.0/24 through Device2 and Device3.
Device1#configure terminal
Device1(config)#ip route 192.168.1.0 255.255.255.0 10.1.1.2
Device1(config)#ip route 192.168.1.0 255.255.255.0 20.1.1.2
|
#Query the routing table of Device1.
Device1#show ip route
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M - Management
D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B - BGP, i-ISIS
Gateway of last resort is not set
C 10.1.1.0/24 is directly connected, 02:16:43, vlan2
C 20.1.1.0/24 is directly connected, 03:04:15, vlan3
C 127.0.0.0/8 is directly connected, 14:53:00, lo0
S 192.168.1.0/24 [1/100] via 10.1.1.2, 00:00:05, vlan2
[1/100] via 20.1.1.2, 00:00:02, vlan3
According to the routing tables, two routes from Device1 to network segment 192.168.1.0/24 are reachable, and the route form load balancing.
Step 4: Configure a floating route.
#Configure Device1. Modify the administrative range of the route with the gateway address 20.1.1.2 to 15 so that the route becomes a floating route.
Device1(config)#ip route 192.168.1.0 255.255.255.0 20.1.1.2 15
|
Step 5: Check the result.
#Query the routing table of Device1.
Device1#show ip route
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M - Management
D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B - BGP, i-ISIS
Gateway of last resort is not set
C 10.1.1.0/24 is directly connected, 02:28:25, vlan2
C 20.1.1.0/24 is directly connected, 03:15:58, vlan3
C 127.0.0.0/8 is directly connected, 15:04:42, lo0
S 192.168.1.0/24 [1/100] via 10.1.1.2, 00:11:47, vlan2
According to the routing table, because the route with the administrative range 1 has a higher priority than the route with the administrative range 15, the route with the gateway 20.1.1.2 is deleted.
#After the route between Device1 and Device2 becomes faulty, query the routing table of Device1.
Device1#show ip route
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M Management
D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B BGP, i-ISIS
Gateway of last resort is not set
C 20.1.1.0/24 is directly connected, 03:23:44, vlan3
C 127.0.0.0/8 is directly connected, 15:12:28, lo0
S 192.168.1.0/24 [15/100] via 20.1.1.2, 00:00:02, vlan3
According to the routing table, the route with a larger administrative range has been added to the routing table to forward packets through Device3.
![note](/storage/images/Document/Maipu/note-icon.jpg)
-
The most significant feature of the floating static route is that it acts as a backup route.