When multiple routes are available to the same destination, BGP selects one optimal route based on BGP route selection rules and adds it to the IP routing table for traffic forwarding.
BGP selects routes by comparing route attributes in a fixed order. When a route attribute is a sufficient condition for determining the optimal route, BGP does not compare the other attributes; If BGP fails to select the optimal route after comparing all route attributes, the route that was first received is selected as the optimal route. Table 1 lists the abbreviated alias, route selection rules, and remarks of each matching item. Table 1 shows that the route priority is directly proportional to the PrefVal or Local_Pref value and inversely proportional to the rest of the attribute values or lengths. In addition, the first column can be summarized as a character string (OPPAAA OMTCC RA), which helps memorize the matching sequence.
Abbreviated Alias |
Matching Item |
Route Selection Rules |
Remarks |
---|---|---|---|
O |
Origin AS |
Valid > NotFound > Invalid |
BGP origin AS validation states are applied to route selection in a scenario where the device is connected to an RPKI server. |
P |
PrefVal |
The route with the largest PrefVal value is preferred. The default value is 0. |
PrefVal is Huawei-specific and valid only on the device where it is configured. |
P |
Local_Pref |
The route with the largest Local_Pref value is preferred. The default value is 100. |
To modify the default Local_Pref value of BGP routes, run the default local-preference command. |
A NOTE:
A is the initial of the character string (ASNIL). |
Route generation mode |
A > S > N > I > L, where:
|
- |
A |
Accumulated Interior Gateway Protocol (AIGP) |
The route with the smallest AIGP value is preferred. The route with AIGP to the route without AIGP is preferred. |
- |
A |
AS_Path |
The route with the shortest AS_Path length is preferred. |
If the bestroute as-path-ignore command is run, BGP does not compare the AS_Path lengths in different routes during route selection. |
O |
Origin |
IGP > EGP > Incomplete |
- |
M |
Multi Exit Discriminator (MED) |
The route with the smallest MED value is preferred. The default value is 0. |
If the bestroute med-none-as-maximum command is configured, BGP considers the largest MED value (4294967295) as the MED of the route that does not carry an MED. For details about MED usage, see MED. |
T |
Peer type |
EBGP > IBGP |
- |
C |
IGP metric |
The route with the smallest IGP cost is preferred. |
If the bestroute igp-metric-ignore command is configured, BGP does not compare the IGP cost. |
C |
Cluster_List |
The route with the shortest Cluster_List length is preferred. |
By default, Cluster_List takes precedence over Originator_ID during BGP route selection. To enable Originator_ID to take precedence over Cluster_List during BGP route selection, run the bestroute routerid-prior-clusterlist command. |
R |
Router ID |
The route with the smallest router ID is preferred. |
If routes carry the Originator_ID, the originator ID is substituted for the router ID during route selection. The route with the smallest Originator_ID is preferred. |
A |
Peer IP address |
The route learned from the peer with the smallest IP address is preferred. |
- |
After BGP load balancing is configured, the BGP routes that meet the following conditions are used as equal-cost routes for load balancing:
The routes have the same origin type (IGP, EGP, or incomplete).
All the routes are EBGP or IBGP routes. After the maximum load-balancing eibgp command is run, BGP ignores this limitation when selecting the optimal VPN route.
The metric values of the IGP routes to which BGP routes within an AS recurse are the same. After the load-balancing igp-metric-ignore command is run, the device does not compare IGP metric values when selecting routes for load balancing.
In addition, BGP labeled routes and non-labeled routes cannot load-balance traffic even if they meet the preceding conditions. Load balancing cannot be implemented between blackhole routes and non-blackhole routes.
On the NetEngine 8000 F, the rules for selecting VPN BGP routes are the same as those for selecting public network BGP routes. The only difference is that VPN BGP routes need to be leaked based on VPN targets. For details about route leaking, see "BGP VPN Route Leaking" in NetEngine 8000 F Feature Description > IP Routing > BGP.