Why an OSPF route might get into the RIB and beat eBGP?
Scenario with two routers CE1 and CE2. CE1 is receiving the same prefix
1) from the eBGP neighbor with local-preference = 150 (AD = 20)
2) from CE2 via iBGP with local-preference = 200 (AD = 200)
3) from CE2 via OSPF (AD = 110)
So from BGP protocol point of view, the router compares 1) and 2). As 2) has better BGP attributes (higher local-preference), it’s the best route within BGP.
There is only one route for the prefix within OSPF, so 3) is the best route within OSFP.
Then the router has to choose the best route among all routing protocols to put to the RIB.
The OSPF route has AD =110, while 2) is an iBGP route, i.e., AD = 200.
So the OSPF route gets to the RIB.
And you can see the BGP prefixes (both iBGP and eBGP) failed to get to the RIB.
So if you want to get the eBGP route to the RIB on CE1, you need to make it the best withing BGP first.
You could assign a higher weight to it, e.g.
neighbor 10.10.249.233 weight 35000
would make it.
In this case, all eBGP prefixes would win within BGP on CE1.
And as AD = 20 for eBGP, they would beat OSPF prefixes and get to the RIB finally.
And as the weight attribute is local only and is not advertised to the BGP neighbors, no change would happen in CE2 routing.
Sure there are other possibilities: not running iBGP between the routers while there is also OSPF with BGP prefixes redistributed, e.g.By privilege15