Inter-Domain Routing & BGP

eBGP and iBGP

/ ee-B-G-P and eye-B-G-P /

BGP is used in two places that look the same but play different roles. eBGP (external BGP) runs between routers in DIFFERENT autonomous systems — it is how networks tell each other what they can reach. iBGP (internal BGP) runs between routers WITHIN the SAME autonomous system — its job is to carry the routes learned from the outside world across the inside of one network, so every border router agrees on how to exit. Same protocol, two jobs: learning routes at the border, then distributing them internally.

Why do you need iBGP at all? Picture a national ISP with border routers in New York and Los Angeles. The New York router learns, via eBGP, how to reach a European prefix; the LA router learns, via eBGP, how to reach an Asian one. A packet entering in LA but destined for Europe must somehow be sent across the ISP's interior to the New York exit. The ISP's internal routing protocol (say OSPF) knows how to get from LA to New York, but it does NOT know about external Internet prefixes. iBGP fills that gap by flooding the externally-learned BGP routes to every BGP router inside the AS, so the LA router knows the proper exit is in New York.

Two practical rules flow from this. First, eBGP usually runs between directly connected routers, while iBGP sessions are often between routers that are several internal hops apart (relying on the IGP to carry packets between them). Second, to prevent internal loops, the classic rule is that a route learned via iBGP is NOT re-advertised to another iBGP peer — which naively forces a full mesh of iBGP sessions, the reason large networks use route reflectors or confederations to scale it down.

An AS has three border routers, R1, R2, R3. R1 learns a route to prefix P from an external neighbour via eBGP. To make sure R2 and R3 also know that P is reachable via R1, the AS runs iBGP sessions R1–R2 and R1–R3 (and R2–R3) so the route propagates internally. Now any of the three can forward traffic for P toward R1's exit.

eBGP learns routes from neighbours; iBGP distributes those routes to every border router inside the same AS.

eBGP and iBGP are the same protocol with different policies, not two protocols — and iBGP does NOT replace the interior routing protocol (OSPF/IS-IS); it rides on top of it to carry external prefixes.

Also called
external BGPinternal BGP外部 BGP內部 BGP