Prepending ASNs to the AS Path
Problem
You want to increase the length of an AS Path so that one inbound path looks better than another.
Solution
In situations when you have multiple connections between ASs, you will often want to make remote networks prefer one inbound path when sending packets to your network. The easiest way to do this is to prepend your own ASN to the AS PATH several times, instead of just once, as it would do by default:
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#ip as-path access-list
15
permit
Router1(config)#
^$
route-map
PREPEND
permit
Router1(config-route-map)#
10
match as-path
Router1(config-route-map)#
15
set as-path prepend
Router1(config-route-map)#
65500 65500 65500
exit
Router1(config)#route-map
PREPEND
permit
Router1(config-route-map)#
20
exit
Router1(config)#router bgp
Router1(config-router)#
65500
neighbor
192.168.1.5
remote-as
Router1(config-router)#
65510
neighbor
192.168.1.5
route-map
PREPEND
out
Router1(config-router)#exit
Router1(config)#end
Router1#
This example uses the same network shown in Figure 9-2, earlier in this chapter.
Discussion
We have already discussed methods for making your outbound traffic prefer one path over another in Recipe 9.7. But, as we mentioned in that recipe, that only affects your outbound path. If you also want to ensure that inbound traffic prefers one path over another, then you have to somehow trick the remote networks into believing that one path is better than ...
Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.