You can use the table-map command on a per-address-family basis to apply a route map to modify IP attributes of BGP routes that are about to be added to the IP routing table. In these route maps, you can use only the set clauses in Table 19.
Table 19: Set Clauses Supported in Route Maps Applied with the Table-Map Command
|
set distance |
set metric-type |
|
set level |
set route-type |
|
set metric |
set tag |
set distance
- host1(config-route-map)#set distance 5
set level
- host1(config-route-map)#set level level-2
set route-type
- host1(config-route-map)#set route-type internal
table-map
- host1(config-router)#table-map distmet1
- host1(config-router)#exit
- host1(config)#exit
- host1#clear ip routes *
For example, suppose you want to change the distance and metric attributes to particular values for routes advertised by a members of a particular community. The show ip route bgp command indicates that the routes currently in the table have a variety of values for these attributes:
host1#show ip route bgp Protocol/Route type codes: I1- ISIS level 1, I2- ISIS level2, I- route type intra, IA- route type inter, E- route type external, i- metric type internal, e- metric type external, O- OSPF, E1- external type 1, E2- external type2, N1- NSSA external type1, N2- NSSA external type2
Prefix/Length Type Next Hop Dist/Met Intf ------------------ ------- --------------- -------------- ------------ 10.100.3.3/32 Bgp 10.12.12.1 20/0 ATM5/1.12 10.63.42.23/32 Bgp 10.45.2.31 12/5 ATM5/1.14
The following commands demonstrate how you can apply the policy to change these values:
- host1(config)#route-map distmet1 permit 5
- host1(config-route-map)#match community boston42
- host1(config-route-map)#set distance 33
- host1(config-route-map)#set metric 44
- host1(config-route-map)#exit
- host1(config)#router bgp 100
- host1(config-router)#table-map distmet1
- host1(config-router)#exit
- host1(config)#exit
- host1#clear ip routes *
The show ip route bgp command reveals the new values:
host1#show ip route bgp Protocol/Route type codes: I1- ISIS level 1, I2- ISIS level2, I- route type intra, IA- route type inter, E- route type external, i- metric type internal, e- metric type external, O- OSPF, E1- external type 1, E2- external type2, N1- NSSA external type1, N2- NSSA external type2
Prefix/Length Type Next Hop Dist/Met Intf ------------------ ------- --------------- -------------- ------------ 10.100.3.3/32 Bgp 10.12.12.1 33/44 ATM5/1.12 10.63.42.23/32 Bgp 10.45.2.31 33/44 ATM5/1.14