I have an issue where I am advertising two default routes, one from a primary and another from the backup site
One is OSPF(backup) and the other is iBGP(primary). There are two eBGP routers connected to ISP, with a switch behind them
The switch is iBGP peering with the routers and OSPF peering with a FW
I would like the iBGP route to be used, unless the BGP advertised default route drops out of the routing table
The OSPF default should then be used until the BGP route is restored
under BGP I have used the following command
distance 100 x.x.x.x 0.0.0.0 Default
ip access-list standard Default permit 0.0.0.0
This gives the iBGP route a AD of 100, lower than OSPF.
This works but the problem I have is the only way I can flip back to the iBGP default route is by removing the default route from OSPF or clearing the ip ospf process. This is fine in a test environment but not in the real world.
Ideally the default route comes back in from the BGP side and the OSPF is replaced.
I would recommend redistributing the BGP learned default route into OSPF, and influencing the metrics within OSPF to favour the route learned via the ISP. This can be done at the point of redistribution through a number of methods.
It's much cleaner to influence routing within the same IGP rather than trying to play around with the admin distances.