Last Updated: May 1, 2025
BGP Fundamentals
| Item | Description |
|---|---|
Autonomous System (AS) | Collection of IP prefixes under one routing policy |
AS Number (ASN) | Unique identifier: 16-bit (1-64511 public) or 32-bit (131072+) |
eBGP | External BGP — between different AS (peering with other organizations) |
iBGP | Internal BGP — within same AS (full mesh or route reflectors) |
Peering | Manual neighbor configuration (not auto-discovered like OSPF) |
TCP/179 | BGP uses TCP — reliable, handshake-based session |
Prefix advertisement | Announce which IP blocks you can reach via your AS |
BGP Path Attributes & Selection
1. LOCAL_PREFHighest wins — controls outbound traffic (local to AS)
2. AS_PATH lengthShortest path wins — prepend your AS to depreference
3. ORIGINIGP (i) < EGP (e) < Incomplete (?) — lower is better
4. MED (MULTI_EXIT_DISC)Lowest wins — tells neighbor which entry point to use
5. eBGP vs iBGPeBGP routes preferred over iBGP
6. IGP metric to NEXT_HOPShortest internal distance to next hop wins
7. Router IDLowest router ID wins (tiebreaker)
Common BGP Commands (Cisco/JunOS)
show ip bgp summaryCisco: BGP neighbor status, prefixes received
show ip bgpCisco: BGP routing table
show ip bgp neighbors 10.0.0.1 advertised-routesWhat you're sending to neighbor
show ip bgp neighbors 10.0.0.1 routesWhat neighbor is sending you
show route protocol bgpJunOS: BGP routes in routing table
show bgp summaryJunOS: BGP session summary
clear ip bgp 10.0.0.1 soft inSoft reset — re-process inbound routes without tearing down
BGP Best Practices
| Item | Description |
|---|---|
Prefix filtering | Filter announcements — accept only expected prefixes from peers |
Max-prefix limit | Protect against accidental full-table leaks (shut down peer) |
AS path filtering | Filter routes going through specific AS (regex-based) |
Bogon filtering | Block private/reserved prefixes (RFC 1918, 5735, bogon lists) |
Peer authentication | MD5/TCP-AO on BGP sessions — prevent hijacking |
Route reflectors | Scale iBGP without full mesh (every router peers with reflector) |
Pro Tip: BGP is the routing protocol of the internet — AS_PATH length is the primary path selection tiebreaker after LOCAL_PREF. BGP is a path-vector protocol, NOT link-state.