BGP - redistributing iBGP routes into an IGP
When employing BGP it is considered best practice not to redistribute a route learned via iBGP into an Interior Gateway Protocol (IGP). Such a configuration may result in a Layer 3 routing loop.
A routing loop may occur in such an instance because of the fundamental differences in how iBGP and IGPs like OSPF or EIGRP handle routing information.
In iBGP, routes learned from one iBGP neighbor are not advertised to another iBGP neighbor. This is known as the iBGP split-horizon rule. The purpose of this rule is to prevent routing loops within the AS.
On the other hand, IGPs like OSPF do not have this rule. They advertise all learned routes to all neighbors. So, if you redistribute an iBGP-learned route into OSPF, OSPF would then advertise this route to all its neighbors, including the iBGP router that originally advertised the route. This could potentially create a loop.
Let’s take an example: Router A learns a route from iBGP peer Router B. Router A then redistributes this route into OSPF. Router C, an OSPF neighbor of Router A, learns this route and advertises it to its iBGP peer, Router B. Now, Router B has a looped route.
The more logical solution, is to advertise the network directly into the IGP and not redistribute. This means that instead of redistributing specific routes from iBGP into OSPF, you directly advertise the network that these routes belong to. This way, all routers in the OSPF domain will have a route to the network, and you avoid the potential for routing loops.
This brings into light the design principles of the operation of BGP and how it relates to IGPs.
IGPs are typically used to route traffic within an AS while BGP is used to route traffic between ASes. The role of iBGP is simply to learn about the routes in the local AS and inform the eBGP routers on the edge of the AS of those routes, so those routes can be advertised to external ASes. iBGP typically plays no role in the routing mechanisms within an AS.
For this reason, iBGP learned routes are redistributed into an IGP by default.
Links
https://networklessons.com/bgp/internal-bgp-border-gateway-protocol-explained/
https://networklessons.com/bgp/how-to-configure-ebgp-external-bgp
https://networklessons.com/bgp/how-to-advertise-networks-in-bgp