Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

BGP Route Prioritization

Understanding BGP Route Prioritization

While BGP is one of the most widely deployed routing protocols in use today, carrying not only network layer reachability information (NLRI) but also many types of VPN reachability information, it is notable that the protocol does not specify how the information is ordered in BGP update messages. This decision is left to the implementation.

In large-scale systems, BGP might take a significant amount of time to exchange its routing information between systems. This is especially true during BGP startup, route refresh operations, and when assisting with graceful restart. In order to handle the large amount of information that needs to be processed, BGP route processing is accomplished with the use of queues. Outbound routes are placed in output queues for processing. BGP route prioritization is introduced in Junos OS Release 16.1 as a means to allow the user to deterministically prioritize BGP update messages. BGP route prioritization is a process that operates strictly on the output queues., helping to order the information that is being sent to BGP peer routers.

In the default configuration, that is, when no output-queue-priority configuration or policy that overrides priority exists, the routing protocol process (rpd) enqueues BGP routes into the output queue per routing information base (RIB). A RIB, which is also known as a routing table, corresponds to both a specific address family, such as inet.0, and to routing instance tables such as vrf.inet.0. While processing output queues, the BGP update code flushes the output queue for the current RIB before moving on to the next RIB that has a non-empty output queue.

Note:
  • There is no attempt to automatically prioritize routes even if there is a theoretical possibility of doing so. Prioritizing individual routes is, therefore, left completely to the user.

  • If BGP route priorities are changed for a peer group, the BGP peer sessions get reset.

Use Cases for BGP Route Prioritization

Table 1 shows the types of routes that would benefit from route prioritization and some notes about why they would benefit from it. Examples of those types of routes are also included. Prioritizing these routes within a given large-scale environment can help routers to react more quickly to important route changes.

Table 1: Use Cases for BGP Route Prioritization

Route or Update Type

Notes

Example

Prefixes used for resolving BGP next hops to an immediate forwarding next hop

Changes to these prefixes should be made as soon as possible.

  • Host routes

  • Prefixes that are part of recursive resolution requirements

Routes used for tunnel endpoints

Tunnel endpoints such as GRE or MPLS are often used as BGP next hops.

BGP labeled unicast routes

Route types that are critical for the operation of a protocol feature

For some VPN protocols, certain route types are used to trigger time sensitive changes within the protocol. Changes to these routes must be made as soon as possible.

  • MVPN Source Active Autodiscovery (Type 5)

  • Multihomed VPLS sites

Service provider infrastructure routes

These routes are critical to a service provider’s ability to conduct business. Without accurate and up-to-date routes, the service provider might not be able to provide some of its service offerings.

  • Internal management networks

  • Network operations prefixes

  • DNS resources

Network topology changes

These should be prioritized ahead of simple route refreshes.

  • New router added to the network

  • Routers removed from the network

Properties of BGP Route Prioritization

BGP route prioritization in Junos OS is implemented using a set of 17 prioritized (numbered) output queues that are serviced by a user-configurable token mechanism. This section describes the prioritized output queues, the operation of the token system, and assignment of routes to queues.

Prioritized Output Queues

Table 2 shows the available output queues and their function within the prioritization system. The prioritization system functions on a traditional low, medium, and high priority scale with 1 being the lowest priority and 16 being the highest priority.

Table 2: Prioritized Output Queues

Queue

Function

expedited

This is the highest priority output queue. Routes in this class are guaranteed some portion of the output queue processing while flushing the output queue. This queue has no number and is referred to in the configuration by its name.

1 (lowest priority)

This is the lowest priority output queue. This is the default priority queue, meaning that routes with no explicit queue assignment from either automatic protocol determination or user policy are placed in this queue by default. Route refresh messages are placed in this queue by default.

2 - 16 (low - high priority)

These output queues range in priority from lowest priority (2) to highest priority (16). They are assigned routes based on user policy or BGP peer configuration. Routes in a higher priority output queue can preempt the routes in lower priority queues.

Assignment of Routes to Queues

Assigning routes to the various queues can be accomplished by setting and assigning BGP export policies. This means that route priority can vary in each BGP peer group as well as in specific neighbor configurations within the BGP peer groups. You can also assign routes to queues using the action portion of a policy statement. Assignment of routes to queues by the action of a policy statement will override assignments made by BGP configuration.

Work Token Mechanism

