ON THIS PAGE
Example: Configuring Backup Selection Policy for the OSPF or OSPF3 Protocol
This example shows how to configure the backup selection policy for the OSPF or OSPF3 protocol, which enables you to select a loop-free alternate (LFA) in the network.
When you enable backup selection policies, Junos OS allows selection of LFA based on the policy rules and attributes of the links and nodes in the network. These attributes are admin-group, srlg, bandwidth, protection-type, metric, and node.
Requirements
This example uses the following hardware and software components:
Eight routers that can be a combination of M Series Multiservice Edge Routers, MX Series 5G Universal Routing Platforms, PTX Series Packet Transport Routers, and T Series Core Routers
Junos OS Release 15.1 or later running on all devices
Before you begin:
Configure the device interfaces.
Configure OSPF.
Overview
In Junos OS, the default loop-free alternative (LFA) selection algorithm or criteria can be overridden with an LFA policy. These policies are configured for each destination (IPv4 and IPv6) and a primary next-hop interface . These backup policies enforce LFA selection based on admin-group, srlg, bandwidth, protection-type, metric, and node attributes of the backup path. During backup shortest-path-first (SPF) computation, each attribute (both node and link) of the backup path, stored per backup next-hop, is accumulated by IGP. For the routes created internally by IGP, the attribute set of every backup path is evaluated against the policy configured for each destination (IPv4 and IPv6) and a primary next-hop interface. The first or the best backup path is selected and installed as the backup next hop in the routing table. To configure the backup selection policy, include the backup-selection configuration statement at the [edit routing-options] hierarchy level. The show backup-selection command displays the configured policies for a given interface and destination. The display can be filtered against a particular destination, prefix, interface, or logical systems.
Topology
In this topology shown in Figure 1, the backup selection policy is configured on Device R3.

