Learning Objectives
- Understand BGP's role as the internet's routing protocol
- Distinguish between eBGP and iBGP
- Visualize the BGP session establishment process
- Identify the information carried in BGP updates
What is BGP?
BGP (Border Gateway Protocol) is the path-vector protocol that routes traffic between Autonomous Systems on the internet. It is the only EGP in use today. Every ISP, every cloud provider, and every content delivery network runs BGP to exchange reachability information with its peers.
Unlike IGPs that optimize for the shortest path, BGP provides policy-based routing. Network operators can decide exactly which routes to accept, which to advertise, and which paths to prefer based on business relationships, traffic engineering goals, and security requirements.
eBGP vs iBGP
| Feature | eBGP (External BGP) | iBGP (Internal BGP) | |---------|--------------------|--------------------| | Scope | Between different ASes | Within the same AS | | Default AD | 20 | 200 | | TTL | 1 (must be adjacent) | 255 (can be multi-hop) | | Next-hop | Changes to eBGP peer | Preserved from eBGP | | Route propagation | Advertises to all peers | Advertises only to iBGP peers (no re-advertisement to other iBGP) |
A key iBGP rule: routes learned from an iBGP peer are not advertised to other iBGP peers. This means iBGP requires either a full mesh or a route reflector to propagate routes within the AS.
BGP Session Establishment
BGP uses TCP port 179 for reliable transport. The session goes through: Idle → Connect → OpenSent → OpenConfirm → Established. Once Established, UPDATE messages carry the actual routing information.
BGP UPDATE Message
An UPDATE contains:
- Withdrawn Routes — prefixes being withdrawn
- Path Attributes — metadata about the route (AS_PATH, NEXT_HOP, LOCAL_PREF, MED, etc.)
- NLRI (Network Layer Reachability Information) — the prefix being advertised
The most important attribute is AS_PATH, which lists all AS numbers the route has traversed. BGP uses AS_PATH length as one factor in best-path selection — shorter paths are generally preferred.
eBGP and iBGP Topology
R1 peers with R2 via eBGP (different ASes). R2 runs iBGP with R4 within the same AS. eBGP peers are typically directly connected; iBGP peers can be multi-hop.
Why does BGP use TCP as its transport protocol?
What attribute does BGP primarily use to prevent routing loops?
Key Takeaways
- BGP is the path-vector protocol that routes traffic between ASes on the internet
- eBGP runs between ASes (TTL 1); iBGP runs within an AS (full mesh or route reflectors)
- BGP sessions establish over TCP port 179 through 6 states
- UPDATE messages carry NLRI, path attributes, and withdrawn routes
- AS_PATH is the primary loop-prevention mechanism