BGP Fundamentals
·1 min
What is BGP? #
Border Gateway Protocol (BGP) is the routing protocol of the internet. It is a path-vector protocol used to exchange routing information between autonomous systems (AS).
eBGP vs iBGP #
| eBGP | iBGP | |
|---|---|---|
| Scope | Between different ASes | Within the same AS |
| TTL | 1 (directly connected) | 255 |
| Next-hop | Changes at each hop | Unchanged by default |
| AD | 20 | 200 |
BGP Path Selection Order #
BGP selects the best path using the following attributes in order:
- Highest Weight (Cisco proprietary, local to router)
- Highest Local Preference (within AS)
- Locally originated route
- Shortest AS Path
- Lowest Origin (IGP < EGP < Incomplete)
- Lowest MED
- eBGP over iBGP
- Lowest IGP metric to next-hop
- Lowest Router ID
Key BGP States #
Idle → Connect → Active → OpenSent → OpenConfirm → Established
The session is only exchanging routes in the Established state.
Common Use Cases #
- ISP peering and transit
- MPLS L3VPN (MP-BGP with VPNv4)
- SD-WAN control plane
- AWS Direct Connect / Azure ExpressRoute