Related Documentation
- ACX Series
- Understanding BGP Multipath
- M Series
- Understanding BGP Multipath
- MX Series
- Understanding BGP Multipath
- QFX Series
- Understanding BGP Multipath
- T Series
- Understanding BGP Multipath
Example: Load Balancing BGP Traffic with Unequal Bandwidth Allocated to the Paths
This example shows how to configure BGP to select multiple unequal-cost paths as active paths.
BGP communities can help you control routing policy. An example of a good use for BGP communities is unequal load balancing. When an autonomous system border router (ASBR) receives routes from directly connected external BGP (EBGP) neighbors, the ASBR then advertises those routes to internal neighbors, using IBGP advertisements. In the IBGP adverisements, you can attach the link-bandwidth community to communicate the bandwidth of the advertised external link. This is useful when multiple external links are available, and you want to do unequal load balancing over the links. You configure the link-bandwidth extended community on all ingress links of the AS. The bandwidth information in the link-bandwidth extended community is based on the configured bandwidth of the EBGP link. It is not based on the amount of traffic on the link. Junos OS supports BGP link-bandwidth and multipath load balancing, as described in Internet draft draft-ietf-idr-link-bandwidth-06, BGP Link Bandwidth Extended Community.
Requirements
Before you begin:
- Configure the device interfaces.
- Configure an interior gateway protocol (IGP).
- Configure BGP.
- Configure a routing policy that exports routes (such as direct routes or IGP routes) from the routing table into BGP.
Overview
In this example, Device R1 is in AS 65000 and is connected to both Device R2 and Device R3, which are in AS 65001.
The example uses the bandwidth extended community.
By default, when BGP multipath is used, traffic is distributed equally among the several paths calculated. The bandwidth extended community allows an additional attribute to be added to BGP paths, thus allowing the traffic to be distributed unequally. The primary application is a scenario where multiple external paths exist for a given network with asymmetric bandwidth capabilities. In such a scenario, you can tag routes received with the bandwidth extended community. When BGP multipath (internal or external) operates among routes that contain the bandwidth attribute, the forwarding engine can unequally distribute traffic according to the bandwidth corresponding to each path.
When BGP has several candidate paths available for multipath purposes, BGP does not perform unequal cost load balancing according to the bandwidth community unless all candidate paths have this attribute.
The applicability of the bandwidth extended community is limited by the restrictions under which BGP multipath accepts multiple paths for consideration. Explicitly, the IGP distance, as far as BGP is concerned, between the router performing load balancing and the multiple exit points needs to be the same. This can be achieved by using a full mesh of label-switched paths (LSPs) that do not track the corresponding IGP metric. However, in a network in which the propagation delay of circuits is significant (for example, if long-haul circuits are present), it is often valuable to take into account the delay characteristics of different paths.
Configure the bandwidth community as follows:
The first 16-bit number represents the local autonomous system. The second 32-bit number represents the link bandwidth in bytes per second.
For example:
Where 10458 is the local AS number. The values correspond to the bandwidth of the T1, T3, and OC-3 paths in bytes per second. The value specified as the bandwidth value does not need to correspond to the actual bandwidth of a specific interface. The balance factors used are calculated as a function of the total bandwidth specified. To tag a route with this extended community, define a policy statement, as follows:
Apply this as an import policy on the BGP peering sessions facing the asymmetrical bandwidth links. Although in theory the community attribute can be added or removed at any point in the network, in the scenario described above, applying the community as an import policy in the EBGP peering session facing the external link allows for that attribute to influence the local multipath decision, and is potentially easier to manage.
Topology
Figure 1 shows the topology used in this example.
Figure 1: BGP Load Balancing

CLI Quick Configuration shows the configuration for all of the devices in Figure 1. The sectionStep-by-Step Procedure describes the steps on Device R1.
Configuration
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.
Device R1
Device R2
Device R3
Step-by-Step Procedure
The following example requires that you navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure the BGP peer sessions:
- Configure the interfaces.user@R1# set ge-1/2/0 unit 0 description R1->R3user@R1# set ge-1/2/0 unit 0 family inet address 10.0.0.1/30
user@R1# set ge-1/2/1 unit 0 description R1->R2user@R1# set ge-1/2/1 unit 0 family inet address 10.0.1.2/30
user@R1# set lo0 unit 0 family inet address 192.168.0.1/32 - Configure the BGP group. [edit protocols bgp group external]user@R1# set type externaluser@R1# set import bw-disuser@R1# set peer-as 65001user@R1# set neighbor 10.0.1.1user@R1# set neighbor 10.0.0.2
- Enable the BGP group to use multiple paths.

