Route Map Examples

Requirements:
-
Redistribute interface route for eth3 into OSPF.
-
Set the OSPF route-type to AS type-2 with cost 20.
Syntax:
set routemap direct-to-ospf id 10 on set routemap direct-to-ospf id 10 match interface eth3 set routemap direct-to-ospf id 10 match protocol direct set routemap direct-to-ospf id 10 action route-type type-2 set routemap direct-to-ospf id 10 action metric value 20 set ospf export-routemap direct-to-ospf preference 1 on |

Requirements:
-
Do not accept routes from RIP neighbor 192.0.2.3.
-
Accept routes from neighbor 192.0.2.4 as is.
-
For all other routes increment the metric by 2.
Syntax:
set routemap rip-in id 10 onset routemap rip-in id 10 restrict set routemap rip-in id 10 match neighbor 192.0.2.3 set routemap rip-in id 15 on set routemap rip-in id 15 match neighbor 192.0.2.4 set routemap rip-in id 20 on set routemap rip-in id 20 action metric add 2 set rip import-routemap rip-in preference 1 on |

Requirements:
-
Redistribute all static routes into BGP AS group 400.
-
Set the MED value to 100.
-
Prepend the AS number to the aspath 4 times.
-
If the route belongs to the prefix 192.0.2.0/8, do not redistribute.
-
Send all BGP routes whose aspath matches the regular expression (100 200+) and set the MED value to 200.
Syntax:
set routemap static-to-bgp id 10 onset routemap static-to-bgp id 10 restrict set routemap static-to-bgp id 10 match protocol static set routemap static-to-bgp id 10 match network 192.0.2.0/8 all set routemap static-to-bgp id 15 on set routemap static-to-bgp id 15 match protocol static set routemap static-to-bgp id 15 action metric 100 set routemap static-to-bgp id 15 action aspath-prepend-count 4 set routemap bgp-out id 10 on set routemap bgp-out id 10 match aspath-regex "(100 200+)" origin any set routemap bgp-out id 10 action metric 200 set bgp external remote-as 400 export-routemap bgp-out preference 1 family inet on set bgp external remote-as 400 export-routemap static-to-bgp preference 2 family inet on |
|
Note - There is no need for a match protocol statement for routes that belong to the same protocol. |