OSPF FRR configuration example
Network requirements
As shown in Figure 31, Switch S, Switch A, and Switch D reside in the same OSPF domain. Configure OSPF FRR so that when the link between Switch S and Switch D fails, traffic is immediately switched to Link B.
Figure 31: Network diagram
![](images/image31.png)
Configuration procedure
Configure IP addresses and subnet masks for interfaces on the switches. (Details not shown.)
Configure OSPF on the switches to make sure Switch S, Switch A, and Switch D can communicate with each other at the network layer. (Details not shown.)
Configure OSPF FRR to automatically calculate the backup next hop:
You can enable OSPF FRR to either calculate a backup next hop by using the LFA algorithm, or specify a backup next hop by using a routing policy.
(Method 1.) Enable OSPF FRR to calculate the backup next hop by using the LFA algorithm:
# Configure Switch S.
<SwitchS> system-view [SwitchS] bfd echo-source-ip 1.1.1.1 [SwitchS] ospf 1 [SwitchS-ospf-1] fast-reroute lfa [SwitchS-ospf-1] quit
# Configure Switch D.
<SwitchD> system-view [SwitchD] bfd echo-source-ip 4.4.4.4 [SwitchD] ospf 1 [SwitchD-ospf-1] fast-reroute lfa [SwitchD-ospf-1] quit
(Method 2.) Enable OSPF FRR to designate a backup next hop by using a routing policy.
# Configure Switch S.
<SwitchS> system-view [SwitchS] bfd echo-source-ip 1.1.1.1 [SwitchS] ip prefix-list abc index 10 permit 4.4.4.4 32 [SwitchS] route-policy frr permit node 10 [SwitchS-route-policy-frr-10] if-match ip address prefix-list abc [SwitchS-route-policy-frr-10] apply fast-reroute backup-interface vlan-interface 100 backup-nexthop 12.12.12.2 [SwitchS-route-policy-frr-10] quit [SwitchS] ospf 1 [SwitchS-ospf-1] fast-reroute route-policy frr [SwitchS-ospf-1] quit
# Configure Switch D.
<SwitchD> system-view [SwitchD] bfd echo-source-ip 4.4.4.4 [SwitchD] ip prefix-list abc index 10 permit 1.1.1.1 32 [SwitchD] route-policy frr permit node 10 [SwitchD-route-policy-frr-10] if-match ip address prefix-list abc [SwitchD-route-policy-frr-10] apply fast-reroute backup-interface vlan-interface 101 backup-nexthop 24.24.24.2 [SwitchD-route-policy-frr-10] quit [SwitchD] ospf 1 [SwitchD-ospf-1] fast-reroute route-policy frr [SwitchD-ospf-1] quit
Verifying the configuration
# Display route 4.4.4.4/32 on Switch S to view the backup next hop information.
[SwitchS] display ip routing-table 4.4.4.4 verbose Summary Count : 1 Destination: 4.4.4.4/32 Protocol: OSPF Process ID: 1 SubProtID: 0x1 Age: 04h20m37s Cost: 1 Preference: 10 Tag: 0 State: Active Adv OrigTblID: 0x0 OrigVrf: default-vrf TableID: 0x2 OrigAs: 0 NBRID: 0x26000002 LastAs: 0 AttrID: 0xffffffff Neighbor: 0.0.0.0 Flags: 0x1008c OrigNextHop: 13.13.13.2 Label: NULL RealNextHop: 13.13.13.2 BkLabel: NULL BkNextHop: 12.12.12.2 Tunnel ID: Invalid Interface: Vlan-interface200 BkTunnel ID: Invalid BkInterface: Vlan-interface100
# Display route 1.1.1.1/32 on Switch D to view the backup next hop information.
[SwitchD] display ip routing-table 1.1.1.1 verbose Summary Count : 1 Destination: 1.1.1.1/32 Protocol: OSPF Process ID: 1 SubProtID: 0x1 Age: 04h20m37s Cost: 1 Preference: 10 Tag: 0 State: Active Adv OrigTblID: 0x0 OrigVrf: default-vrf TableID: 0x2 OrigAs: 0 NBRID: 0x26000002 LastAs: 0 AttrID: 0xffffffff Neighbor: 0.0.0.0 Flags: 0x1008c OrigNextHop: 13.13.13.1 Label: NULL RealNextHop: 13.13.13.1 BkLabel: NULL BkNextHop: 24.24.24.2 Tunnel ID: Invalid Interface: Vlan-interface200 BkTunnel ID: Invalid BkInterface: Vlan-interface101