BGP load balancing
BGP load balancing is applicable between EBGP peers, between IBGP peers, and between confederations.
BGP implements load balancing through route recursion and route selection.
BGP load balancing through route recursion
The next hop of a BGP route might not be directly connected. One of the reasons is that the next hop information exchanged between IBGP peers is not modified. The BGP router must find the directly connected next hop through IGP. The matching route with the direct next hop is called the recursive route. The process of finding a recursive route is route recursion.
If multiple recursive routes to the same destination are load balanced, BGP generates the same number of next hops to forward packets.
BGP load balancing based on route recursion is always enabled in the system.
BGP load balancing through route selection
IGP routing protocols, such as RIP and OSPF, can use route metrics as criteria to load balance between routes that have the same metric. BGP cannot load balance between routes by route metrics as an IGP protocol does, because BGP does not have a route computation algorithm.
BGP uses the following load balancing criteria to determine load balanced routes:
The routes have the same ORIGIN, LOCAL_PREF, and MED attributes.
The routes meet the following requirements on the AS_PATH attribute:
If both the balance as-path-neglect and balance as-path-relax commands are configured or only the balance as-path-neglect command is configured, the routes can have different AS_PATH attributes.
If only the balance as-path-relax command is configured, the routes can have different AS_PATH attributes, but the length of the AS_PATH attributes must be the same.
If neither the balance as-path-neglect nor the balance as-path-relax command is configured, the routes must have the same AS_PATH attribute.
BGP does not use the route selection rules described in "BGP route selection" for load balancing.
As shown in Figure 54, Router A and Router B are IBGP peers of Router C. Router C allows a maximum number of two ECMP routes for load balancing.
Router D and Router E both advertise a route 9.0.0.0 to Router C. Router C installs the two routes to its routing table for load balancing if the routes meet the BGP load balancing criteria. After that, Router C forwards to Router A and Router B a single route whose attributes are changed as follows:
AS_PATH attribute:
If the balance as-path-neglect and balance as-path-relax commands are not configured, the AS_PATH attribute does not change.
If the balance as-path-neglect or balance as-path-relax command is configured, the AS_PATH attribute is changed to the attribute of the optimal route.
The NEXT_HOP attribute is changed to the IP address of Router C.
Other attributes are changed to be the same as the optimal route.
Figure 54: Network diagram