Tokens correspond to the work to create a BGP update message. All the queues are assigned tokens that are stored in buckets. The number of tokens in a given bucket is user-configurable. In this way, users can craft policies that permit their routes to be served in the proportions they prefer. The configuration of the priority scheduler is accomplished globally within BGP at the [edit protocols bgp] hierarchy level. By default, all priority queues have at least 1 token in their bucket to ensure that misconfigured priorities do not starve.

Understanding Queue Priority and Fairness

The scheme used by BGP route prioritization focuses on two elements: fairness and priority:

  • Fairness means that when there is work to do in any given queue, other queues are guaranteed to get some work done at some point. How much work each queue is permitted to get done is determined by the number of tokens assigned to each priority.

  • Priority means that when there is competing work and fairness has been ensured, to always choose the more important work.

For example, presume three classes of priority: low, medium, and high. These could be assigned to queues 1, 2, and 3, respectively. Alternatively, they could be assigned to queues 3, 6, and 9. For fairness, if the decision is that high priority gets 50% of the available work, medium gets 35%, and low gets the remaining 15%, tokens can be assigned as 50 to high, 35 to medium, and 15 to low. Alternatively, tokens can be assigned as 5 to high, 4 to medium, and 2 to low. You can assign any of the 17 queues any value between 1 and 100. The ratio of the number of tokens in a single queue to the total number of tokens in all queues gives the percentage of work that will be done in each queue.

Priority is most important when work appears in a queue while tokens are in the process of being spent in another queue by the work scheduler. Table 3 shows the starting point for an example of this.

Table 3: Queues and Tokens

Priority Queue (Queue Number)

Number of Tokens Assigned to Queue

Number of Tokens Left in Queue

Number of Entries in Queue

High (9)

50

50

0

Medium (6)

35

15

5000

Low (3)

15

15

10000

If we assume that the work scheduler is processing the medium queue (queue number 6) and has spent 20 tokens, then there are 15 tokens left to be spent on the remaining entries in the medium queue and 15 tokens left to be spent in the low priority queue. If 5 entries arrive in the expedited queue prior to the next run of the work scheduler, those 5 entries will be sent first because there are still 50 tokens left in the expedited queue.

Queue Servicing Procedure

The queue servicing procedure operates per-BGP peer group with each group maintaining its own token buckets.

  • Token buckets for each priority start full either at the configured number of tokens or at the default of 1.

  • Each time a route entry is pulled from a queue to start a BGP update, a token is subtracted from that queue.

  • While the expedited queue has tokens, every other queue entry is drawn from the expedited queue, subject to the route packing rules.

  • Entries are taken from the queue that has the highest priority. This means that if entries are added to a higher priority queue between runs of the queue servicing mechanism, and there are tokens available in that higher priority queue, the new entries in the higher priority queue are sent first, thus preempting entries in lower priority queues. If the higher priority queue has no work tokens available when the new entries arrive, the new entries are not sent until after the next token refresh.

  • Tokens are refreshed after all priority queues have been serviced (there are no entries remaining in any queue) or when all tokens are exhausted.

Example: Configuring the BGP Output Priority Scheduler and Global Address Family Priority

This example shows how to configure and test the system-wide BGP route priority scheduler.

Requirements

This example uses the following hardware and software components:

  • An MX Series router (R1) running Junos OS Release 16.1 or later

Before you configure the BGP route prioritization scheduler, be sure that the BGP protocol is running on the router.

Overview

The BGP route priority scheduler is used to control the amount of work done within the 17 output queues of the route prioritization system. The system uses a set of 17 prioritized output queues, per routing instance to which work tokens are assigned. All 17 prioritized output queues (1-16 and expedited) have 1 token assigned by default. Any number of tokens between 1 and 100 can be assigned to each of the 17 queues. Assigning tokens to the queues allows you to balance the amount of work performed on the routes within the queues. In addition, default settings for high, medium, and low priority queuing can be configured by assigning each keyword to a specific numbered output queue. In this example, we will configure each of the 17 priority queues with distinct numbers of work tokens and we also configure global output priorities for inet unicast routes and demonstrate inheritance by setting up some BGP groups to override global priority settings.

Configuration

  • Assign update-tokens to each of the 17 output queues.

  • Specify which numbered queues will be used as the default high, medium, and low priority queues.

  • Configure global output priorities for inet unicast routes.

  • Configure a BGP group named test1 that will show group override capabilities.

  • Configure a BGP group named test2 that will show global inheritance.

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, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

Configuring the Individual Output Priority Queues

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the Junos OS CLI User Guide.

  1. Assign update tokens to each of the 17 prioritized output queues

