Fortinet black logo

Administration Guide

Route maps

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 from the top down. Each rule has an action to permit or deny. If the action is not set, the default action is to permit. 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 setting 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 access-list or prefix-list.

match-ip6-address <string>

Match an IPv6 address permitted by access-list6 or prefix-list6.

match-ip-nexthop <string>

Match a next hop IPv4 address passed by access-list or prefix-list.

match-ip6-nexthop <string>

Match a next hop IPv6 address passed by access-list6 or prefix-list6.

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.

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 from the top down. Each rule has an action to permit or deny. If the action is not set, the default action is to permit. 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 setting 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 access-list or prefix-list.

match-ip6-address <string>

Match an IPv6 address permitted by access-list6 or prefix-list6.

match-ip-nexthop <string>

Match a next hop IPv4 address passed by access-list or prefix-list.

match-ip6-nexthop <string>

Match a next hop IPv6 address passed by access-list6 or prefix-list6.

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.