Note: To disable the default check requiring that paths accepted by BGP multipath must have the same neighboring autonomous system (AS), include the multiple-as option. Use the multiple-as option if the neighbors are in different ASs.
[edit protocols bgp group external]user@R1# set multipath - Configure the load-balancing policy.[edit policy-options policy-statement loadbal]user@R1# set from route-filter 10.0.0.0/16 orlonger user@R1# set then load-balance per-packet
- Apply the load-balancing policy.[edit routing-options]user@R1# set forwarding-table export loadbal
- Configure the BGP community members.
This example assumes a bandwidth of 1 Gbps and allocates 60 percent to bw-high and 40 percent to bw-low. The reference bandwidth does not need to be the same as the link bandwidth.
[editpolicy-options]user@R1# set community bw-high members bandwidth:65000:60000000user@R1# set community bw-low members bandwidth:65000:40000000 - Configure the bandwidth distribution policy.[editpolicy-options bw-dis]user@R1# set term a from protocol bgpuser@R1# set term a from neighbor 10.0.1.1user@R1# set term a then community add bw-highuser@R1# set term a then accept
user@R1# set term b from protocol bgpuser@R1# set term b from neighbor 10.0.0.2user@R1# set term b then community add bw-lowuser@R1# set term b then accept - Configure the local autonomous system (AS) number.[edit routing-options]user@R1# set autonomous-system 65000
Results
From configuration mode, confirm your configuration by entering the show interfaces, show protocols, show policy-options, and show routing-options commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
If you are done configuring the device, enter commit from configuration mode.
Verification
Confirm that the configuration is working properly:
Verifying Routes
Purpose
Verify that both routes are selected and that the next hops on the routes show a 60%/40% balance.
Action
From operational mode, run the show route protocol bgp detail command.
user@R1> show route 172.16/16 protocol bgp detailinet.0: 9 destinations, 13 routes (9 active, 0 holddown, 0 hidden)
172.16.0.0/16 (2 entries, 1 announced)
*BGP Preference: 170/-101
Next hop type: Router, Next hop index: 262143
Address: 0x93fc078
Next-hop reference count: 3
Source: 10.0.0.2
Next hop: 10.0.0.2 via ge-1/2/0.0 balance 40%
Next hop: 10.0.1.1 via ge-1/2/1.0 balance 60%, selected
State: **Active Ext>
Local AS: 65000 Peer AS: 65001
Age: 3:22:55
Task: BGP_65001.10.0.0.2+55344
Announcement bits (1): 0-KRT
AS path: 65001 I
Communities: bandwidth:65000:40000000
Accepted Multipath
Localpref: 100
Router ID: 192.168.0.3
BGP Preference: 170/-101
Next hop type: Router, Next hop index: 658
Address: 0x9260520
Next-hop reference count: 4
Source: 10.0.1.1
Next hop: 10.0.1.1 via ge-1/2/1.0, selected
State: <NotBest Ext>
Inactive reason: Not Best in its group - Active preferred
Local AS: 65000 Peer AS: 65001
Age: 3:22:55
Task: BGP_65001.10.0.1.1+62586
AS path: 65001 I
Communities: bandwidth:65000:60000000
Accepted MultipathContrib
Localpref: 100
Router ID: 192.168.0.2user@R1> show route 10.0.2.0 protocol bgp detailinet.0: 9 destinations, 13 routes (9 active, 0 holddown, 0 hidden)
10.0.2.0/30 (2 entries, 1 announced)
*BGP Preference: 170/-101
Next hop type: Router, Next hop index: 262143
Address: 0x93fc078
Next-hop reference count: 3
Source: 10.0.1.1
Next hop: 10.0.0.2 via ge-1/2/0.0 balance 40%
Next hop: 10.0.1.1 via ge-1/2/1.0 balance 60%, selected
State: <Active Ext>
Local AS: 65000 Peer AS: 65001
Age: 3:36:37
Task: BGP_65001.10.0.1.1+62586
Announcement bits (1): 0-KRT
AS path: 65001 I
Communities: bandwidth:65000:60000000
Accepted Multipath
Localpref: 100
Router ID: 192.168.0.2
BGP Preference: 170/-101
Next hop type: Router, Next hop index: 657
Address: 0x92604d8
Next-hop reference count: 4
Source: 10.0.0.2
Next hop: 10.0.0.2 via ge-1/2/0.0, selected
State: <NotBest Ext>
Inactive reason: Not Best in its group - Active preferred
Local AS: 65000 Peer AS: 65001
Age: 3:36:36
Task: BGP_65001.10.0.0.2+55344
AS path: 65001 I
Communities: bandwidth:65000:40000000
Accepted MultipathContrib
Localpref: 100
Router ID: 192.168.0.3Meaning
The active path, denoted with an asterisk (*), has two next hops: 10.0.1.1 and 10.0.0.2 to the 172.16/16 destination.
Likewise, the active path, denoted with an asterisk (*), has two next hops: 10.0.1.1 and 10.0.0.2 to the 10.0.2.0 destination.
In both cases, the 10.0.1.1 next hop is copied from the inactive path to the active path.
The balance of 40 percent and 60 percent is shown in the show route output. This indicates that traffic is being distributed between two next hops and that 60 percent of the traffic is following the first path, while 40 percent is following the second path.
Related Documentation
- ACX Series
- Understanding BGP Multipath
- M Series
- Understanding BGP Multipath
- MX Series
- Understanding BGP Multipath
- QFX Series
- Understanding BGP Multipath
- T Series
- Understanding BGP Multipath