What is the difference between eBGP and iBGP?
Show the answer
Say this first
eBGP runs between routers in different ASes, iBGP between routers in the same AS. The protocol is the same, the rules differ. On Cisco, eBGP routes get administrative distance 20 and iBGP routes 200. eBGP peers expect to be directly connected (TTL 1), while iBGP peers usually sit several hops apart on loopbacks. eBGP adds the local AS to the path and sets itself as next hop; iBGP does neither. And a route learned over iBGP is never passed to another iBGP peer.
Go deeper
| eBGP | iBGP | |
|---|---|---|
| Peers | Different AS | Same AS |
| Cisco AD | 20 | 200 |
| Default TTL | 1 | 255 |
| AS_PATH on send | Local AS prepended | Unchanged |
| NEXT_HOP on send | Set to itself | Unchanged by default |
| LOCAL_PREF | Not sent | Sent |
| Re-advertising learned routes | To every peer | Not to other iBGP peers |
| Loop prevention | Own ASN in AS_PATH | iBGP split horizon (or RR attributes) |
router bgp 64500
neighbor 192.0.2.1 remote-as 64496
neighbor 10.255.0.2 remote-as 64500
neighbor 10.255.0.2 update-source Loopback0The router decides eBGP or iBGP by comparing remote-as with its own AS. 192.0.2.1 is eBGP, 10.255.0.2 is iBGP.
Why the AD values
An eBGP route comes straight from the AS that owns the destination, so it is trusted above any IGP. An iBGP route is second-hand knowledge about an external prefix; if the IGP also knows that prefix, the IGP is closer to the truth inside your network, so iBGP's 200 loses to OSPF's 110.
They will ask next
What is the AD of a locally originated BGP route, like an aggregate?
200 on Cisco. The three values are external, internal and local, set together with
distance bgp 20 200 200.How does MED behave across the two?
A router sends MED to its eBGP neighbor. The receiving AS can pass that MED to its iBGP peers, but it must not pass it on to another AS. MED is optional non-transitive.
Traps
- Saying iBGP peers need a direct link. They need IP reachability, usually through the IGP.
- Forgetting that iBGP keeps the external next hop. It is the classic reason iBGP routes are not installed.