BGP Basics
Last updated:
BGP is deliberately boring transport with rich policy on top: sessions run over TCP port 179, neighbors are configured explicitly (no discovery), and routes carry attributes that policy manipulates.
eBGP vs iBGP
| Aspect | eBGP | iBGP |
|---|---|---|
| Peers | Different AS | Same AS |
| Typical TTL | 1 (directly connected) | Multihop via loopbacks |
| AD (Cisco) | 20 | 200 |
| Loop prevention | AS_PATH check | Split horizon: no iBGP→iBGP relay |
The iBGP relay rule ("routes learned from an iBGP peer aren't advertised to other iBGP peers") is why real deployments need a full mesh, route reflectors, or confederations.
Attributes that decide the best path (short version)
Highest weight (Cisco-local) → highest local preference → locally originated → shortest AS_PATH → lowest origin → lowest MED → eBGP over iBGP → nearest IGP next-hop → oldest/lowest RID.
Most real-world traffic engineering is just two moves: local preference for outbound choice, AS_PATH prepending (or MED) for inbound influence.
Remember what BGP is for
If you control both ends and just need reachability, an IGP is simpler. BGP earns its complexity when administrative boundaries and policy enter the picture — multihoming, ISPs, or large-scale segmentation.