BGP is an external routing protocol that advertises routes between and within autonomous systems. When BGP advertises external routes (eBGP), it uses its own mechanism to avoid loops. This is accomplished by a BGP attribute called “AS_PATH.” The autonomous system path attribute is triggered by BGP when there is not PAs (Path Attributes) set under a BGP routing process. Now, when a BGP neighbor router receives a route from another autonomous system (external route), it uses the ” IP address next hop of its neighbor. ” In other words, if a BGP router sends an update to another peer between “Autonomous Systems” (eBGP), the neighbor router that receives that update will use the “IP address” of its neighbor as a next hop, as long as the update is coming from a different autonomous system. I hope it could make sense. However, I will show an example using a lab I built on GNS3.
Before I show you how it works, it is important to know that this behavior can cause issues when a router receives an “external update” and that same router relays the same update to another peer within its own “Autonomous System” (iBGP)
Let’s take a look at this example below:
This is the flow:
- ISP has a subnet in AS 300 (188.8.131.52/24) When ISP advertises network (184.108.40.206/24) to “R4-Company X,” it will use IP address 220.127.116.11 (ISP f1/1)
- R4 receives the “external update,” checks the its routing table, noticed that it can reach that subnet using (ISP IP address configured in interface f1/1), so it marks that IP address as a next hop to reach 18.104.22.168/24 network.
- R4 will then advertise the external update to R5 using the same next hop IP address (22.214.171.124 ISP fa1/1)
- R5 will mark (126.96.36.199 ISP fa1/1) as its next hop to reach 188.8.131.52/24 network.
Even though R5 has network 184.108.40.206/24 in its “BGP table,” it does not know how to get there because R5 does not have a route to 220.127.116.11/24 in its routing table.
This is a “reachability issue” and this lies on the fact that BGP has its own mechanism to avoid loops using its “AS_PATH” as I mentioned at the beginning of the article. ISP and R4 belongs to different Autonomous systems, therefore they are “eBGP neighbors.”
R4,R5 and R6 are within the same autonomous system, so they are “iBGP” neighbors. In this scenario iBGP routes will be advertised the same AS_PATH. Therefore, R5 will be kind of blind because even though they know that to reach 18.104.22.168/24 R5 needs to know how reach (22.214.171.124 ISP-f1/1) in the first place and there is not route in the routing table of R5 to accomplish that goal.
One solution could be to create a static route and use redistribution, but in this article I will use a nice command under the BGP routing system: (neighbor x.x.x.x next-hop-self)
Now, let’s look at the configuration with this command :
Now, let’s check the “ip bgp table” on R5 again:
We can see above that R5 is using “router R4 F1/0 – (126.96.36.199)” to reach 188.8.131.52/24. Let’s check now the routing table:
Can we ping 184.108.40.206 from R5?
Let’s trace it: