EBGP vs IBGP
Both EBGP and IBGP are terms used with the routing protocol BGP. In theoretical terms, the main difference between the two is EBGP runs between two BGP routers in different Autonomous System (AS), however, IBGP runs between two BGP routers in the same AS. Before we discuss the differences between EBGP and IBGP, let us have a basic understanding of EBGP and IBGP.
What is EBGP?
BGP runs between routers in different autonomous systems. By default, in EBGP (peering in two different AS), IP TTL is set to 1, which means peers are assumed to be directly connected.
In this case, when packet crosses one router, TTL becomes 0 and then the packet will be dropped beyond that. In cases where the two neighbors are not directly connected, for example, peering with loopback interfaces or peering when devices are multiple hops away, we need to add command “neighbor x.x.x.x ebgp-multihop <TTL>”
Otherwise, BGP neighborship will not be established. In addition, EBGP peer will advertise all the best routes it knows or it has learnt from its peers (whether EBGP peer or IBGP peer), which is not, in the case of IBGP.
What is IBGP?
In IBGP, there is no restriction that neighbors have to be connected directly; however, an IBGP peer will not advertise the prefix it learned from an IBGP peer to another IBGP peer. This restriction is there to avoid loops within the same AS. To clarify this, when a route is passed to a EBGP peer, the local AS number gets added to the prefix in as-path, so if we receive the same packet back stating our AS in as-path, we know that it is a loop, and that packet gets dropped. However, when a route is advertised to an IBGP peer, the local AS number is not added to as-path, since the peers are in same AS.
To avoid loops in same AS, there are two methods used.
1. Full Meshed Topology: In this, all the routers in the same AS have to be connected to each other. For example, if we have N routers, then we must have N (N-1)/2 IBGP sessions. We can avoid this by introducing Route Reflectors.
2. Use of Route-Reflectors: It is an alternative method to overcome full mesh scenario. In this case, IBGP sessions are established with a central point. This central point is called Route Reflector and the other IBGP routers are called route reflector clients.
What is the difference between eBGP and iBGP?
1. EBGP is peering between two different AS, whereas IBGP is between same AS (Autonomous System).
2. Routes learned from eBGP peer will be advertised to other peers (BGP or IBGP); however, routes learned from IBGP peer will not be advertised to other IBGP peers.
3. By default, EBGP peers are set with TTL = 1, which means neighbors are assumed to be directly connected, which is not in the case of IBGP. We can change this behavior for EBGP by using command “neighbor x.x.x.x ebgp-multihop <TTL>”. Multihop is the term used in EBGP only.
4. EBGP routes have administrative distance of 20, whereas IBGP has 200.
5. Next hop remains unchanged when route is advertised to IBGP peer; however, it is changed when it is advertised to EBGP peer by default.
This default behavior of IBGP can be changed by the command “neighbor x.x.x.x next-hop-self”; this changes the next hop, while advertising, as a local route.