BGP Path Selection Process

The following attributes can be used to configure the BGP path selection process.

 

BGP Path Selection Process Attributes

Attribute

Description

Weight

Prefer routes learned from neighbors with the highest weight set. Only relevant to the local router.

Local Preference

Administratively prefer routes learned from a neighbor. Shared with the whole AS.

Network or Aggregate paths

Prefer paths that were locally originated from the network and aggregate-address commands.

AS_PATH

Prefer the path with the shortest AS_PATH.

Origin

Prefer the path with the lowest origin type (as advertised in UPDATE messages): IGP < EGP < Incomplete.

Multi Exit Discriminator (MED)

Provides path preference information to neighbors for paths into originating AS.

Recency

Prefer the most recently received path.

Router ID

Prefer the path from the router with the lower router ID.

Weight

The weight command assigns a weight value, per address-family, to all routes learned from a neighbor. The route with the highest weight gets preference when the same prefix is learned from more than one peer. The weight is relevant only to the local router.

The weights assigned using the set weight command override the weights assigned using this command.

When the weight is set for a peer-group, all members of the peer-group will have the same weight. The command can also be used to assign a different weight to a particular peer-group member.

The following example shows weight configuration:

router bgp 12345
: neighbor 12.34.5.237 remote-as 12345
: neighbor 12.34.5.237 weight 60
router bgp 12345
: neighbor group1 peer-group
: neighbor 12.34.5.237 peer-group group1
: neighbor 67.78.9.237 peer-group group1
: neighbor group1 weight 60
Local Preference

The Local Preference attribute is used to indicate the degree of preference for each external route in an appliance’s routing table. The Local Preference attribute is included in all update messages sent to devices in the same AS. Local Preference is not communicated to outside AS. The following figure shows a sample topology illustrating how Local Preference affects routes between neighboring ASs.

BGP Local Preference Topology

The following BGP configurations are entered on SNWL1 and SNWL2. The higher Local Preference on SNWL2 leads to SNWL2 being the preferred route advertised by AS 12345 (the SonicWall AS) to outside ASs.

 

BGP Local Preference Topology: BGP Configurations

SNWL1 Configuration

SNWL2 Configuration

Local Preference Used with Route Maps

Route Maps are similar to Access Control Lists. They consist of a series of Permit and/or Deny statements that determine how the appliance processes the routes. Route maps are applied to inbound traffic—not outbound traffic. The following diagram shows a sample topology that uses a route map to configure local preference.

BGP Local Preference topology with Route Maps

The following BGP configurations are entered on SNWL1 and SNWL2.

 

BGP Local Preference Topology with Route Maps: BGP Configurations

SNWL1 Configuration

SNWL2 Configuration

The Route Map configured on SNWL2 (rmap1) is configured to apply to inbound routes from neighbor 10.1.1.1. It has two permit conditions: