Network Requirements
- Device4 is the connection device, just transmitting data transparently.
- Run the OSPF protocol on Device1, Device2 and Device3 to perform the route interacting.
- The data flow from Device1 to the 201.0.0.0/24 segment first selects Device3.
- The line between Device1 and Device3 uses the gateway keepalive function. When the line between Device1 and Device3 fails, the gateway keepalive fast detects the fault and modifies the interface status to down. After OSPF feels the status change of the interface, switch the route to Device2 for communication.
Network Topology
![Networking of configuring the gateway keepalive](/storage/images/Document/Maipu/monitoring/config-gateway-keepalive.jpg)
Figure 2–1 Networking of configuring the gateway keepalive
Configuration Steps
Step 1: Configure VLAN and add the port to the corresponding VLAN. (Omitted)
Step 2: Configure the IP address of the interface. (Omitted)
Step 3: Configure the OSPF process.
#Configure Device1.
Device1#configure terminal
Device1(config)#router ospf 100
Device1(config-ospf)#network 1.0.0.0 0.0.0.255 area 0
Device1(config-ospf)#network 2.0.0.0 0.0.0.255 area 0
Device1(config-ospf)#network 200.0.0.0 0.0.0.255 area 0
Device1(config-ospf)#exit
|
#Configure Device2.
Device2#configure terminal
Device2(config)#router ospf 100
Device2(config-ospf)#network 2.0.0.0 0.0.0.255 area 0
Device2(config-ospf)#network 3.0.0.0 0.0.0.255 area 0
Device2(config-ospf)#exit
|
#Configure Device3.
Device3#configure terminal
Device3(config)#router ospf 100
Device3(config-ospf)#network 1.0.0.0 0.0.0.255 area 0
Device3(config-ospf)#network 3.0.0.0 0.0.0.255 area 0
Device3(config-ospf)#network 201.0.0.0 0.0.0.255 area 0
Device3(config-ospf)#exit
|
#View the route 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 1.0.0.0/24 is directly connected, 00:20:17, vlan3
C 2.0.0.0/24 is directly connected, 13:01:32, vlan2
O 3.0.0.0/24 [110/2] via 2.0.0.2, 01:11:40, vlan2
[110/2] via 1.0.0.2, 00:02:00, vlan3
C 200.0.0.0/24 is directly connected, 01:31:58, vlan4
O 201.0.0.0/24 [110/2] via 1.0.0.2, 00:02:00, vlan3
# The data flow from Device1 to the segment 201.0.0.0/24 first selects Device3.
![note](/storage/images/Document/Maipu/note-icon.jpg)
-
The viewing method of Device2 and Device3 is the same as that of Device1, so the viewing process is omitted here.
Step 4: Configure the gateway keepalive.
#Configure Device1.
Device1(config)#interface vlan 3
Device1(config-if-vlan3)#keepalive gateway 1.0.0.2
Device1(config-if-vlan3)#exit
|
#Configure Device3.
Device3(config)#interface vlan 3
Device3(config-if-vlan3)#keepalive gateway 1.0.0.1
Device3(config-if-vlan3)#exit
|
#View the gateway keepalive information of Device1.
Device1#show keepalive gateway
interface vlan3 gateway 1.0.0.2 time 10s retry 3 remain 3 now UP
|
#View the gateway keepalive information of Device3.
Device3#show keepalive gateway
interface vlan3 gateway 1.0.0.1 time 10s retry 3 remain 3 now UP
|
Step 5: Check the result.
#After the line between Device1 and Device3 fails, the gateway keepalive fast detects the fault and modifies the interface VLAN3 status to down.
Device1#show keepalive gateway
interface vlan3 gateway 1.0.0.2 time 10s retry 3 remain 0 now DOWN
|
#After OSPF feels the status change of the interface VLAN3, switch the route to Device2 for communication.
Device1# show ip ospf interface vlan3
VLAN3 is down, line protocol is down
OSPF is enabled, but not running on this interface
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 2.0.0.0/24 is directly connected, 13:16:40, vlan2
O 3.0.0.0/24 [110/2] via 2.0.0.2, 00:01:25, vlan2
C 200.0.0.0/24 is directly connected, 00:10:53, vlan4
O 201.0.0.0/24 [110/3] via 2.0.0.2, 00:00:18, vlan2
#We can see that the data flow from Device1 to the segment 201.0.0.1/24 first selects Device2.