[Contents] [Prev] [Next] [Index] [Report an Error]


Route Preferences

For unicast routes, the JUNOS routing protocol process uses the information in its routing table, along with the properties set in the configuration file, to choose an active route for each destination. While the JUNOS software might know of many routes to a destination, the active route is the preferred route to that destination and is the one that is installed in the forwarding table and used when actually routing packets.

The routing protocol process generally determines the active route by selecting the route with the lowest preference value. The preference is an arbitrary value in the range from 0 through 255 that the software uses to rank routes received from different protocols, interfaces, or remote systems.

The preference value is used to select routes to destinations in external autonomous systems (ASs) or routing domains; it has no effect on the selection of routes within an AS (that is, within an IGP). Routes within an AS are selected by the IGP and are based on that protocol's metric or cost value.

This section includes the following topics:

Alternate and Tiebreaker Preferences

The JUNOS software provides support for alternate and tiebreaker preferences, and some of the routing protocols, including BGP and label switching, use these additional preferences. With these protocols, you can specify a primary route preference, preference, and a secondary preference, preference2, that is used as a tiebreaker. You can also mark route preferences with additional route tiebreaker information by specifying a color, color, and a tiebreaker color, color2.

The software uses a four-byte value to represent the route preference value. When using the preference value to select an active route, the software first compares the primary route preference values, choosing the route with the lowest value. If there is a tie and a secondary preference has been configured, the software compares the secondary preference values, choosing the route with the lowest value. The secondary preference values must be included in a set for the preference values to be considered.

How the Active Route Is Determined

For each prefix in the routing table, the routing protocol process selects a single best path, called the active route. The algorithm for determining the active route is as follows:

  1. Choose the path with the lowest preference value (routing protocol process preference). Routes that are not eligible to be used for forwarding (for example, because they were rejected by routing policy or because a next hop is inaccessible) have a preference of -1 and are never chosen.
  2. For BGP, prefer the path with higher local preference. For non-BGP paths, choose the path with the lowest preference2 value.
  3. If the path includes an AS path:
  1. Prefer the route with a shorter AS path.

Confederation sequences are considered to have a path length of 0, and AS and confederation sets are considered to have a path length of 1.

  1. Prefer the route with the lower origin code. Routes learned from an IGP have a lower origin code than those learned from an EGP, and both have lower origin codes than incomplete routes (routes whose origin is unknown).
  2. Depending on whether nondeterministic routing table path selection behavior is configured, there are two possible cases:

If nondeterministic routing table path selection behavior is configured (that is, the path-selection cisco-nondeterministic statement is included in the BGP configuration), prefer the path with the lowest MED metric. When you display the routes in the routing table using the show route command, they generally appear in order from most preferred to least preferred and are ordered with the best route first, followed by all other routes in order from newest to oldest.

In both cases, confederations are not considered when determining neighboring ASs. Also, in both cases, a missing metric is treated as if a MED were present but zero.

  1. Prefer strictly internal paths, which include IGP routes and locally generated routes (static, direct, local, and so forth).
  2. Prefer strictly external (EBGP) paths over external paths learned through interior sessions (IBGP).
  3. For BGP, prefer the path whose next hop is resolved through the IGP route with the lowest metric.
  4. For BGP, prefer the path whose BGP next hop is resolved through the IGP route with the largest number of next hops.
  5. For BGP, prefer the route with the shortest route reflection cluster list. Routes without a cluster list are considered to have a cluster list of length 0.
  6. For BGP, prefer the route with the lowest IP address value for the BGP router ID.
  7. Prefer the path that was learned from the neighbor with the lowest peer IP address.

Multiple Active Routes

The interior gateway protocols (IGPs) compute equal-cost multipath next hops, and internal BGP (IBGP) picks up these next hops. When there are multiple, equal-cost next hops associated with a route, the routing protocol process installs only one of the next hops in the forwarding path with each route, randomly selecting which next hop to install. For example, if there are 3 equal-cost paths to an exit router and 900 routes leaving through that router, each path ends up with about 300 routes pointing at it. This mechanism provides load distribution among the paths while maintaining packet ordering per destination.

Default Route Preference Values

The JUNOS software routing protocol process assigns a default preference value to each route that the routing table receives. The default value depends on the source of the route. The preference is a value from 0 through 255, with a lower value indicating a more preferred route. Table 5 lists the default preference values.


Table 5: Default Route Preference Values
How Route Is Learned
Default Preference
Statement to Modify Default Preference

Directly connected network

0

System routes

4

Static

5

static

MPLS

7

MPLS preference in the JUNOS MPLS Applications Configuration Guide

LDF

8

LDF preference in the JUNOS MPLS Applications Configuration Guide

LDP

9

LDP preference in the JUNOS MPLS Applications Configuration Guide

OSPF internal route

10

OSPF export

IS-IS Level 1 internal route

15

IS-IS external-preference, preference

IS-IS Level 2 internal route

18

IS-IS external-preference, preference

Default

20

Redirects

30

Kernel

40

SNMP

50

Router discovery

55

RIP

100

RIP preference

RIPng

100

RIPng preference

PIM

105

JUNOS Multicast Protocols Configuration Guide

DVMRP

110

JUNOS Multicast Protocols Configuration Guide

Routes to interfaces that are down

120

Aggregate

130

aggregate

OSPF AS external routes

150

OSPF external-preference, preference

IS-IS Level 1 external route

160

IS-IS external-preference, preference

IS-IS Level 2 external route

165

IS-IS external-preference, preference

BGP

170

BGP preference, export, import

MSDP

175

JUNOS Multicast Protocols Configuration Guide


In general, the narrower the scope of the statement, the higher precedence its preference value is given, but the smaller the set of routes it affects. To modify the default preference value for routes learned by routing protocols, you generally apply routing policy when configuring the individual routing protocols. You also can modify some preferences with other configuration statements, which are indicated in the table. For information about defining and applying routing policies, see the JUNOS Policy Framework Configuration Guide.


[Contents] [Prev] [Next] [Index] [Report an Error]