When you use a route map to set the local preference you have more flexibility in selecting routes for which you can set a local preference based on many criteria, including AS. In the previous section, all updates received by router SanJose were set to a local preference of 200.
Using a route map, you can specifically assign a local preference for routes from AS 17 that pass through AS 293.
The following commands configure router SanJose.
- host2(config-router)#router bgp 873
- host2(config-router)#neighbor 10.2.2.3 remote-as
873
- host2(config-router)#neighbor 10.5.5.1 remote-as
17
- host2(config-router)#neighbor 10.5.5.1 route-map
10 in
- host2(config-router)#exit
- host2(config)#ip as-path access-list 1 permit
^17 293$
- host2(config)#route-map 10 permit 10
- host2(config-route-map)#match as-path 1
- host2(config-route-map)#set local-preference
200
- host2(config-route-map)#exit
- host2(config)#route-map 10 permit 20
Router SanJose sets the local-pref attributes to 200 for routes originating in AS 293 and passing last through AS 17. All other routes are accepted (as defined in instance 20 of the route map 10), but their local preference remains at the default value of 100, indicating a less-preferred path.