BGP Session Types: iBGP vs eBGP

Border Gateway Protocol (BGP) has two sessions types, internal BGP (iBGP) and external BGP (eBGP). These BGP sessions are used depending on the Autonomous System of a BGP router. Let’s see iBGP vs. eBGP below.


Internal BGP (iBGP)

BGP sessions within the same Autonomous System (AS) are established with iBGP. It allows a prefix from one AS to be advertised to another AS. In the example below, you can see that there are three routers in AS100. These three routers can form an iBGP peering with one another. We can have the following iBGP peers:

  • Router1 and Router2 iBGP peer
  • Router2 and Router3 iBGP peer
  • Router1 and Router2 iBGP peer

ibgp vs ebgp

Also, even if the BGP routers are not directly connected, they can still become an iBGP neighbor of one another as long as they’re on the same AS. With that being said, iBGP can be used when multiple routing protocols are used in the Autonomous System.

For example, Router1 and Router2 use OSPF for their connectivity, and Router2 and Router3 use EIGRP. We can establish an iBGP connectivity between Router1 and Router3 to have transit connectivity to AS150 and AS200. The downside of this setup is that when Router2 on AS100 receives traffic from either AS150 or AS200, it wouldn’t know where to forward the traffic.

You might be wondering, “why don’t we use IGP, such as OSPF or EIGRP, on AS100 instead, and just redistribute the prefixes?” It is possible with a few prefixes. However, if we have a full Internet routing table, IGP lacks the scalability to handle the number of routes. BGP also uses custom routing to identify the best route, whereas IGPs use metric. The best path chosen by BGP could be longer and would be deemed as suboptimal by IGPs. Moreover, BGP path attributes are maintained by BGP only as the prefixes are advertised from AS to another AS.

Establishing iBGP sessions between all of the neighbors in the AS creates a full mesh. The routes received from iBGP neighbors are not advertised to other iBGP neighbors, which avoids loops and allows proper forwarding between Autonomous Systems.


External BGP (eBGP)

BGP sessions that are in different Autonomous Systems are established with eBGP. In the same example topology above, eBGP is used to exchange network prefixes between AS150, AS100, and AS200. We would need the following eBGP peers:

  • Branch1 and Router1 eBGP peer
  • Branch2 and Router3 eBGP peer

For loop prevention, EBGP copes using the AS_Path. The advertising BGP router adds its ASN at the beginning of the existing AS_Path variable. Then, the receiving BGP router verifies if the ASN in the AS_Path variable doesn’t match any of the local routers. If it does, BGP discards the Network Layer Reachability Information (NLRI), which contains the prefix.


iBGP vs eBGP

Listed below are the difference between iBGP and eBGP.

  1. Administrative Distance – upon the installation of an eBGP prefix in the routing table, it will be assigned with an Administrative Distance (AD) of 20. With iBGP, the AD will be 200.
  2. Time-to-live (TTL) – eBGP packets have 1 TTL value by default. It causes packets to be dropped in transit, preventing a multi-hop BGP session. iBGP packets have a TTL value of 255, thus allowing multi-hop BGP sessions.
  3. When advertising routes to an eBGP neighbor, the next hop address is changed to the IP address of the local router. With iBGP, the next hop address is unchanged.
  4. The eBGP and iBGP sessions are configured similarly, except for the ASN in the remote-as statement, which is different from the ASN defined in the BGP process.

Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.

We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: