Network Topology Map
Tier 1 Provider Tier 2 ISP Enterprise CDN University / Datacenter

Click a source AS, then click a destination AS to animate route propagation.

BGP Routing Table
Showing RIB for AS3 (Tier 2 ISP)
Network Next Hop AS Path Local Pref MED Origin Weight

BGP Path Selection — Decision Process

1. Weight (highest)
2. Local Pref (highest)
3. Locally originated
4. AS Path (shortest)
5. Origin type (IGP > EGP > ?)
6. MED (lowest)
7. eBGP > iBGP
8. IGP metric (lowest)
BGP Path Attributes Explorer

AS_PATH

Sequence of AS numbers the route has traversed. Used for loop prevention — if your own AS number appears in the path, the route is discarded. Shorter paths are preferred.

Shorter = Better

NEXT_HOP

IP address of the border router that should be used as the next hop to reach the advertised prefix. For eBGP, this is set to the advertising router's IP; for iBGP, it is not modified.

Must be reachable

LOCAL_PREF

Used within an AS (iBGP) to signal the preferred exit point. Higher value wins. Not propagated to eBGP peers. Default is 100. Operators raise it to prefer a specific path.

Higher = Better

MED (MULTI_EXIT_DISC)

Hint to neighboring ASes about the preferred entry point when multiple links exist. Lower value wins. Only compared between routes from the same neighboring AS.

Lower = Better

ORIGIN

Indicates how the route entered BGP. IGP (i) — injected via network command. EGP (e) — learned from old EGP. Incomplete (?) — redistributed from another protocol. IGP is most preferred.

IGP > EGP > Incomplete

COMMUNITY

32-bit policy tags attached to routes. Well-known values: NO_EXPORT 65535:65281, NO_ADVERTISE 65535:65282, BLACKHOLE 65535:666. Used extensively for traffic engineering.

Flexible policy tool

WEIGHT (Cisco)

Cisco-proprietary attribute. Local to the router — never propagated. Highest wins. Evaluated first in Cisco's BGP decision process. Default is 0 for learned routes, 32768 for local.

Highest = Best (local only)

ATOMIC_AGGREGATE & AGGREGATOR

Set when a router aggregates (summarizes) more-specific prefixes into a less-specific one. AGGREGATOR identifies the AS and router that did the aggregation. Informs peers that information may have been lost.

Informational
BGP Session State Machine

Idle

Initial state. BGP is waiting for a Start event (e.g., operator enables BGP or peer comes up). Resources are initialized. The router refuses all incoming BGP connections.

  • Start event → move to Connect
  • All errors → remain in Idle
BGP Message Types
1

OPEN

First message sent after a TCP connection is established. Negotiates the BGP session parameters. Both peers exchange OPEN messages and verify compatibility.

VersionBGP version number (current: 4)
My Autonomous SystemSender's AS number (2-byte or 4-byte via capability)
Hold TimeProposed hold time in seconds; smaller value is negotiated (default 90s)
BGP IdentifierRouter ID — highest IP or manually set 32-bit value
Optional ParametersCapabilities: 4-byte ASN, MP-BGP, Route Refresh, etc.
2

UPDATE

The workhorse of BGP. Advertises new routes (NLRI + path attributes) and/or withdraws previously advertised routes. A single UPDATE can carry multiple prefixes and withdrawals.

Withdrawn Routes LengthLength of withdrawn routes field in bytes
Withdrawn RoutesList of IP prefixes being removed from service
Total Path Attribute LengthLength of path attributes field
Path AttributesAS_PATH, NEXT_HOP, LOCAL_PREF, MED, COMMUNITY, etc.
NLRINetwork Layer Reachability Information — list of advertised prefixes
3

KEEPALIVE

Sent periodically to keep the session alive. No payload — just the 19-byte BGP header. Sent every 1/3 of the hold time (default every 30s). Also sent in response to OPEN to acknowledge the session.

Marker16 bytes of 0xFF — synchronization and authentication marker
Length19 (header only)
Type4 (KEEPALIVE)
4

NOTIFICATION

Sent when an error is detected. Immediately closes the TCP connection after sending. The receiving router must reset the session.

Error Code1=Header, 2=OPEN, 3=UPDATE, 4=Hold Timer, 5=FSM, 6=Cease
Error SubcodeFurther qualification of the error type
DataVariable-length field with diagnostic data
5

ROUTE-REFRESH (RFC 2918)

Requests a peer to re-send its routing table for a given address family without tearing down the session. Used after policy changes. Both peers must advertise the Route Refresh capability in OPEN.

AFIAddress Family Identifier (1=IPv4, 2=IPv6)
Reserved1 byte, must be 0
SAFISubsequent AFI (1=unicast, 2=multicast, 128=MPLS VPN)
Route Hijacking Demo

Legitimate Route

AS15169 (Google) announces 8.8.8.0/24. All traffic destined for 8.8.8.x is forwarded to Google's routers via the best path.

BGP Hijack

Malicious AS announces 8.8.8.0/25 — a more-specific prefix. BGP always prefers the longer prefix match. Traffic to the first half of 8.8.8.x now flows to the attacker.

RPKI / ROA Mitigation

Resource Public Key Infrastructure (RPKI) lets the legitimate owner cryptographically sign their prefix. A Route Origin Authorization (ROA) declares which AS is allowed to originate a prefix and the maximum prefix length. RPKI-validating routers drop invalid announcements.

Real-World Examples

2010: China Telecom hijacked ~37,000 prefixes for 18 min.
2018: Mylobot malware hijacked AWS routes to steal crypto.
2022: Vodafone AS55410 leaked routes affecting Facebook.

eBGP vs iBGP
Property eBGP iBGP
Peers Different ASes Same AS
TTL default 1 (direct links only) 255 (loopback possible)
NEXT_HOP Set to self Unchanged (neighbor's IP)
LOCAL_PREF Stripped on export Propagated unchanged
AS_PATH Own AS prepended Unchanged
Split horizon N/A Routes NOT re-advertised to other iBGP peers
Full mesh Not required Required (or Route Reflector / Confederation)
Admin distance 20 200
MED propagated To neighbors (optional) Yes, within AS