ON THIS PAGE
Example: Configuring the Priority for Route Prefixes in the RPD Infrastructure
This example shows how to configure priority for route prefixes in the RPD infrastructure for the OSPF, LDP, and BGP protocols.
Requirements
This example uses the following hardware and software components:
Three routers in a combination of ACX Series, M Series, MX Series, PTX Series, and T Series.
Junos OS Release 16.1 or later running on all devices.
Before you begin:
Configure the device interfaces.
Configure the following protocols:
BGP
MPLS
OSPF
LDP
Overview
In a network with a large number of routes, it is sometimes
important to control the order in which routes get updated for better
convergence and to provide differentiated services. Prefix prioritization
helps users to prioritize certain routes/prefixes over others and
have control over the order in which routes get updated in the RIB
(routing table) and the FIB (forwarding table). In Junos OS Release
16.1 and later, you can control the order in which the routes get
updated from LDP/OSPF to rpd and rpd to kernel. You can specify a
priority of high
or low
through the existing
import policy in the protocols. In the event of a topology change,
high priority prefixes are updated in the routing table first, followed
by low priority prefixes. In general, routes that are not explicitly
assigned a priority are treated as medium priority. Within the same
priority level, routes will continue to be updated in lexicographic
order.
In this example, the routing device is in area 0.0.0.0, with interface ge-1/3/0 connected to the neighboring device. You configure three import routing policies: next-hop-self, ospf-prio, and prio_for_bgp. The routing policy next-hop-self accepts routes from BGP. For the OSPF routing policy, routes matching 172.16.25.3/32 are installed first because they have a priority of high. LDP imports routes from OSPF. For BGP prioritization, routes matching 172.16.50.1/32 are installed first because they have a priority of high. Routes associated with these prefixes are installed in the routing table in the order of the specified priority of the prefix.
Topology
Figure 1 shows the sample topology.
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 the configuration
mode.
R1
set interfaces ge-1/3/0 unit 0 family inet address 172.16.12.1/24 set interfaces ge-1/3/0 unit 0 family mpls set interfaces lo0 unit 0 family inet address 172.16.25.1/32 set protocols mpls interface ge-1/3/0.0 set protocols bgp group prio_internal type internal set protocols bgp group prio_internal local-address 172.16.25.1 set protocols bgp group prio_internal import prio_for_bgp set protocols bgp group prio_internal neighbor 172.16.25.3 family inet unicast set protocols bgp group prio_internal neighbor 172.16.25.3 export next-hop-self sset protocols ospf import ospf_prio set protocols ospf area 0.0.0.0 interface ge-1/3/0.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ldp interface ge-1/3/0.0 set protocols ldp interface lo0.0 set policy-options policy-statement next-hop-self term nhself from protocol bgp set policy-options policy-statement next-hop-self term nhself then next-hop self set policy-options policy-statement next-hop-self term nhself then accept set policy-options policy-statement ospf_prio term ospf_ldp from protocol ospf set policy-options policy-statement ospf_prio term ospf_ldp from route-filter 172.16.25.3/32 exact set policy-options policy-statement ospf_prio term ospf_ldp then priority high set policy-options policy-statement ospf_prio term ospf_ldp then accept set policy-options policy-statement prio_for_bgp term bgp_prio from protocol bgp set policy-options policy-statement prio_for_bgp term bgp_prio from route-filter 172.16.50.1/32 exact set policy-options policy-statement prio_for_bgp term bgp_prio then priority high set routing-options nonstop-routing set routing-options router-id 172.16.25.1 set routing-options autonomous-system 2525
R2
set interfaces ge-1/0/5 unit 0 family inet address 172.16.12.2/24 set interfaces ge-1/0/5 unit 0 family mpls set interfaces ge-1/3/0 unit 0 family inet address 172.16.23.2/24 set interfaces ge-1/3/0 unit 0 family mpls set interfaces lo0 unit 0 family inet address 172.16.25.2/32 set protocols mpls interface ge-1/0/5.0 set protocols mpls interface ge-1/3/0.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface ge-1/0/5.0 set protocols ospf area 0.0.0.0 interface ge-1/3/0.0 set protocols ldp interface ge-1/0/5.0 set protocols ldp interface ge-1/3/0.0 set protocols ldp interface lo0.0 set routing-options nonstop-routing set routing-options router-id 172.16.25.2 set routing-options autonomous-system 2525
R3
set interfaces ge-1/0/1 unit 0 family inet address 172.16.23.3/24 set interfaces ge-1/0/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 172.16.25.3/32 set protocols mpls interface ge-1/0/1.0 set protocols bgp group prio_internal type internal set protocols bgp group prio_internal local-address 172.16.25.3 set protocols bgp group prio_internal neighbor 172.16.25.1 family inet unicast set protocols bgp group prio_internal neighbor 172.16.25.1 export next-hop-self set protocols bgp group prio_internal neighbor 172.16.25.1 export static_to_bgp set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface ge-1/0/1.0 set protocols ldp interface ge-1/0/1.0 set protocols ldp interface lo0.0 set policy-options policy-statement next-hop-self term nhself from protocol bgp set policy-options policy-statement next-hop-self term nhself then next-hop self set policy-options policy-statement next-hop-self term nhself then accept set policy-options policy-statement static_to_bgp term s_to_b from protocol static set policy-options policy-statement static_to_bgp term s_to_b from route-filter 172.16.50.1/32 exact set policy-options policy-statement static_to_bgp term s_to_b from route-filter 172.16.50.2/32 exact set policy-options policy-statement static_to_bgp term s_to_b then accept set routing-options nonstop-routing set routing-options static route 172.16.50.1/32 receive set routing-options static route 172.16.50.2/32 receive set routing-options router-id 172.16.25.3 set routing-options autonomous-system 2525
Configuring Device R1
Step-by-Step Procedure
The following example requires that you navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Use the CLI Editor in Configuration Mode in the CLI User Guide.
To configure Device R1:
Configure the interfaces.
[edit interfaces]
user@R1# set interfaces ge-1/3/0 unit 0 family inet address 172.16.12.1/24 user@R1# set interfaces ge-1/3/0 unit 0 family mpls user@R1# set interfaces lo0 unit 0 family inet address 172.16.25.1/32Assign the loopback address to the device.
[edit lo0 unit 0 family]
user@R1# set address 172.16.25.1/32Configure MPLS.
[edit protocols]
user@R1# set protocols mpls interface ge-1/3/0.0Configure the router ID and autonomous system of Router R1.
[edit routing-options]
user@R1# set router-id 172.16.7.7 user@R1# set autonomous-system 100Enable OSPF on the interfaces of Router R1.
[edit protocols]
user@R1# set protocols ospf import ospf_prio user@R1# set protocols ospf area 0.0.0.0 interface ge-1/3/0.0 user@R1# set protocols ospf area 0.0.0.0 interface lo0.0 passiveConfigure LDP protocols on the interfaces.
[edit protocols]
user@R1# set protocols ldp interface ge-1/3/0.0 user@R1# set protocols ldp interface lo0.0Configure BGP.
[edit protocols]
user@R1# set protocols bgp group prio_internal type internal user@R1# set protocols bgp group prio_internal local-address 172.16.25.1 user@R1# set protocols bgp group prio_internal import prio_for_bgp user@R1# set protocols bgp group prio_internal neighbor 172.16.25.3 family inet unicast user@R1# set protocols bgp group prio_internal neighbor 172.16.25.3 export next-hop-selfConfigure the policy options to prioritize the routes. The policy next-hop-self accepts routes from BGP. You configure three import routing policies: next-hop-self, ospf-prio, and prio_for_bgp. The routing policy next-hop-self accepts routes from BGP. For the ospf-prio routing policy, routes matching 172.16.25.3/32 are installed first because they have a priority of high. LDP imports routes from OSPF. For prio_for_bgp policy, routes matching 172.16.50.1/32 are installed first because they have a priority of high.
[edit policy-options policy-statement]
user@R1# set policy-options policy-statement next-hop-self term nhself from protocol bgp user@R1# set policy-options policy-statement next-hop-self term nhself then next-hop self user@R1# set policy-options policy-statement next-hop-self term nhself then accept user@R1# set policy-options policy-statement ospf_prio term ospf_ldp from protocol ospf user@R1# set policy-options policy-statement ospf_prio term ospf_ldp from route-filter 172.16.25.3/32 exact set policy-options policy-statement ospf_prio term ospf_ldp then priority high set policy-options policy-statement ospf_prio term ospf_ldp then accept set policy-options policy-statement prio_for_bgp term bgp_prio from protocol bgp set policy-options policy-statement prio_for_bgp term bgp_prio from route-filter 172.16.50.1/32 exact set policy-options policy-statement prio_for_bgp term bgp_prio then priority high
Results
From configuration mode, confirm your configuration by entering the show interfaces, show protocols, show routing-options, and show policy-options commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
[edit] user@R1# show interfaces ge-1/3/0 { unit 0 { family inet { address 172.16.12.1/24; } family mpls; } } lo0 { unit 0 { family inet { address address 172.16.25.1/32; } } }
[edit] user@R1# show protocols mpls { interface ge-1/3/0.0; } bgp { group prio_internal { type internal; local-address 172.16.25.1; import prio_for_bgp neighbor 172.16.25.3 { family inet { unicast; } export next-hop-self; } } } ospf { import ospf_prio; area 0.0.0.0 { interface ge-1/3/0.0; interface lo0.0 { passive; } } } ldp { interface ge-1/3/0.0; interface lo0.0; } }
[edit] user@R1# show routing-options nonstop-routing; router-id 172.16.25.1; autonomous-system 2525;
[edit] user@R1# show policy-options policy-statement next-hop-self { term nhself { from protocol bgp; then { next-hop self; accept; } } } policy-statement ospf_prio { term ospf_ldp { from { protocol ospf; route-filter 172.16.25.3/32 exact; } then { priority high; accept; } } } policy-statement prio_for_bgp { term bgp_prio { from { protocol bgp; route-filter 172.16.50.1/32 exact; } then priority high; } }
If you are done configuring the device, enter commit
from the configuration mode.
Verification
Confirm that the configuration is working properly.
- Verifying the Priority for OSPF Routes
- Verifying the Priority for LDP Routes
- Verifying the Priority for BGP Routes
Verifying the Priority for OSPF Routes
Purpose
Verify that the priority is set for the expected route in OSPF.
Action
On Device R1, from operational mode, run the show
ospf route 172.16.25.3/32 extensive
command. A priority of high
is applied to OSPF route 172.16.25.3.
user@R1> show ospf route 172.16.25.3/32 extensive
Topology default Route Table:
Prefix Path Route NH Metric NextHop Nexthop
Type Type Type Interface Address/LSP
172.16.25.3 Intra Router IP 2 ge-1/3/0.0 172.16.12.2
area 0.0.0.0, origin 172.16.25.3, optional-capability 0x0
172.16.25.3/32 Intra Network IP 2 ge-1/3/0.0 172.16.12.2
area 0.0.0.0, origin 172.16.25.3, priority high
Meaning
The output shows priority high
is applied
for OSPF route 172.16.25.3.
Verifying the Priority for LDP Routes
Purpose
Verify if LDP inherits from OSPF.
Action
From operational mode, enter the show route 172.16.25.3
command to verify if LDP has inherited routes from OSPF.
user@R1> show route 172.16.25.3
inet.0: 24 destinations, 24 routes (24 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
172.16.25.3/32 *[OSPF/10] 00:10:27, metric 2
> to 172.16.25.2 via ge-1/3/0.0
inet.3: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
172.16.25.3/32 *[LDP/9] 00:10:24, metric 1
> to 172.16.25.2 via ge-1/3/0.0, Push 299824
From operational mode, enter the show route 172.16.25.3
extensive
command to verify if LDP has inherited priority.
user@R1> show route 172.16.25.3 extensive
inet.0: 24 destinations, 24 routes (24 active, 0 holddown, 0 hidden)
172.16.25.3/32 (1 entry, 1 announced)
State:<Flashall>
TSI:
KRT in-kernel 172.16.25.3/32 -> {172.16.12.2}
*OSPF Preference: 10
Next hop type: Router, Next hop index: 549
Address: 0xa463390
Next-hop reference count: 6
Next hop: 172.16.12.2 via ge-1/3/0.0, selected
Session Id: 0x0
State:<Active Int HighPriority>
Local AS: 2525
Age: 10:43 Metric: 2
Validation State: unverified
Area: 0.0.0.0
Task: OSPF
Announcement bits (4): 0-KRT 4-LDP 6-Resolve tree 2 7-Resolve_IGP_FRR task
AS path: I
inet.3: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
172.16.25.3/32 (1 entry, 1 announced)
State:<Flashall>
LDP Preference: 9
Next hop type: Router, Next hop index: 582
Address: 0xa477810
Next-hop reference count: 12
Next hop: 172.16.12.2 via ge-1/3/0.0, selected
Label operation: Push 299824
Label TTL action: prop-ttl
Load balance label: Label 299824: None;
Label element ptr: 0xa17ad00
Label parent element ptr: 0x0
Label element references: 1
Label element child references: 0
Label element lsp id: 0
Session Id: 0x0
State:<Active Int HighPriority>
Local AS: 2525
Age: 10:40 Metric: 1
Validation State: unverified
Task: LDP
Announcement bits (3): 2-Resolve tree 1 3-Resolve tree 2 4-Resolve_IGP_FRR task
AS path: I
Meaning
The output shows that LDP inherits priority high
for route 172.16.25.3 from OSPF.
Verifying the Priority for BGP Routes
Purpose
Verify that priority is set for the expected route in BGP.
Action
On Device R1, from operational mode, run the show
route protocol bgp
command to display the routes learned from
BGP.
user@R1> show route protocol bgp
inet.0: 24 destinations, 24 routes (24 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
172.16.50.1/32 *[BGP/170] 00:11:24, localpref 100, from 172.16.25.3
AS path: I, validation-state: unverified
> to 172.16.12.2 via ge-1/3/0.0, Push 299824
172.16.50.2/32 *[BGP/170] 00:11:24, localpref 100, from 172.16.25.3
AS path: I, validation-state: unverified
> to 172.16.12.2 via ge-1/3/0.0, Push 299824
inet.3: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
mpls.0: 9 destinations, 9 routes (9 active, 0 holddown, 0 hidden)
On Device R1, from operational mode, run the show route
172.16.50.1 extensive
command. High priority is applied for
BGP route 172.16.50.1.
user@R1> show route 172.16.50.1 extensive
inet.0: 24 destinations, 24 routes (24 active, 0 holddown, 0 hidden)
172.16.50.1/32 (1 entry, 1 announced)
TSI:
KRT in-kernel 172.16.50.1/32 -> {indirect(1048574)}
*BGP Preference: 170/-101
Next hop type: Indirect, Next hop index: 0
Address: 0xa487b10
Next-hop reference count: 4
Source: 172.16.25.3
Next hop type: Router, Next hop index: 582
Next hop: 172.16.12.2 via ge-1/3/0.0, selected
Label operation: Push 299824
Label TTL action: prop-ttl
Load balance label: Label 299824: None;
Label element ptr: 0xa17ad00
Label parent element ptr: 0x0
Label element references: 1
Label element child references: 0
Label element lsp id: 0
Session Id: 0x0
Protocol next hop: 172.16.25.3
Indirect next hop: 0xa4a9800 1048574 INH Session ID: 0x0
State: <Active Int Ext HighPriority>
Local AS: 2525 Peer AS: 2525
Age: 11:49 Metric2: 1
Validation State: unverified
Task: BGP_2525.172.16.25.3
Announcement bits (2): 0-KRT 6-Resolve tree 2
AS path: I (Atomic)
Accepted
Localpref: 100
Router ID: 172.16.25.3
Indirect next hops: 1
Protocol next hop: 172.16.25.3 Metric: 1
Indirect next hop: 0xa4a9800 1048574 INH Session ID: 0x0
Indirect path forwarding next hops: 1
Next hop type: Router
Next hop: 172.16.12.2 via ge-1/3/0.0
Session Id: 0x0
172.16.25.3/32 Originating RIB: inet.3
Metric: 1 Node path count: 1
Forwarding nexthops: 1
Nexthop: 172.16.12.2 via ge-1/3/0.0
Meaning
The output shows that priority high
is applied
for BGP route 172.16.50.1.