Border Gateway Protocol — the path-vector exterior gateway protocol (EGP) that routes between autonomous systems and powers the internet. Uses TCP port 179 for reliable peer communication.
Key Characteristics
Property
Value
Type
Path-Vector EGP
Transport
TCP port 179
Admin Distance (eBGP)
20
Admin Distance (iBGP)
200
Metric
Path attributes (not a single metric)
Authentication
MD5 (TCP option 19)
Multicast
None — unicast TCP sessions
Current Version
BGP-4 (RFC 4271)
Address Family Support
IPv4, IPv6, VPNv4, VPNv6, EVPN, and more via MP-BGP (RFC 4760)
eBGP vs iBGP
Property
eBGP
iBGP
Relationship
Peers in different AS numbers
Peers in the same AS number
Admin Distance
20
200
TTL
1 (default — requires direct connection or ebgp-multihop)
255
Next-Hop Behavior
Next-hop set to advertising router’s IP
Next-hop preserved (not changed) — must be reachable via IGP
AS_PATH Loop Prevention
Drops routes containing own ASN in AS_PATH
N/A (same AS — AS_PATH can’t detect loops)
iBGP Split-Horizon
N/A
Routes from one iBGP peer are NOT re-advertised to another iBGP peer
Full Mesh Requirement
No
Yes (or use Route Reflectors / Confederations)
LOCAL_PREF
Not carried across eBGP (set on receipt)
Carried between iBGP peers
MED
Sent to eBGP peer (optional)
Carried between iBGP peers
iBGP Split-Horizon Rule
The rule: A route learned from an iBGP peer is never advertised to another iBGP peer.
Why it exists: Within an AS, all routers share the same ASN, so AS_PATH cannot detect routing loops. Without this rule, iBGP routes could loop indefinitely between iBGP peers.
The consequence: Every iBGP speaker must receive every route directly from the originator — hence the full-mesh requirement.
Solutions to the Full-Mesh Problem
Solution
How It Works
Scalability
Trade-off
Full Mesh
Every iBGP router peers with every other
O(n^2) — breaks down past ~20 routers
Simple but doesn’t scale
Route Reflectors
Designated RR reflects routes to clients, bypassing split-horizon
Excellent — hierarchical RR clusters
Single point of failure if not redundant
Confederations
AS split into sub-ASes that use eBGP rules internally
Good for very large ASes
Complex to configure and troubleshoot
Route Reflectors in Detail
Concept
Description
Route Reflector (RR)
An iBGP peer that is allowed to re-advertise iBGP routes to other iBGP peers
RR Client
A peer configured under the RR — receives reflected routes
Non-Client
A peer not configured as a client — normal iBGP full-mesh rules apply between non-clients
Cluster ID
Identifies the RR cluster — used for loop prevention (if a route’s CLUSTER_LIST contains the local cluster-id, it is dropped)
ORIGINATOR_ID
Set by the RR to the Router ID of the route originator — prevents routes from being reflected back to the originator
Reflection rules:
Route from client → reflect to all clients and non-clients
Route from non-client → reflect to clients only
Route from eBGP → reflect to all clients and non-clients
BGP Message Types
Message
Purpose
Key Fields
When Sent
OPEN
Establish peering session
BGP version, local ASN, Hold Time, Router ID, capabilities (MP-BGP, 4-byte ASN, route refresh)
No route to peer, peer IP misconfigured, AS mismatch in config
Connect
TCP SYN sent, waiting for TCP connection to complete
Firewall blocking TCP 179, interface down
Active
TCP connection failed, retrying. Despite the name, this is a problem state.
ACL/firewall blocking TCP 179 in one or both directions, wrong source IP
OpenSent
TCP connected, OPEN message sent, waiting for peer’s OPEN
Peer configured with wrong ASN, capability mismatch
OpenConfirm
OPEN received, parameters validated, waiting for KEEPALIVE
Hold time mismatch, authentication failure
Established
Peering up — UPDATE messages are exchanged
N/A (this is the goal state)
Key insight: If a peer is bouncing between Idle and Active, the most common cause is TCP connectivity failure to port 179 — check firewalls, routing to the peer address, and that the source interface is correct.
Default Timers
Timer
Default Value
Purpose
Keepalive
60 seconds
Interval between KEEPALIVE messages
Hold Time
180 seconds (3x Keepalive)
If no KEEPALIVE or UPDATE received in this time, peer is declared dead
Connect Retry
120 seconds
Time to wait before retrying a failed TCP connection
Advertisement Interval (eBGP)
30 seconds
Minimum time between UPDATE messages to eBGP peers
Advertisement Interval (iBGP)
0 seconds (Cisco IOS)
Minimum time between UPDATE messages to iBGP peers
MRAI (Minimum Route Advertisement Interval)
30s eBGP / 5s iBGP
Rate-limits UPDATE frequency per prefix (implementation varies)
Hold Time negotiation: During OPEN exchange, both sides propose a Hold Time. The lower value is used. A Hold Time of 0 disables keepalives (not recommended).
Path Attributes
Attribute Categories
Category
Meaning
Must Support?
Must Forward?
Well-Known Mandatory
Every BGP speaker must recognize and include in every UPDATE
Yes
Yes
Well-Known Discretionary
Every BGP speaker must recognize, but may or may not include
Yes
Yes
Optional Transitive
May not be recognized, but must be forwarded to peers
No
Yes
Optional Non-Transitive
May not be recognized, and may be dropped
No
No
Attribute Reference
Attribute
Code
Category
Description
ORIGIN
1
Well-Known Mandatory
How the route was introduced: i (IGP), e (EGP), ? (incomplete/redistributed)
AS_PATH
2
Well-Known Mandatory
Ordered list of AS numbers the route has traversed. Used for loop prevention and path selection.
NEXT_HOP
3
Well-Known Mandatory
IP address of the next-hop to reach the prefix. eBGP sets this to self; iBGP preserves it.
LOCAL_PREF
5
Well-Known Discretionary
Preference value shared within an AS. Higher = preferred. Default: 100. Only in iBGP.
ATOMIC_AGGREGATE
6
Well-Known Discretionary
Indicates that the originator aggregated routes and some AS_PATH info was lost.
AGGREGATOR
7
Optional Transitive
Router ID and ASN of the router that performed route aggregation.
COMMUNITY
8
Optional Transitive
32-bit tag for grouping routes and applying policy. Format: ASN:Value.
MED
4
Optional Non-Transitive
Multi-Exit Discriminator — suggests preferred entry point into an AS. Lower = preferred. Compared only between routes from the same neighbor AS.
ORIGINATOR_ID
9
Optional Non-Transitive
Set by Route Reflector — Router ID of the iBGP route originator. Loop prevention.
CLUSTER_LIST
10
Optional Non-Transitive
List of Route Reflector Cluster IDs the route has passed through. Loop prevention.
WEIGHT
N/A
Cisco proprietary (local)
Local to the router — not advertised. Higher = preferred. Default: 0 (32768 for locally originated).
Best Path Selection Algorithm
BGP evaluates paths in this order — first match wins. All criteria are only compared if the previous criteria is a tie.
Step
Criteria
Preferred
Notes
0
Valid next-hop
Reachable
Route is discarded entirely if next-hop is unreachable
Fewer AS hops = preferred. Can be disabled with bgp bestpath as-path ignore.
5
Lowest ORIGIN type
IGP (i) < EGP (e) < Incomplete (?)
IGP is most preferred
6
Lowest MED
Lower
Only compared between routes from the same neighbor AS (by default)
7
eBGP over iBGP
eBGP
Prefer externally learned routes over internally learned
8
Lowest IGP metric to next-hop
Lower
Closest exit point (hot-potato routing)
9
Oldest eBGP route
Older
Stability — prefer the route that has been around longest
10
Lowest Router ID
Lower
Tiebreaker — peer with lowest RID wins
11
Lowest neighbor IP
Lower
Final tiebreaker if multiple paths from the same router
Practical takeaway: In most enterprise environments, you control path selection with LOCAL_PREF (inbound preference within your AS) and AS_PATH prepending or MED (outbound preference signaled to neighbors).
Communities
Communities are 32-bit tags attached to routes for applying policy at scale. Format: ASN:Value (e.g., 65000:100).
Well-Known Communities
Community
Value
Meaning
NO_EXPORT
65535:65281
Do not advertise beyond the local AS (or confederation sub-AS)
NO_ADVERTISE
65535:65282
Do not advertise to any peer at all
NO_EXPORT_SUBCONFED
65535:65283
Do not advertise outside the local confederation sub-AS
NOPEER
65535:65284
Do not advertise to bilateral eBGP peers (RFC 3765)
Standard vs Extended vs Large
Type
Size
Format
Use Case
Standard
32-bit
ASN:Value
General policy tagging
Extended
64-bit
Type:Admin:Value
VPNv4 Route Targets, Site of Origin
Large
96-bit
Global:Local1:Local2
4-byte ASN support (RFC 8092)
Address Families (MP-BGP)
Multiprotocol BGP (RFC 4760) extends BGP to carry routes for multiple protocols using Address Family Identifiers (AFI) and Subsequent AFI (SAFI).
AFI/SAFI
Description
Common Use
IPv4 Unicast
Standard IPv4 routing
Default BGP operation
IPv6 Unicast
IPv6 routing
Dual-stack environments
VPNv4 Unicast
MPLS L3VPN IPv4 routes
Service provider VPNs, carries Route Distinguisher + Route Target
VPNv6 Unicast
MPLS L3VPN IPv6 routes
IPv6 over MPLS VPN
L2VPN EVPN
Ethernet VPN
VXLAN fabrics, data center overlays
IPv4 Multicast
Multicast RPF routes
Multicast source routing
Next-Hop Behavior
This is one of the most common sources of confusion and broken routing with iBGP.
Scenario
Next-Hop Set To
Gotcha
eBGP → local
Advertising peer’s interface IP
Must be directly connected (or use ebgp-multihop)
eBGP → iBGP redistribution
Original eBGP next-hop preserved
iBGP peers must be able to reach the eBGP next-hop via IGP
iBGP → iBGP
Unchanged (original next-hop)
Next-hop must be in IGP or the route is invalid
Fix: next-hop-self
Changed to advertising router’s IP
Common on iBGP peerings to ensure reachability
Rule of thumb: Always configure next-hop-self on iBGP peers unless you have a specific reason not to (e.g., the eBGP next-hop is redistributed into your IGP).
Troubleshooting
Symptom
Likely Cause
What to Check
Peer stuck in Idle
No route to peer IP, or BGP process not started
Routing table for peer IP, BGP config, neighbor statement
Peer stuck in Active
TCP port 179 blocked or source interface unreachable