Configure Default Queues to Use for High, Medium, and Low Priority Route Updates

Step-by-Step Procedure

Results

To confirm the configuration, issue the show bgp output-scheduler command from operational mode:

Configure Global Output Priorities for a Route Family

Procedure

Step-by-Step Procedure
  1. Configure the global output-queue-priority for inet unicast routes:

Configure a BGP Group Named test1

Procedure

Step-by-Step Procedure
  1. Configure the group test1 to override global output priorities and include one neighbor that overrides the group and one neighbor that does not.

Configure a BGP Group Named test2

Step-by-Step Procedure
  1. Configure the BGP group test2 to accept global defaults.

Verification

Verifying the BGP Output Scheduler Configuration

Purpose

To verify the configuration of the BGP output scheduler, issue the show bgp output-scheduler command from operational mode.

Action

Meaning

The output shows that the output scheduler configuration was successful in applying the proper number of tokens to each output queue and that the high, medium, and low priority keywords were assigned to the proper output queues.

Verify Group Configuration, Group Override, and Neighbor Override

Purpose

To verify that the configured groups demonstrate group override, neighbor override and inheritance, issue the show bgp group group-name command from operational mode.

Action
Meaning

The output shows that the output queue priority for peer 224.223.2.2 is 7, the route refresh priority is 8, and the withdraw priority is expedited. While the output queue priority for neighbor 224.223.1.1 is 4, the route refresh priority is 6, and the withdraw priority is the default setting for the family inet unicast, or 3.

Verify Inheritance from Global Priority Settings

Purpose

To verify that groups that are not configured to override the global BGP route prioritization settings, issue the show bgp group group-name command at the operational level.

Action
Meaning

The output shows that the default route priorities for inet unicast routes in the test2 group match the global configuration.

Example: Controlling Routing Table Convergence Using BGP Route Prioritization

The following example configures BGP route prioritization in order to allow inet labeled-unicast routes to converge before inet unicast routes.

Requirements

This example uses the following hardware and software components:

  • An MX-Series router (R1) running Junos OS Release 16.1 or later that will be the focus of the example.

  • A second router (R2) configured as an internal BGP peer with R1.

  • A BGP route reflector (RR) that will be used to populate the routing tables of R1. In this example, we will not configure the route reflector.

Overview

The BGP route prioritization feature is designed to allow the prioritization of outbound BGP update messages in a router. Using BGP route prioritization enables the user to ensure that more important BGP route updates, such as GRE or MPLS tunnel endpoint changes, are sent out before less important BGP route updates, such as route refresh updates.

In this example, we will configure R1 to treat inet labeled-unicast route updates to R2 as higher priority than inet unicast route updates. To do this, we will configure the R2 router to accept both inet unicast and inet labeled-unicast routes from its peer router, R1. Then we will populate the inet.0 routing table on R1 from a route reflector and import a portion of that table into the labeled-unicast table, inet.3 using rib-group import. As the routes are queued on R1, we can validate the operation by observing whether the routes in the inet.3 RIB are flushed before the remainder of the routes in the inet.0 RIB.

Configure BGP Route Prioritization

Configure R2 as a BGP peer of R1.

On R1:

  • Configure the router R2 as a peer of router R1.

  • Create a BGP group named reflector that will be used to obtain Internet routes from a route reflector.

  • Create a BGP group named internal that will be used for assigning the labeled-unicast traffic to a higher priority output-queue.

  • Create a RIB group into which the routes received from the reflector are imported.

  • Create the policy that determines what portion of the inet.0 RIB is imported into the RIB group.

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, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

Router R2

Router R1

Procedure

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the Junos OS CLI User Guide.

To configure R2:

  1. Configure a BGP group named internal.

Step-by-Step Procedure

To configure R1:

  1. Configure a BGP group named reflector that receives routes from the RR.

  2. Configure a BGP group named internal

  3. Configure a RIB group named into3

  4. Configure a routing policy named match-long

  5. Configure a routing policy named match-all

Verification

Verifying that Neighbor Updates are Properly Prioritized

Purpose

To confirm that route updates are being placed in the proper queues and that the queues are updating.

Action

To see the route updates that are queued for the BGP neighbor 192.0.2.2, issue the show bgp neighbor output-queue 192.0.2.2 command from operational mode

Meaning

The output from show bgp neighbor output-queue 192.0.2.2 shows that the labeled unicast route updates are placed in the priority 2 output queue and that the priority 2 output queue is emptied before the unicast route updates that are in the priority 1 output queue.