OK. Here's the scenario:
Customer has two locations; let's call them 10 Main St. and 20 Main St. Customer has its own OSPF network which connects the two.
I have an MPLS network and am providing WAN connectivity to customer's many locations (not just those two). I use eBGP on the WAN.
Customer is tagging the routes with, let us say, "10" if they originate from
10 Main St and "20" if they originate from 20 Main St. What I want to do is advertise both sites of routes out of both locations, but do it in such a way that the 10 routes are preferred out of 10 and the 20 routes are preferred out of 20. I also want to filter them inbound from the WAN -- in other words, I never want my CE router at 10 to learn any routes that 20 is advertising out, and vice versa.My initial thought was that I would prepend a private AS to the routes advertised out, and filter that private AS inbound (to avoid the looping), and set MEDs outbound such that 10 routes advertised out of 10 would have a MED of 100,
20 routes advertised out of 10 would have a MED of 200, 10 routes advertised out of 20 would have a MED of 200, and 20 routes advertised out of 20 would have a MED of 100. I tried this using an outbound route-map on my BGP neighbor statements, but evidently you cannot match tags on an outbound BGP route-map.OK, not a big deal, I figured. Instead I tried this: when I redistribute routes from OSPF into BGP, I'd match the tags do prepending. So, for example, at 10 Main, any "20" tagged routes would have the private AS prepended TWICE, and the "10" tagged routes would have the private AS prepended once. The reverse at 20 Main.
No complaints from the router...but the prepending doesn't actually seem to be working at all. Now I get routes looping (in other words, at 20 Main I learn some "10" routes which I advertise out to the WAN, and 10 Main is picking those up via eBGP and ignoring the OSPF routes altogether) due to a route race condition. If I go to a third location and do a "show ip bgp" on any of the routes, the private AS isn't in the AS path at all.
Any ideas?
--chris