02 eBGP vs iBGP

BGP peer relationships come in two types, determined entirely by whether the two peers are in the same Autonomous System or in different ones. The protocol behaves differently in each case, so understanding this distinction is the foundation for most later BGP topics.

The core distinction

The peer type is derived from the AS numbers, not declared with a separate command:

  • If both peers are in the same AS → the session is iBGP (Internal BGP).
  • If the peers are in different AS → the session is eBGP (External BGP).

This is decided when the configured remote AS of a neighbor is compared against the local AS: the same value means iBGP, a different value means eBGP. There is no separate “router ibgp” command. Both types use identical syntax; the relationship is inferred from the AS comparison alone.

Behavioral differences

Many BGP behaviors change depending on the peer type. Each is covered in depth in its own note, but summarized here:

BehavioreBGPiBGP
Administrative Distance20200
Default TTL1 (must be directly connected)255 (multi-hop is normal)
AS-PATH on advertisementLocal ASN is prependedAS-PATH is not changed
Next-hop on advertisementSet to advertising router’s IPNot modified by default
Loop preventionAS-PATH (reject own ASN)Split-horizon rule (no re-advertise)
Re-advertisement ruleFreely re-advertisedRoutes from an iBGP peer are not sent to another iBGP peer

Why the peer type matters

  • eBGP connects different administrative domains. Because peers are typically one hop apart, eBGP defaults to TTL 1 and prepends the AS-PATH, which also provides loop prevention between AS.
  • iBGP distributes externally learned routes inside a single AS. Because AS-PATH is not modified between internal peers (same ASN), AS-PATH cannot detect internal loops. This forces a different loop-prevention mechanism (the iBGP split-horizon rule) and drives the need for full-mesh, route reflectors, and confederations.

Directly connected vs multi-hop

  • eBGP peers are expected to be directly connected (one hop) by default, because of TTL 1.
  • iBGP peers are frequently not directly connected; they reach each other through the internal IGP. For this reason iBGP sessions are commonly sourced from loopback interfaces, so the session survives the failure of any single physical link as long as the IGP still has a path to the loopback.

Self-check

Q1 — What determines whether a BGP session is eBGP or iBGP?

A) A dedicated router ibgp or router ebgp command
B) Whether the peers are directly connected or not
C) Whether the neighbor’s remote AS matches the local AS or not
D) The Administrative Distance configured on the neighbor

Q2 — What are the default TTL values for eBGP and iBGP, and what do they imply?

A) eBGP 255, iBGP 1 — eBGP is multi-hop by default
B) eBGP 1, iBGP 255 — eBGP expects a directly connected peer
C) Both default to 1
D) Both default to 255

Q3 — Why can AS-PATH not be used for loop prevention inside an AS (iBGP)?

A) Because iBGP does not use AS-PATH at all
B) Because the AS-PATH is stripped between iBGP peers
C) Because AS-PATH is not modified between iBGP peers, so a loop inside the AS would not add a detectable ASN
D) Because iBGP uses Weight instead of AS-PATH

Q4 — What is the iBGP split-horizon (re-advertisement) rule?

A) A route learned from an iBGP peer is not advertised to another iBGP peer
B) A route learned from an iBGP peer is advertised to all other iBGP peers
C) A route learned from an eBGP peer is never advertised to iBGP peers
D) iBGP peers must always be directly connected