BGP (Border Gateway Protocol) is a path-vector routing protocol designed to exchange routing information between different autonomous systems (AS) in large networks, such as the Internet. It is considered the backbone of the Internet due to its scalability and robustness.
Extension:
BGP uses attributes to determine the best path when multiple paths to a destination exist. These attributes are critical to understanding BGP operations:
AS_PATH:
NEXT_HOP:
MED (Multi-Exit Discriminator):
Local Preference:
Community:
Why Attributes Are Important:
BGP doesn’t use metrics like bandwidth or latency. Instead, attributes define routing policies and ensure proper control over traffic.
BGP routers form peer relationships (sessions) to exchange routes. These peers can belong to the same or different ASes:
eBGP (External BGP):
iBGP (Internal BGP):
Why MP-BGP Matters:
It is essential in environments that require support for multiple address families or technologies like MPLS.
BGP includes mechanisms to handle network failures gracefully:
Scalability:
Policy Control:
Multiprotocol Support:
Redundancy and Load Balancing:
Internet Routing:
Service Provider Networks:
Data Centers:
Here’s how to configure basic BGP on a Juniper router:
set protocols bgp group external type external
set protocols bgp group external neighbor 192.0.2.1 peer-as 65001
set protocols bgp group internal type internal
set protocols bgp group internal neighbor 10.0.0.1 local-as 65000
set protocols bgp group internal cluster 192.0.2.254
set protocols bgp group internal neighbor 10.0.0.1 route-reflector-client
set policy-options policy-statement set-local-pref term 1 from community no-export
set policy-options policy-statement set-local-pref term 1 then local-preference 200
set protocols bgp export set-local-pref
Understand BGP Path Selection:
Practice Configurations:
Monitor and Troubleshoot:
show bgp neighbor and show bgp summary for troubleshooting.Apply Policies Gradually:
BGP is a powerful and versatile protocol that forms the backbone of global Internet routing. It offers advanced features for scalability, traffic control, and support for emerging technologies like MPLS and IPv6. As you learn BGP:
BGP uses a well-defined sequence to select the “best” route when multiple paths exist for the same prefix. This selection order is deterministic and plays a central role in JNCIP-SP exam questions.
Highest Local Preference (used within an AS to influence outbound traffic)
Shortest AS_PATH (fewer AS hops preferred)
Lowest Origin Type (IGP < EGP < Incomplete)
Lowest MED (Multi-Exit Discriminator) (used between neighboring ASes to influence inbound traffic)
eBGP over iBGP (eBGP paths preferred over iBGP)
Lowest IGP cost to NEXT_HOP (internal path metric to reach NEXT_HOP IP)
Oldest Path (used for stability; older path preferred)
Lowest BGP Router ID (as a tie-breaker)
Lowest Neighbor IP address (final tie-breaker if router IDs match)
Tip: Junos does not allow full customization of the decision process order — but route policies can influence earlier steps (e.g., setting local-pref or MED).
BGP uses different loop prevention mechanisms based on eBGP vs iBGP:
AS_PATH loop detection:
If a router sees its own AS in the AS_PATH, it discards the route.
Simple and effective for external routing loops.
AS_PATH is not changed when routes are passed between iBGP peers.
Therefore, iBGP cannot use AS_PATH to detect loops.
Result: BGP enforces the Split Horizon rule for iBGP:
iBGP-learned routes are not advertised to other iBGP peers.
This prevents potential routing loops within an AS but also creates a need for:
Full-mesh iBGP (not scalable in large networks)
Route Reflectors (RRs) or Confederations to reduce peering complexity
This is a direct consequence of iBGP’s loop prevention approach.
Rule: A route learned via iBGP must not be advertised to another iBGP peer.
Reason: Because iBGP does not modify the AS_PATH, re-advertising could cause undetectable loops.
Route Reflector (RR):
Centralizes route reflection.
Allows iBGP-learned routes to be reflected to clients.
Confederation:
Breaks AS into smaller sub-ASes.
Routes between sub-ASes behave like eBGP (with AS_PATH modification).
Junos RR config:
set protocols bgp group IBGP cluster 192.0.2.1
set protocols bgp group IBGP neighbor 192.0.2.2 route-reflector-client
Used to simplify configuration when multiple peers share common settings (e.g., type, authentication).
Reduces BGP process overhead for update generation.
set protocols bgp group IBGP type internal
set protocols bgp group IBGP local-address lo0.0
Recommended in multi-link or redundant topologies:
Both peers must set the loopback address as their update-source.
set protocols bgp group EBGP update-source lo0.0
set protocols bgp group EBGP ttl 2
set protocols bgp group EBGP authentication-key "secret"
Confederation is a less common, but standards-based alternative to Route Reflectors.
Breaks a large AS into multiple sub-ASes.
To external peers, the network still appears as a single AS.
Between sub-ASes, BGP behaves like eBGP:
AS_PATH is modified.
Routes are allowed to propagate (no iBGP split-horizon rule).
Scales better than full mesh iBGP.
Allows hierarchical policy control.
More granular path manipulation.
set routing-options autonomous-system 65000
set routing-options confederation identifier 65000
set routing-options confederation members 65010
Use case: Large service provider backbone with hundreds of routers, where multiple regional teams manage different sub-ASes.
| Topic | Key Insight |
|---|---|
| BGP Path Selection Order | Highest Local Pref → AS_PATH → Origin → MED → etc. |
| Loop Prevention (eBGP/iBGP) | eBGP: AS_PATH; iBGP: Split-horizon enforcement |
| iBGP Split-Horizon Rule | Prevents iBGP re-advertisement; requires RR/Confed |
| Peer Group + Loopback Src | Reduces config and keeps peering stable |
| Confederation | Logical AS splitting for iBGP scalability |
Why are route reflectors used in large IBGP networks?
Route reflectors remove the requirement for a full IBGP mesh.
In a traditional IBGP design, every router must peer with every other router, which results in a quadratic growth of sessions. As networks scale to dozens or hundreds of routers, maintaining this full mesh becomes operationally complex. Route reflectors allow certain routers to redistribute IBGP routes to clients, significantly reducing the number of required BGP sessions. Additional attributes such as cluster ID and originator ID are inserted to prevent routing loops. While route reflectors improve scalability, poor placement can introduce suboptimal routing paths.
Demand Score: 90
Exam Relevance Score: 95
What does next-hop self solve in IBGP networks?
It ensures internal routers can reach the BGP next hop.
When a router learns routes from an EBGP neighbor and advertises them via IBGP, the next-hop attribute normally remains unchanged. Internal routers may not have a route to that external next-hop address, causing forwarding failures. The next-hop self configuration forces the router advertising the route to replace the next-hop attribute with its own address. This ensures reachability through the IGP and is commonly configured on AS border routers.
Demand Score: 84
Exam Relevance Score: 90
Which BGP attribute is commonly used to control outbound traffic from an AS?
Local Preference
Local Preference is an attribute used inside an AS to indicate which exit path should be preferred. Higher values are preferred in the BGP decision process. Because it propagates to all IBGP peers, it allows centralized traffic engineering decisions. Service providers commonly adjust local preference on routes learned from different upstream providers to prefer one link over another.
Demand Score: 88
Exam Relevance Score: 94
Why might a BGP route with a shorter AS-Path still not be selected as the best path?
Because attributes evaluated earlier in the BGP decision process may override AS-Path length.
The BGP best path algorithm evaluates multiple attributes in a defined order. Attributes such as local preference, origin, and MED may be considered before AS-Path length depending on vendor implementation and configuration. If a route has a higher local preference, it will be chosen even if its AS-Path is longer. This frequently confuses engineers troubleshooting route selection. Understanding the complete decision process is critical when designing traffic engineering policies in service provider environments.
Demand Score: 86
Exam Relevance Score: 93
What problem do BGP confederations solve?
They improve scalability by dividing a large AS into smaller sub-autonomous systems.
In extremely large networks, maintaining a full IBGP mesh becomes impractical. Confederations break a single AS into multiple internal sub-AS numbers. These sub-ASes communicate with each other using EBGP-like sessions while appearing as a single AS to external networks. This reduces the number of IBGP sessions required and simplifies large-scale network design. However, route reflectors are often preferred today because confederations add operational complexity.
Demand Score: 81
Exam Relevance Score: 89
Why might an IBGP-learned route not be advertised to another IBGP peer?
Because of the IBGP split-horizon rule.
The IBGP split-horizon rule states that routes learned from one IBGP peer cannot be advertised to another IBGP peer. This rule prevents routing loops within the AS. However, it also creates a requirement for either a full IBGP mesh or mechanisms like route reflectors or confederations to distribute routes efficiently. In service provider networks, route reflectors are the most common solution because they reduce session count while still ensuring route propagation across the AS.
Demand Score: 83
Exam Relevance Score: 92