Route maps
Route maps are a powerful tool to apply custom actions to dynamic routing protocols based on specific conditions. They are used primarily in BGP to manipulate routes advertised by the FortiGate (route-map-out) or received routes from other BGP routers (route-map-in).
Route maps can be used in OSPF for conditional default-information-originate, filtering external routes, or matching specific routes for redistribution. Similarly, route maps can be used by RIP to match routes for redistribution.
A route map may have multiple rules that are processed in the ascending order of their rule ID numbers. The rule ID number determines the order of evaluation, where each rule has an action to permit or deny. If the action is not set, the default action is to permit.
When new are added to an existing route map, they may be shown at the end of the configuration list, regardless of their assigned rule ID. This visual arrangement does not impact functionality; FortiOS processes the rules according to their numerical IDs, and not their position in the route map configuration. For example, if a new rule with ID 15 is added to a route map that already contains rules with IDs 10, 20, 30, and 40, the new rule might appear at the bottom of the list in the configuration. Despite this placement, FortiOS will process the rules in the ascending order of Rule ID number: 10, 15, 20, 30, then 40.
To enhance readability and maintain an organized configuration, it is recommended to arrange the rules sequentially by their IDs. This can be achieved by deleting and re-adding the rules in the desired order during a maintenance window to avoid traffic disruption. Alternatively, using a text editor to reorder the rules before applying them to the FortiOS configuration can streamline this process.
The rules have criteria for matching a route based on various attributes, or setting attributes based on a matched route. For example, a route map can be used to match BGP routes with a certain community string, and then set an AS path to the matching route. This can be applied to a BGP neighbor by configuring the route map in the settings for that neighbor.
To configure a route map that matches criteria based on other routing objects:
config router route-map
edit <name>
config rule
edit <id>
set action {permit | deny}
set match-as-path <string>
set match-community <string>
set match-ip-address <string>
set match-ip6-address <string>
set match-ip-nexthop <string>
set match-ip6-nexthop <string>
next
end
next
end
|
match-as-path <string> |
Match a BGP AS path list. |
|
match-community <string> |
Match a BGP community list. |
|
match-ip-address <string> |
Match an IPv4 address permitted by |
|
match-ip6-address <string> |
Match an IPv6 address permitted by |
|
match-ip-nexthop <string> |
Match a next hop IPv4 address passed by |
|
match-ip6-nexthop <string> |
Match a next hop IPv6 address passed by |
Route maps can be used by various routing protocols, such as RIP, OSPF, and BGP.
To use a route map with RIP:
config router rip
config redistribute
edit <name>
set routemap <string>
next
end
end
To use a route map with OSPF:
config router ospf
set default-information-route-map <string>
set distribute-route-map-in <string>
config redistribute <string>
set routemap <string>
end
end
|
default-information-route-map <string> |
Enter the default information route map. |
|
distribute-route-map-in <string> |
Enter the route map to filter incoming external routes. |
|
redistribute <string> |
Configure the redistribute protocol. |
To use a route map with BGP:
config router bgp
config neighbor
edit <ip>
set route-map-in <string>
set route-map-in6 <string>
set route-map-in-vpnv4 <string>
set route-map-out <string>
set route-map-out-preferable <string>
set route-map-out6 <string>
set route-map-out6-preferable <string>
set route-map-out-vpnv4 <string>
set route-map-out-vpnv4-preferable <string>
next
end
config network
edit <id>
set prefix <IP/netmask>
set route-map <string>
next
end
config redistribute <string>
set route-map <string>
end
end
|
route-map-in <string> |
Enter the IPv4 inbound route map filter. |
|
route-map-in6 <string> |
Enter the IPv6 inbound route map filter. |
|
route-map-in-vpnv4 <string> |
Enter the VPNv4 inbound route map filter. |
|
route-map-out <string> |
Enter the IPv4 outbound route map filter. |
|
route-map-out-preferable <string> |
Enter the IPv4 outbound route map filter if the peer is preferred. |
|
route-map-out6 <string> |
Enter the IPv6 outbound route map filter. |
|
route-map-out6-preferable <string> |
Enter the IPv6 outbound route map filter if the peer is preferred. |
|
route-map-out-vpnv4 <string> |
Enter the VPNv4 outbound route map filter. |
|
route-map-out-vpnv4-preferable <string> |
Enter the VPNv4 outbound route map filter if the peer is preferred. |
|
route-map <string> |
Enter the route map to modify the generated route. |
|
redistribute <string> |
Configure the redistribute protocol. |
To use a route map with BGP conditional advertisement:
config router bgp
set as <AS_number>
config neighbor
edit <ip>
set remote-as <AS_number>
config conditional-advertise
edit <advertise-routemap>
set condition-routemap <name1>, <name2>, ...
set condition-type {exist | non-exist}
next
end
next
end
end
|
<advertise-routemap> |
Edit the advertising route map. |
|
condition-routemap <name1>, <name2>, ... |
Enter the list of conditional route maps. |