I have a carrier's MPLS network with multiple CE's each with their own OSPF areas (non area 0) on LAN side. I also plan on running BGP from the CE's to the MPLS PE's to share routing info across WAN. I need to ensure reachability amongst all OSPF areas (interconnected via MPLS).
I want to let OSPF learn routes dynamically on the CE and redistribute these routes into BGP rather than "hard coding" defined routes via the BGP "networks" statement to advertise (if I can help it) - that way I can let OSPF take care of any routes automatically without changing BGP setting on the CE (managed by a telco) each time a route needs to be added on the LAN side. However I am mindful of mutual/2-way redistribution issues and needing to filter routes learnt dynamically from OSPF being redistributed back into OSPF from BGP the other way. My query is if there is a way to filter such routes that were learnt dynamically originally from OSPF from re-entering OSPF again? Or does this need explicit definition in a distribute list say?
Otherwise, what's the best way to achieve this bearing in mind potential mutual redistribution issues?
Is the best way to use BGP "networks" command on the local CE to explicitly advertise routes into MPLS then use distribute lists to filter/prevent these networks from re-entering OSPF again due to BGP to OSPF redistribution when coming back the other way? Also, I guess under this method, OSPF on the CE would learn the routes set by the BGP "networks" statements automatically (and therefore we won't need to explicitly redistribute BGP into OSPF and thus keep redistributing one way which is better practice)?
Hope it makes sense!! :)
The CE will not redistribute the ospf routes back into OSPF due to the locally-originated attribute, ie your CE will be redistributing the OSPF routes into BGP, therefore the OSPF routes will show as "sourced" on the CE, ie originated into BGP locally, this is a very high attribute in the BGP selection path, therefore even if the ospf routes were advertised back to the CE via BGP, it would not select those routes as best and therefore would not redistribute them back into OSPF.
If you want to make sure your design nice and tidy, and you wont be adding/removing subnets continously, then it would be wise to filter on redistribution into BGP on each CE, ie each CE can redistribute only its local OSPF routes into BGP.
As an alternative approach, you might consider just advertising one summary address for a site to MPLS's BGP. This assumes all the addresses for the site are within a single address block that doesn't overlap with any another site. If you're able to do that, you could then redistribute the BGP summary routes into the local site's OSPF or perhaps just orginate an OSPF default route to the local site from the CE router.