balance

Use balance to enable load balancing and set the maximum number of BGP ECMP routes for load balancing.

Use undo balance to disable load balancing.

Syntax

balance [ ebgp | eibgp | ibgp ] number

undo balance [ ebgp | eibgp | ibgp ]

Default

Load balancing is disabled.

Views

BGP IPv4 unicast address family view

BGP-VPN IPv4 unicast address family view

BGP IPv6 unicast address family view

BGP-VPN IPv6 unicast address family view

BGP IPv4 multicast address family view

BGP IPv6 multicast address family view

Predefined user roles

network-admin

Parameters

ebgp: Enables load balancing over EBGP routes.

eibgp: Enables load balancing between EBGP and IBGP routes.

ibgp: Enables load balancing over IBGP routes.

number: Specifies the maximum number of BGP ECMP routes for load balancing. When it is set to 1, load balancing is disabled.

Usage guidelines

Unlike IGP, BGP has no explicit metric for making load balancing decision. Instead, it implements load balancing by modifying route selection rules.

The device selects the specified number of routes for load balancing if multiple BGP routes destined for a network have the same ORIGIN, LOCAL_PREF, and MED attributes. If the balance as-path-neglect command is not configured, the routes must also have the same AS_PATH attribute.

The value range for the number argument depends on the max-ecmp-num command. If you set the maximum number of ECMP routes to m by using the max-ecmp-num command and reboot the device, the value range for the number argument is 1 to m.

If you do not specify the ibgp, eibgp, or ebgp keyword, this command enables load balancing over EBGP routes and IBGP routes, but not between EBGP and IBGP routes.

After you execute the balance eibgp number command, the balance [ ebgp | ibgp ] number and undo balance [ ebgp | ibgp ] commands cannot be executed; and vice versa.

Examples

# In BGP IPv4 unicast address family view, enable load balancing and set the maximum number of BGP ECMP routes used for load balancing to 2.

<Sysname> system-view
[Sysname] bgp 100
[Sysname-bgp-default] address-family ipv4 unicast
[Sysname-bgp-default-ipv4] balance 2

Related commands

balance as-path-neglect

max-ecmp-num