On 2013-06-13, Gregory Edigarov <[email protected]> wrote: > On 06/13/2013 11:36 AM, Bernd wrote: >> Hi, >> >> running OpenBSD 5.3 (amd64) for BGP routing for more than one and a half >> years without any trouble -- thanks guys! >> >> However, as setups evolve, new questions may arise. As far as I get from the >> man pages, it's only possible 'globally' to apply prepending to AS paths: >> >> prepend-neighbor number >> Prepend the neighbor's AS number times to the AS path. >> >> prepend-self number >> Prepend the local AS number times to the AS path. >> >> I'd like to do this only for certain networks in our AS, to force ingress >> and egress traffic over a certain uplink -- leaving all other networks >> untouched by this. >> >> Is that possible with OpenBGPd? > > something like > match to your_neighbor_here prefix 192.168.2.0/24 set prepend-self 2 > match from your_neighbor_here some.other.prefix.0/NN set prepend-neighbor 3 > >
For ingress traffic: You can *influence* things in this way, but if you want to *force* ingress traffic for a certain prefix to always come in over a certain link, you cannot advertise it out of other uplinks at all - if somebody sets a higher localpref for you on their network then it doesn't matter how long the AS path is, the localpref always trumps this. For egress traffic (I am understanding this as "I want traffic generated by certain prefixes on my network to always be sent via a certain transit provider" or similar): this can't be done with BGP, or indeed by the routing table at all, you would need to PF route-to rules or similar.

