Influencing outbound routes on multi homed BGP setup
I have a multi-homed network setup. I'm using a Cisco 7200 to do BGP advertising to both provider A and B. For each provider, I have a separate /24 that I'm using. I am AS prepending to influence the block A to provider A, and block B to provider B. This works fine. If either provider goes down, failover works great.
However, I also want to influence OUTBOUND traffic to flow to each provider in the same way. That is, as traffic comes in my router, I want to associate its outflow to the provider based on the source IP address. As is, each provider advertises to me just a default route.
I believe I can use routing policy to achieve this, but I don't want to hardcode the IP addresses in the policy since they could change dynamically.
So, what are my options to influence the outbound routing?
Solution 1:
From what I understand you want trafic that come from ProviderA to go back to ProviderA and trafic that come from ProviderB to go back to ProviderB.
I don't really understand "I don't want to hardcode the IP addresses", as a /24 will not be dynamic. So I would do a route-map based on the source address. It's not 100% good because you may have received trafic on ProviderA IPs from the ProviderB link even with AS prepending and you will send back the trafic to ProviderA instead of ProviderB but it will be Ok most of the time.
access-list 101 permit ip PROVIDER_A_SUBNET 0.0.0.255 any
access-list 102 permit ip PROVIDER_B_SUBNET 0.0.0.255 any
route-map SOURCE_ROUTING permit 10
match ip address 101
set ip next-hop PROVIDER_A_ROUTER
route-map SOURCE_ROUTING permit 20
match ip address 102
set ip next-hop PROVIDER_B_ROUTER
Then apply policy route-map SOURCE_ROUTING
on the interface that receive data that need to go out.
Solution 2:
The path of outbound traffic between discrete immediate peers is most typically manipulated by using local-preference attribute and can be selectively applied to received routes by way of neighbour, ASN or prefix.
However if you are only receiving a default route from each provider then your options are going to be very much limited. Is there a reason that you're not operating default-free, such as router capacity?