< Home

Configuring BGP Load Balancing

Configuring BGP load balancing better utilizes network resources and reduces network congestion.

Context

On large networks, there may be multiple valid routes to the same destination. BGP, however, advertises only the optimal route to its peers. This may result in unbalanced traffic on different routes.

The following two methods can be used to address the problem of unbalanced traffic:
  • Use BGP routing policies to allow traffic to be balanced. For example, use a routing policy to modify the Local_Pref, AS_Path, Origin, and Multi_Exit Discriminator (MED) attributes of BGP routes to direct traffic to different forwarding paths for load balancing.

  • Use multiple paths for load balancing. In this method, multiple equal-cost routes need to be configured for traffic load balancing.

    Equal-cost BGP routes can be generated for traffic load balancing only when the first 9 route attributes described in "Principles of Route Selection" are the same, and the AS_Path attributes are also the same.

Procedure

  • Set the number of BGP routes to be used for load balancing.
    1. Access the system view.

      system-view

    2. Access the BGP view.

      bgp { as-number-plain | as-number-dot }

    3. Access the IPv4 unicast address family view.

      ipv4-family unicast

    4. Set the number of BGP routes to be used for load balancing.

      maximum load-balancing [ ebgp | ibgp ] number [ ecmp-nexthop-changed ]

      By default, the number of BGP routes to be used for load balancing is 1, meaning that load balancing is not implemented.

      • 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 participate in load balancing, and the number of EBGP routes to be used for load balancing is the same as the number of IBGP routes to be used for load balancing.

      If you run the maximum load-balancing number command, the device changes the next hop addresses of the routes to be advertised to a local address no matter whether the routes are used for load balancing.

      If you run the maximum load-balancing [ ebgp | ibgp ] number command, the device does not change the next hop addresses of the routes to be advertised to a local address no matter whether the routes are used for load balancing.

      If you run the maximum load-balancing [ ebgp | ibgp ] number ecmp-nexthop-changed command, the device changes the next hop addresses of the routes to be advertised to a local address only when the routes are used for load balancing.

      The maximum load-balancing number command cannot be configured together with the maximum load-balancing ebgp number or maximum load-balancing ibgp number command.

      When routes with the same destination addresses carry out load balancing on the public network, the system determines the type of optimal routes first. If the optimal routes are IBGP routes, only IBGP routes carry out load balancing. If the optimal routes are EBGP routes, only EBGP routes carry out load balancing. This means that load balancing cannot be implemented among IBGP and EBGP routes with the same destination address.

    5. (Optional) Configure the FW not to compare the AS_Path attributes of the routes to be used for load balancing.

      load-balancing as-path-ignore

      By default, the FW compares the AS_Path attributes of the routes to be used for load balancing.

      • If there are multiple routes to the same destination but these routes pass through different ASs, load balancing cannot be implemented among these routes by default. To implement load balancing among these routes, run the load-balancing as-path-ignore command. After the load-balancing as-path-ignore command is run, the device no longer compares the AS_Path attributes of the routes to be used for load balancing. Therefore, exercise caution when using this command.

      • The load-balancing as-path-ignore and bestroute as-path-ignore commands are mutually exclusive.

    6. (Optional) Ignore the IGP metric values of BGP labeled routes.

      bestroute as-path-ignore

      By default, BGP labeled routes with the same destination but different next-hop metric values cannot balance traffic. To enable these routes to balance traffic, run the bestroute as-path-ignore command. After this command is run, routes can be selected to balance traffic, regardless of their IGP metric values. Exercise caution when using this command.

  • Set the maximum number of EBGP and IBGP routes to be used for load balancing.

    This configuration is used in a VPN where a CE is dual-homed to two PEs. When the CE and one PE belong to an AS and the CE and the other PE belong to a different AS, you can set the number of EBGP and IBGP routes to be used for load balancing. This allows VPN traffic to be balanced among EBGP and IBGP routes.

    1. Access the system view.

      system-view

    2. Access the BGP view.

      bgp { as-number-plain | as-number-dot }

    3. Access the BGP-VPN instance view.

      ipv4-family vpn-instance vpn-instance-name

    4. Set the maximum number of EBGP and IBGP routes for load balancing.

      maximum load-balancing [ ebgp | ibgp ] number [ ecmp-nexthop-changed ]

      By default, the maximum number of EBGP and IBGP routes to be used for load balancing is not set.

      If you run the maximum load-balancing eibgp number command, the device changes the next hop addresses of the routes to be advertised to a local address no matter whether the routes are used for load balancing.

      If you run the maximum load-balancing eibgp number ecmp-nexthop-changed command, the device changes the next hop addresses of the routes to be advertised to a local address only when the routes are used for load balancing.

    5. (Optional) Configure the FW not to compare the AS_Path attributes of the routes to be used for load balancing.

      load-balancing as-path-ignore

      By default, the FW compares the AS_Path attributes of the routes to be used for load balancing.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic