BGP Essentials: AS-path Prepending
Enterprise networks primarily use BGP with their Internet Service Providers if they want to be multi-homed (connected to more than one ISP). A very common requirement in a multi-homed design is the primary/backup setup where the lower speed (or sometimes lower quality) link should only be used when the primary link fails.
Competent ISPs help their customers reach this goal by using BGP local preference within their network and giving the customers the ability to indicate the desired value of BGP local preference through BGP communities: if the route received directly from the customer has low local preference, all other routes are preferred, resulting in the desired traffic flow that avoids the backup link if at all possible as shown in the next diagram:
![Using BGP communities to set local preference](/2008/02/LocPref.jpg)
Using BGP communities to set local preference
Sometimes you are forced to deal with less than ideal ISPs (or the two ISPs you’re using are so far apart in the Internet topology that the BGP local preference solution doesn’t work). In these cases, the only means of influencing BGP route selection in the Internet is the extension of the AS path attribute (routes with shorter AS paths are preferred) with multiple copies of your own AS number: AS-path prepending.
AS-path prepending is configured in Cisco IOS with route-map based per-neighbor outbound filter. The actual prepending is specified within the route-map with the set as-path prepend command, as illustrated in the following sample configuration:
router bgp 65001
neighbor 10.1.0.2 remote-as 65200
neighbor 10.1.0.2 description Backup ISP
neighbor 10.1.0.2 route-map prepend out
!
route-map prepend permit 10
set as-path prepend 65001 65001 65001
May I know what is the signinficance of the "10" in route-map prepend permit 10? Thanks!
Cheers!
This is the sequence for the route map rules.
You can have multiple route map entries with a single name.
route-map blah permit 10
match whatever
set anything
route-map blah permit 20
match otherthings
set otherstuff
and so on..
The lookup stops when a matching rule is found.
cheers
PS - you should also include the part about prioritising upload using bgp neighbour weight
If we have two subnet & we want one subnet to take primary ISP & second to secondary ISP for incoming traffic. How to configure?
will set as-path will affect both the subnet incoming path?
Advertise to ISP-B: S1 with long path, S2 with short path
Why there is no "match local preference" for route-map used in BGP?
% "SET-LOCAL-PREFERENCE-103" used as BGP inbound route-map, local preference match not supported
Anyhow, I wouldn't recommend it, I would strongly suggest that all routers in an autonomous system should have the same local preference for the same prefix (otherwise you might get interesting problems that would be hard to troubleshoot).
* Inbound ACLs limiting destinations to your address space.
What about a case when you have dual CE, one providing a 50 Mbps connection and the other being a Wireless HSPA+ just for backup?
Do you know a way to actually filter the traffic in the Wireless connection so that the pipe is not saturated when switching over?
ACLs would do the job for outbound traffic, but for inbound we are screwed...
Any ideas?
Thanks in advance.
will be chosen from customer site. please explain i see traffic drop.