BGP-4 overview
Border Gateway Protocol version 4 — the inter-AS routing protocol that holds the Internet together.
Contents
Purpose
BGP-4 exchanges network reachability information between Autonomous Systems. Each BGP speaker advertises IP prefixes paired with path attributes that describe how to reach those destinations. The AS_PATH attribute provides a loop-free graph of AS connectivity; policy decisions layer on top.
BGP-4 replaced classful routing with CIDR support — prefixes instead of network classes — and introduced route aggregation including AS path aggregation.
Protocol fundamentals
BGP runs over TCP port 179. TCP handles fragmentation, retransmission, and sequencing. BGP sends incremental updates only — no periodic full-table refresh.
| Property | Value |
|---|---|
| Transport | TCP port 179 |
| Message size | 19–4096 octets |
| Session types | EBGP (inter-AS), IBGP (intra-AS) |
| Timers | Hold Time (negotiated), Keepalive (1/3 Hold Time) |
| RIB structure | Adj-RIB-In, Loc-RIB, Adj-RIB-Out |
Routing Information Base
The RIB has three logical parts:
- Adj-RIBs-In — unprocessed routes received from each peer via UPDATE messages. Input to the Decision Process.
- Loc-RIB — routes selected by the local Decision Process. These are the routes the speaker uses for forwarding.
- Adj-RIBs-Out — routes selected for advertisement to each peer. Carried in outgoing UPDATE messages.
An implementation does not need three physical copies. A single table with flags or pointers satisfies the requirement.
Session establishment
A BGP session progresses through the Finite State Machine (see BGP FSM). The high-level flow:
The Hold Time is negotiated to the lower of the two proposed values. If zero, keepalives are disabled.
Route advertisement and withdrawal
Routes are advertised in UPDATE messages. A single UPDATE carries one set of path attributes with one or more NLRI prefixes sharing those attributes. Withdrawal happens three ways:
- Explicit withdrawal — prefix listed in the Withdrawn Routes field
- Implicit replacement — new UPDATE with the same prefix but different attributes
- Session close — all routes from that peer are implicitly withdrawn
EBGP vs IBGP
| Behavior | EBGP | IBGP |
|---|---|---|
| AS_PATH | Prepend local ASN | Do not modify |
| NEXT_HOP | Set to own address | Preserve (by default) |
| LOCAL_PREF | Do not send | Required |
| Loop prevention | AS_PATH check | Full mesh / RR / confederation |
| TTL | 1 (default) | 255 (loopback peering) |
IBGP requires either a full mesh, route reflectors (RFC 4456), or confederations (RFC 5065) to distribute routes without loops.
RFC lineage
RFC 4271 (January 2006) obsoletes RFC 1771 and is the current base BGP-4 specification. It has been updated by:
| RFC | Topic |
|---|---|
| 4724 | Graceful Restart |
| 6286 | BGP Identifier relaxation |
| 6608 | Subcodes for Cease NOTIFICATION |
| 6793 | 4-octet AS number support |
| 7606 | Revised error handling (treat-as-withdraw) |
| 7607 | Codification of AS 0 processing |
| 7705 | Long-lived Graceful Restart |
| 8212 | Default EBGP route propagation behavior (deny) |
| 8654 | Extended message support (>4096 octets) |
| 9072 | Extended Optional Parameters Length |
| 9687 | Send Hold Timer |
| 9774 | Deprecation of AS_SET and AS_CONFED_SET |
A draft (draft-ietf-idr-bgp4-rfc4271bis) is progressing toward Full Standard status with a milestone of May 2027.
Child pages
- BGP message types — OPEN, UPDATE, KEEPALIVE, NOTIFICATION formats
- BGP path attributes — ORIGIN, AS_PATH, NEXT_HOP, MED, LOCAL_PREF, aggregation
- BGP finite state machine — states, events, transitions
- BGP Decision Process — path selection and tie-breaking
- BGP error handling — error codes, subcodes, connection collision detection