Configuring BGP4+ load balancing better utilizes network resources.
On large networks, there may be multiple valid routes to the same destination. BGP4+, however, advertises only the optimal route to its peers. This may result in traffic imbalance.
Either of the following methods can be used to resolve the traffic imbalance:
Use BGP4+ route-policies for load balancing. For example, you can use a route-policy to modify the Local_Pref, AS_Path, Origin, or MED attribute of BGP4+ routes to control traffic forwarding paths, helping implement load balancing.
Use multiple paths to implement traffic load balancing. This method requires that multiple equal-cost routes exist and the number of routes allowed to participate in load balancing be set. Load balancing can be implemented globally or for a specified peer or peer group.
Run system-view
The system view is displayed.
Run bgp as-number
The BGP view is displayed.
The IPv6 unicast address family view is displayed.
Run peer { ipv4-address | ipv6–address | group-name } load-balancing [ as-path-ignore | as-path-relax ]
BGP4+ peer or peer group-based load balancing is configured.
(Optional) Change load balancing rules.
The address family views supported by the preceding commands are different. When running any of the commands, ensure that the command is run in the correct address family view.
Change load balancing rules based on network requirements and exercise caution when running the commands.
Run commit
The configuration is committed.
Run system-view
The system view is displayed.
Run bgp as-number
The BGP view is displayed.
Run ipv6-family unicast
The IPv6 unicast address family view is displayed.
Run maximum load-balancing [ ebgp | ibgp ] number [ ecmp-nexthop-changed ]
The maximum number of BGP4+ equal-cost routes for load balancing is set.
ebgp indicates that load balancing is implemented only among EBGP routes.
ibgp indicates that load balancing is implemented only among IBGP routes.
If neither ebgp nor ibgp is specified, both EBGP and IBGP routes can balance traffic, and the number of EBGP routes for load balancing is the same as the number of IBGP routes for load balancing.
If multiple routes with the same destination address exist on the public network, the system selects the optimal route first. If IBGP routes are optimal, only IBGP routes carry out load balancing. If EBGP routes are optimal, only EBGP routes carry out load balancing. This means that load balancing cannot be implemented using both IBGP and EBGP routes with the same destination address.
(Optional) Change load balancing rules.
The address family views supported by the preceding commands are different. When running any of the commands, ensure that the command is run in the correct address family view.
Change load balancing rules based on network requirements and exercise caution when running the commands.
Run commit
The configuration is committed.
Set the maximum number of EBGP and IBGP routes for load balancing.
This configuration is used in a VPN where a CE is dual-homed to two PEs. When the CE resides in the same AS as only one of the PEs, you can set the maximum number of EBGP and IBGP routes for load balancing so that VPN traffic can be balanced among EBGP and IBGP routes.
Run system-view
The system view is displayed.
Run bgp as-number
The BGP view is displayed.
Run ipv6-family vpn-instance vpn-instance-name
The BGP-VPN instance IPv6 address family view is displayed.
Run maximum load-balancing eibgp number [ ecmp-nexthop-changed ]
The maximum number of EBGP and IBGP routes for load balancing is set.
After the maximum load-balancing eibgp number command is run on a device, the device, by default, changes the next hop of each BGP4+ route to itself before advertising the route to a peer, regardless of whether the route is to be used for load balancing. However, in RR or BGP confederation scenarios, the device does not change the next hop addresses of non-local routes to be advertised to a local address. As a result, besides the routes for load-balancing, those routes that are not supposed to participate in load balancing divert traffic to the device, which overburdens the device. To address this problem, you can set ecmp-nexthop-changed so that the device changes the next hop of only the BGP4+ routes that are to be used for load balancing to itself before advertising them to peers.
(Optional) Change load balancing rules.
The address family views supported by the preceding commands are different. When running any of the commands, ensure that the command is run in the correct address family view.
Change load balancing rules based on network requirements and exercise caution when running the commands.
Run commit
The configuration is committed.
When BGP4+ routes carrying the Link Bandwidth attribute are available for load balancing and they all recurse to IP routes or tunnels, you can run the load-balancing ucmp command in the BGP-IPv6 unicast address family view to implement unequal-cost load balancing among BGP4+ routes based on the Link Bandwidth attribute. With this function, when there are multiple egress devices to the destination, unequal-cost load balancing can be implemented based on the actual bandwidth capability of each egress device. The methods of configuring the link bandwidth extended community attribute are as follows:
After the configuration is complete, verify the configuration.
Run the display bgp ipv6 routing-table ipv6-address prefix-length command to check routes in the BGP4+ routing table.