BGP · Topic 4 of 5
Load Balancing, Multihop and Advanced Options
JN0-650 study page on BGP multipath, per-packet load balancing, route reflectors, confederations, local-as, remove-private, loops and session options.
- 6 min
- Includes a diagram
multipathkeeps equal paths;multiple-asallows different neighboring ASs.- The forwarding table needs a
load-balance per-packetexport policy; it hashes per flow. multihopandlocal-addressare needed for EBGP between loopbacks.
What it is
BGP normally installs one active path per prefix. Load balancing uses more than one equal path at the same time. In Junos this takes two parts: BGP must keep several candidate paths (multipath), and the forwarding table must be allowed to spread flows over them.
The advanced options are the features that scale BGP or adapt it to real networks: route reflection, confederations, AS number tricks, and session protection.
How it works
BGP multipath
Multipath lets BGP use paths that tie through the attribute steps up to the IGP metric. The paths need the same local preference, AS path length, origin, MED and neighboring AS.
set protocols bgp group EXT multipath
set protocols bgp group EXT multipath multiple-as
Without multiple-as, paths must come from the same neighboring AS. With it, paths from different neighboring ASs may be used together. For IBGP, the paths must also have the same IGP metric to the next hop.
Multipath is a BGP statement about which paths are eligible. It does nothing visible in the forwarding plane until the forwarding table also balances.
Forwarding table load balancing
The routing table can hold multiple next hops, but by default the forwarding table uses only one. A policy applied to the forwarding table exports the load balancing behavior:
set policy-options policy-statement LB term 1 then load-balance per-packet
set routing-options forwarding-table export LB
The keyword per-packet is historical. On modern Junos hardware the hash is computed over the packet header fields, so packets of one flow stay on one path and different flows spread across paths. That keeps packets of a flow in order.
| Layer | What it does |
|---|---|
BGP multipath | Keeps several equal paths in the routing table |
| Forwarding table export policy | Installs all next hops in the forwarding table |
EBGP multihop and loopback peering
When two routers have more than one link between them, you peer between loopbacks so that the session survives one link failing. That needs static or IGP routes to each loopback, local-address, and multihop, because the TTL would otherwise be too low:
set protocols bgp group EXT type external
set protocols bgp group EXT peer-as 65002
set protocols bgp group EXT multihop ttl 2
set protocols bgp group EXT local-address 10.255.0.1
set protocols bgp group EXT neighbor 10.255.0.2
Combine this with multipath and the forwarding table policy and you balance traffic across both parallel links.
Route reflectors
A route reflector removes the IBGP full mesh. A client sends its routes to the RR and the RR reflects them. The clients do not need to peer with each other.
set protocols bgp group RR-CLIENTS type internal
set protocols bgp group RR-CLIENTS local-address 10.255.0.1
set protocols bgp group RR-CLIENTS cluster 10.255.0.1
set protocols bgp group RR-CLIENTS neighbor 10.255.0.2
set protocols bgp group RR-CLIENTS neighbor 10.255.0.3
The cluster statement is what turns the group into a client group. The reflection rules are:
| Route learned from | Reflected to |
|---|---|
| A client | All clients and all non-clients |
| A non-client | Clients only |
| An EBGP peer | All clients and non-clients |
To prevent loops the RR adds the ORIGINATOR_ID and its own cluster ID to the CLUSTER_LIST. A router drops a route that already contains its own ID in either attribute. Non-clients of an RR must still be fully meshed with each other.
Confederations
A confederation splits one AS into several sub-ASs. Between sub-ASs BGP behaves almost like EBGP, but the next hop, local preference and MED are kept, and the sub-AS numbers appear in the path as a confederation sequence that is hidden from outside peers.
set routing-options autonomous-system 65001
set routing-options confederation 65000 members [ 65001 65002 ]
Other options to recognize
| Option | Purpose |
|---|---|
local-as 65100 | Present a different AS number to a peer, used during AS migration |
remove-private | Remove private AS numbers from the AS path on advertisement |
as-override | Replace the peer's AS number in the path with the local AS |
loops 2 (under routing-options autonomous-system) | Allow the local AS to appear in a received path a given number of times |
authentication-key | MD5 authentication of the TCP session |
bfd-liveness-detection | Fast failure detection for the session |
graceful-restart | Keep forwarding while the control plane restarts |
damping | Penalize flapping routes |
passive or allow | Wait for peers to connect, or accept peers from a prefix range |
set protocols bgp group EXT authentication-key "<key>"
set protocols bgp group EXT bfd-liveness-detection minimum-interval 300
set protocols bgp group EXT remove-private
With as-override and loops, you loosen BGP's loop prevention on purpose. Use them only for a known design, such as a customer site that reuses the same AS number.
Common mistakes
Setting multipath and expecting balanced forwarding. The forwarding table policy is also needed.
Mixing different neighboring ASs without multiple-as. The paths are not eligible.
Forgetting the cluster statement on the RR. The router does not treat its peers as clients.
Assuming a client mesh is still required. Clients peer only with the RR.
Peering between loopbacks without a route to them. The session stays in Active.
What to remember for the exam
multipathkeeps equal paths;multiple-asallows different neighboring ASs.- The forwarding table needs a
load-balance per-packetexport policy; it hashes per flow. multihopandlocal-addressare needed for EBGP between loopbacks.- An RR reflects client routes to everyone, and non-client routes to clients only.
- Loop prevention in reflection uses ORIGINATOR_ID and CLUSTER_LIST.
- Confederation sub-ASs keep local preference and next hop between them.
local-as,remove-private,as-overrideandloopsadjust AS path handling.
Check yourself
What two things are needed to balance traffic over two equal BGP paths?
multipathin BGP, and a forwarding table export policy withload-balance per-packet.To whom does a route reflector send a route learned from a non-client?
To its clients only.
Which attributes stop a reflected route from looping?
ORIGINATOR_ID and CLUSTER_LIST.
Topic 4 of 5 in BGP
Test yourself on BGP
The full Juniper JNCIP-ENT JN0-650 question bank has 858 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.