Esc
Type to search posts, tags, and more...
Skip to content

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.

PropertyValue
TransportTCP port 179
Message size19–4096 octets
Session typesEBGP (inter-AS), IBGP (intra-AS)
TimersHold Time (negotiated), Keepalive (1/3 Hold Time)
RIB structureAdj-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:

  1. Explicit withdrawal — prefix listed in the Withdrawn Routes field
  2. Implicit replacement — new UPDATE with the same prefix but different attributes
  3. Session close — all routes from that peer are implicitly withdrawn

EBGP vs IBGP

BehaviorEBGPIBGP
AS_PATHPrepend local ASNDo not modify
NEXT_HOPSet to own addressPreserve (by default)
LOCAL_PREFDo not sendRequired
Loop preventionAS_PATH checkFull mesh / RR / confederation
TTL1 (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:

RFCTopic
4724Graceful Restart
6286BGP Identifier relaxation
6608Subcodes for Cease NOTIFICATION
67934-octet AS number support
7606Revised error handling (treat-as-withdraw)
7607Codification of AS 0 processing
7705Long-lived Graceful Restart
8212Default EBGP route propagation behavior (deny)
8654Extended message support (>4096 octets)
9072Extended Optional Parameters Length
9687Send Hold Timer
9774Deprecation 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

Sources

Last synthesized: 2026-05-07

AI-assisted synthesis from the RFCs and sources linked above.