I'm connected to 2 BGP peers; They both give me a filtered table that includes a default + about 30K prefixes each (not a full table). For prefixes that I do receive, I simply let BGP use it's prefix-length algorithm to select the best route. For prefixes that I don't receive (ie: the "default" applies) I favor BGP peer 1. The problem is, for one particular prefix that I don't receive from either BGP peer (ie: the default would apply), I'd like to favor BGP peer 2, not the usual peer 1. I know I could easily do this using a static route, but that doesn't sound quite right, because if I add a static route towards peer 2's router and the route drops, the static route would "stick" and I will not be able to push any traffic to that prefix. If I can find a BGP mechanism to do the same, I can prefer a route to BGP peer 2, but if that route is not available, the route to BGP peer 1 would be used.
To manipulate my out-bound routes I'm using route-maps that set the an equal local-preference for outbound traffic towards received prefixes so BGP's default prefix-list-length algorithm is used, and I'm setting a higher preference for outbound traffic using the "default" route for BGP peer 1.
Unfortunately I have no idea how to use a route-map to do this for my special prefix, because no object with that prefix exists in the system: as far as both BGP peers are concerned, it is handled by the "default" route.
I'm using Quagga
for my routing, so BGP is not the only available protocol. A Cisco-style solution wold be fine as well, since I suspect I'm lacking some basic knowledge and any nudge in the right direction would help me find my way.
Here's my bgpd.conf file, edited to remove personal information; Hopefully I didn't over do it:
router bgp 12345
bgp router-id 10.0.0.1
network 10.0.0.0/24
redistribute connected
!
neighbor 10.0.1.1 remote-as 22222
neighbor 10.0.1.1 ebgp-multihop 3
neighbor 10.0.1.1 next-hop-self
neighbor 10.0.1.1 distribute-list distrib-out out
neighbor 10.0.1.1 route-map INBGP1 in
!
neighbor 10.0.2.1 remote-as 11111
neighbor 10.0.2.1 ebgp-multihop 10
neighbor 10.0.2.1 next-hop-self
neighbor 10.0.2.1 distribute-list distrib-out out
neighbor 10.0.2.1 route-map INBGP2 in
!
access-list distrib-out permit 10.0.0.0/24
!
access-list is-default permit 0.0.0.0/0 exact-match
!
route-map INBGP2 permit 10
set metric 2
set ip next-hop 89.121.231.73
on-match next
!
route-map INBGP2 permit 20
match ip address is-default
set local-preference 101
on-match goto 1000
!
route-map INRTC permit 30
set local-preference 110
set metric 1
!
route-map INBGP2 permit 10
set metric 1
on-match next
!
route-map INBGP1 permit 20
match ip address is-default
set local-preference 200
on-match goto 1000
!
route-map INBGP1 permit 30
set local-preference 110
set metric 1