Configuration
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, copy and paste the commands into the CLI at the [edit] hierarchy level, and then enter commit from configuration mode.
R0
R1
R2
R3
R4
R5
R6
R7
Configuring Device R3
Step-by-Step Procedure
The following example requires that you navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure Device R3:
- Configure the interfaces.[edit interfaces]user@R3# set ge-0/0/5 unit 0 family inet address 172.16.50.2/30user@R3# set ge-0/0/5 unit 0 family inet6 address 2001:db8:50:1:1::2/64user@R3# set ge-0/0/5 unit 0 family mplsuser@R3# set xe-0/3/1 unit 0 family inet address 172.16.75.1/30user@R3# set xe-0/3/1 unit 0 family inet6 address 2001:db8:75:1:1::1/64user@R3# set xe-0/3/1 unit 0 family mplsuser@R3# set ge-1/0/0 unit 0 family inet address 172.16.80.1/30user@R3# set ge-1/0/0 unit 0 family inet6 address 2001:db8:80:1:1::1/64user@R3# set ge-1/0/0 unit 0 family mplsuser@R3# set ge-1/0/5 unit 0 family inet address 172.16.200.1/24user@R3# set ge-1/0/5 unit 0 family inet6 address 2001:db8:200:1:1::1/64user@R3# set ge-1/0/6 unit 0 family inet address 172.16.85.1/30user@R3# set ge-1/0/6 unit 0 family inet6 address 2001:db8:85:1:1::1/64user@R3# set ge-1/0/6 unit 0 family mplsuser@R3# set xe-1/3/0 unit 0 family inet address 172.16.90.1/30user@R3# set xe-1/3/0 unit 0 family inet6 address 2001:db8:90:1:1::1/64user@R3# set xe-1/3/0 unit 0 family mplsuser@R3# set lo0 unit 0 family inet address 172.16.3.3/32 primaryuser@R3# set lo0 unit 0 family inet6 address 2001:db8::3:3:3:3/128 primaryuser@R3# set lo0 unit 0 family mpls
- Configure srlg values.[edit routing-options]user@R3# set srlg srlg1 srlg-value 1001user@R3# set srlg srlg2 srlg-value 1002user@R3# set srlg srlg3 srlg-value 1003user@R3# set srlg srlg4 srlg-value 1004user@R3# set srlg srlg5 srlg-value 1005user@R3# set srlg srlg6 srlg-value 1006user@R3# set srlg srlg7 srlg-value 1007user@R3# set srlg srlg8 srlg-value 1008user@R3# set srlg srlg9 srlg-value 1009user@R3# set srlg srlg10 srlg-value 10010user@R3# set srlg srlg11 srlg-value 10011user@R3# set srlg srlg12 srlg-value 10012
- Configure the ID of the router.[edit routing-options]user@R3# set router-id 172.16.3.3
- Apply the routing policy to all equal-cost multipaths
exported from the routing table to the forwarding table.[edit routing-options]user@R3# set forwarding-table export ecmp
- Configure attributes of the backup selection policy.[edit routing-options backup-selection]user@R3# set destination 10.1.1.0/30 interface xe-1/3/0.0 admin-group include-all c2user@R3# set destination 10.1.1.0/30 interface all admin-group exclude c3user@R3# set destination 10.1.1.0/30 interface all srlg strictuser@R3# set destination 10.1.1.0/30 interface all protection-type nodeuser@R3# set destination 10.1.1.0/30 interface all bandwidth-greater-equal-primaryuser@R3# set destination 10.1.1.0/30 interface all neighbor preference 172.16.7.7user@R3# set destination 10.1.1.0/30 interface all root-metric lowestuser@R3# set destination 10.1.1.0/30 interface all metric-order rootuser@R3# set destination 172.16.30.0/30 interface all admin-group exclude c5user@R3# set destination 172.16.30.0/30 interface all srlg strictuser@R3# set destination 172.16.30.0/30 interface all protection-type nodeuser@R3# set destination 172.16.30.0/30 interface all bandwidth-greater-equal-primaryuser@R3# set destination 172.16.30.0/30 interface all neighbor preference 172.16.7.7user@R3# set destination 172.16.30.0/30 interface all root-metric lowestuser@R3# set destination 172.16.30.0/30 interface all metric-order rootuser@R3# set destination 192.168.45.0/30 interface all admin-group exclude c5user@R3# set destination 192.168.45.0/30 interface all srlg strictuser@R3# set destination 192.168.45.0/30 interface all protection-type nodeuser@R3# set destination 192.168.45.0/30 interface all bandwidth-greater-equal-primaryuser@R3# set destination 192.168.45.0/30 interface all neighbor preference 172.16.7.7user@R3# set destination 192.168.45.0/30 interface all root-metric lowestuser@R3# set destination 192.168.45.0/30 interface all metric-order root
- Enable RSVP on all the interfaces.[edit protocols]user@R3# set rsvp interface all
- Configure administrative groups.[edit protocols mpls]user@R3# set admin-groups c0 0user@R3# set admin-groups c1 1user@R3# set admin-groups c2 2user@R3# set admin-groups c3 3user@R3# set admin-groups c4 4user@R3# set admin-groups c5 5user@R3# set admin-groups c6 6user@R3# set admin-groups c7 7user@R3# set admin-groups c8 8user@R3# set admin-groups c9 9user@R3# set admin-groups c10 10user@R3# set admin-groups c11 11user@R3# set admin-groups c12 12user@R3# set admin-groups c13 13user@R3# set admin-groups c14 14user@R3# set admin-groups c15 15user@R3# set admin-groups c16 16user@R3# set admin-groups c17 17user@R3# set admin-groups c18 18user@R3# set admin-groups c19 19user@R3# set admin-groups c20 20user@R3# set admin-groups c21 21user@R3# set admin-groups c22 22user@R3# set admin-groups c23 23user@R3# set admin-groups c24 24user@R3# set admin-groups c25 25user@R3# set admin-groups c26 26user@R3# set admin-groups c27 27user@R3# set admin-groups c28 28user@R3# set admin-groups c29 29user@R3# set admin-groups c30 30user@R3# set admin-groups c31 31
- Enable MPLS on all the interfaces and configure administrative
group for an interface.[edit protocols mpls]user@R3# set interface alluser@R3# set interface ge-0/0/5.0 admin-group c0
- Enable link protection and configure metric values on
all the interfaces for an OSPF area.[edit protocols ospf]user@R3# set area 0.0.0.0 interface ge-0/0/5.0 link-protectionuser@R3# set area 0.0.0.0 interface ge-0/0/5.0 metric 10user@R3# set area 0.0.0.0 interface xe-0/3/1.0 metric 21user@R3# set area 0.0.0.0 interface ge-1/0/0.0 metric 13user@R3# set area 0.0.0.0 interface ge-1/0/6.0 metric 15user@R3# set area 0.0.0.0 interface xe-1/3/0.0 link-protectionuser@R3# set area 0.0.0.0 interface xe-1/3/0.0 metric 22
- Enable link protection and configure metric values on
all the interfaces for an OSPF3 area.[edit protocols ospf3]user@R3# set area 0.0.0.0 interface ge-0/0/5.0 link-protectionuser@R3# set area 0.0.0.0 interface ge-0/0/5.0 metric 10user@R3# set area 0.0.0.0 interface xe-0/3/1.0 metric 21user@R3# set area 0.0.0.0 interface ge-1/0/0.0 metric 13user@R3# set area 0.0.0.0 interface ge-1/0/6.0 metric 15user@R3# set area 0.0.0.0 interface xe-1/3/0.0 link-protectionuser@R3# set area 0.0.0.0 interface xe-1/3/0.0 metric 22
- Configure the routing policy.[edit policy-options]user@R3# set policy-statement ecmp term 1 then load-balance per-packet
Results
From configuration mode, confirm your configuration by entering the show interfaces, show protocols, show policy-options, and show routing-options commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
If you are done configuring the device, enter commit from configuration mode.
Verification
Confirm that the configuration is working properly.
Verifying the Routes
Purpose
Verify that the expected routes are learned.
Action
From operational mode, run the show route command for the routing table.
user@R3> show route
inet.0: 48 destinations, 48 routes (48 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 172.16.3.3/32 *[Direct/0] 02:22:27 > via lo0.0 10.4.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.5.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.6.128.0/17 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.9.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.10.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.13.4.0/23 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.13.10.0/23 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.82.0.0/15 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.84.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.85.12.0/22 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.92.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.92.16.0/20 *[Direct/0] 02:22:57 > via fxp0.0 10.92.24.195/32 *[Local/0] 02:22:57 Local via fxp0.0 10.94.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.99.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.102.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.150.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.155.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.157.64.0/19 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.160.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.204.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.205.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.206.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.207.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.209.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.212.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.213.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.214.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.215.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.216.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.218.13.0/24 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.218.14.0/24 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.218.16.0/20 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.218.32.0/20 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 10.227.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 172.16.50.0/30 *[Direct/0] 02:19:55 > via ge-0/0/5.0 172.16.50.2/32 *[Local/0] 02:19:58 Local via ge-0/0/5.0 172.16.75.0/30 *[Direct/0] 02:19:55 > via xe-0/3/1.0 172.16.75.1/32 *[Local/0] 02:19:57 Local via xe-0/3/1.0 172.16.24.195/32 *[Direct/0] 02:22:57 > via lo0.0 172.16.0.0/12 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 192.168.0.0/16 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 192.168.102.0/23 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 192.168.136.0/24 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 192.168.136.192/32 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 192.168.137.0/24 *[Static/5] 02:22:57 > to 10.92.31.254 via fxp0.0 192.168.233.5/32 *[OSPF/10] 00:16:55, metric 1 MultiRecv iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 47.0005.80ff.f800.0000.0108.0001.1280.9202.4195/152 *[Direct/0] 02:22:57 > via lo0.0 mpls.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0 *[MPLS/0] 00:16:55, metric 1 Receive 1 *[MPLS/0] 00:16:55, metric 1 Receive 2 *[MPLS/0] 00:16:55, metric 1 Receive 13 *[MPLS/0] 00:16:55, metric 1 Receive inet6.0: 10 destinations, 11 routes (10 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 2001:db8:50:1:1::/64 *[Direct/0] 02:19:44 > via ge-0/0/5.0 2001:db8:50:1:1::2/128 *[Local/0] 02:19:58 Local via ge-0/0/5.0 2001:db8:75:1:1::/64 *[Direct/0] 02:19:44 > via xe-0/3/1.0 2001:db8:75:1:1::1/128 *[Local/0] 02:19:57 Local via xe-0/3/1.0 2001:db8::3:3:3:3/128 *[Direct/0] 02:22:27 > via lo0.0 2001:db8::128:92:24:195/128 *[Direct/0] 02:22:57 > via lo0.0 fe80::/64 *[Direct/0] 02:19:44 > via ge-0/0/5.0 [Direct/0] 02:19:43 > via xe-0/3/1.0 fe80::205:86ff:fe00:ed05/128 *[Local/0] 02:19:58 Local via ge-0/0/5.0 fe80::205:86ff:fe00:ed3d/128 *[Local/0] 02:19:57 Local via xe-0/3/1.0 fe80::5668:a50f:fcc1:3ca2/128 *[Direct/0] 02:22:57 > via lo0.0
Meaning
The output shows all Device R3 routes.
Verifying the OSPF Route
Purpose
Verify the routing table of OSPF.
Action
From operational mode, run the show ospf route detail command for Device R3.
user@R3> show ospf route detail
Topology default Route Table: Prefix Path Route NH Metric NextHop Nexthop Type Type Type Interface Address/LSP 172.16.50.0/30 Intra Network IP 10 ge-0/0/5.0 area 0.0.0.0, origin 172.16.3.3, priority low 172.16.75.0/30 Intra Network IP 21 xe-0/3/1.0 area 0.0.0.0, origin 172.16.3.3, priority low
Meaning
The output displays the routing table of OSPF routers.
Verifying the OSPF3 Route
Purpose
Verify the routing table of OSPF3.
Action
From operational mode, run the show ospf3 route detail command for Device R3.
user@R3> show ospf3 route detail
Prefix Path Route NH Metric Type Type Type 2001:db8:50:1:1::/64 Intra Network IP 10 NH-interface ge-0/0/5.0 Area 0.0.0.0, Origin 172.16.3.3, Priority low 2001:db8:75:1:1::/64 Intra Network IP 21 NH-interface xe-0/3/1.0 Area 0.0.0.0, Origin 172.16.3.3, Priority low
Meaning
The output displays the routing table of OSPF3 routers.
Verifying the Backup Selection Policy for Device R3
Purpose
Verify the backup selection policy for Device R3.
Action
From operational mode, run the show backup-selection command for Device R3.
user@R3> show backup-selection
Prefix: 10.1.1.0/30 Interface: all Admin-group exclude: c3 Neighbor preference: 172.16.7.7 Protection Type: Node, Downstream Paths Only: Disabled, SRLG: Strict, B/w >= Primary: Enabled, Root-metric: lowest, Dest-metric: lowest Metric Evaluation Order: Root-metric, Dest-metric Policy Evaluation Order: Admin-group, SRLG, Bandwidth, Protection, node, Metric Interface: xe-1/3/0.0 Admin-group include-all: c2 Protection Type: Link, Downstream Paths Only: Disabled, SRLG: Loose, B/w >= Primary: Disabled, Root-metric: lowest, Dest-metric: lowest Metric Evaluation Order: Dest-metric, Root-metric Policy Evaluation Order: Admin-group, SRLG, Bandwidth, Protection, node, Metric Prefix: 172.16.30.0/30 Interface: all Admin-group exclude: c5 Neighbor preference: 172.16.7.7 Protection Type: Node, Downstream Paths Only: Disabled, SRLG: Strict, B/w >= Primary: Enabled, Root-metric: lowest, Dest-metric: lowest Metric Evaluation Order: Root-metric, Dest-metric Policy Evaluation Order: Admin-group, SRLG, Bandwidth, Protection, node, Metric Prefix: 172.16.45.0/30 Interface: all Admin-group exclude: c5 Neighbor preference: 172.16.7.7 Protection Type: Node, Downstream Paths Only: Disabled, SRLG: Strict, B/w >= Primary: Enabled, Root-metric: lowest, Dest-metric: lowest Metric Evaluation Order: Root-metric, Dest-metric Policy Evaluation Order: Admin-group, SRLG, Bandwidth, Protection, node, Metric
Meaning
The output displays the configured policies per prefix per primary next-hop interface.