BGP Neighbors and Route Maps
The neighbor command can be used in conjunction with route maps to perform either filtering or parameter setting on incoming and outgoing updates.
Route maps associated with the neighbor statement have no affect on incoming updates when matching based on the IP address:
neighbor ip−address route−map route−map−name
Assume in the above diagram we want RTC to learn from AS200 about networks that are local to AS200 and nothing else. Also, we want to set the weight on the accepted routes to 20. We can achieve this with a combination of neighbor and as−path access lists.
Any updates that originate from AS200 have a path information that starts with 200 and ends with 200 and will be permitted. Any other updates will be dropped.
Assume that we want the following:
The neighbor command can be used in conjunction with route maps to perform either filtering or parameter setting on incoming and outgoing updates.
Route maps associated with the neighbor statement have no affect on incoming updates when matching based on the IP address:
neighbor ip−address route−map route−map−name
Assume in the above diagram we want RTC to learn from AS200 about networks that are local to AS200 and nothing else. Also, we want to set the weight on the accepted routes to 20. We can achieve this with a combination of neighbor and as−path access lists.
RTC#
router bgp 300
network 170.10.0.0
neighbor 3.3.3.3 remote−as 200
neighbor 3.3.3.3 route−map stamp in
route−map stamp
match as−path 1
set weight 20
ip as−path access−list 1 permit ^200$
Any updates that originate from AS200 have a path information that starts with 200 and ends with 200 and will be permitted. Any other updates will be dropped.
Assume that we want the following:
- Updates originating from AS200 to be accepted with weight 20.
- Updates originating from AS400 to be dropped.
- Other updates to have a weight of 10.
RTC#
router bgp 300
network 170.10.0.0
neighbor 3.3.3.3 remote−as 200
neighbor 3.3.3.3 route−map stamp in
route−map stamp permit 10
match as−path 1
set weight 20
route−map stamp permit 20
match as−path 2
set weight 10
ip as−path access−list 1 permit ^200$
ip as−path access−list 2 permit ^200 600 .*
The above statement will set a weight of 20 for updates that are local to AS200, and will set a weight of 10 for updates that are behind AS400 and will drop updates coming from AS400.
Use of set as−path prepend Command
In some situations we are forced to manipulate the path information in order to manipulate the BGP decision process. The command that is used with a route map is:
set as−path prependSuppose in the above diagram that RTC is advertising its own network 170.10.0.0 to two different ASs:...
AS100 and AS200. When the information is propagated to AS600, the routers in AS600 will have network reachability information about 150.10.0.0 via two different routes, the first route is via AS100 with PATH (100, 300) and the second one is via AS400 with PATH (400, 200,300). Assuming that all other attributes are the same AS600 will pick the shortest path and will choose the route via AS100.
AS300 will be getting all its traffic via AS100. If we want to influence this decision from the AS300 end we can make the PATH through AS100 look like it is longer than the PATH going through AS400. We can do this by prepending autonomous system numbers to the existing path info advertised to AS100. A common practice is to repeat our own AS number using the following:
RTC#Because of the above configuration, AS600 will receive updates about 170.10.0.0 via AS100 with a PATH information of: (100, 300, 300, 300) which is longer than (400, 200, 300) received from AS100.
router bgp 300
network 170.10.0.0
neighbor 2.2.2.2 remote−as 100
neighbor 2.2.2.2 route−map SETPATH out
route−map SETPATH
set as−path prepend 300 300