Fortinet black logo

Administration Guide

Prefix lists

Prefix lists

Similar to access lists, prefix lists are simple lists used for filtering routes based on a prefix consisting of an IPv4 or IPv6 address and netmask, but they use settings to specify the minimum (ge, greater than or equal) and maximum (le, less than or equal) prefix length to be matched. For example, a prefix of 10.0.0.0/8 with a ge of 16 will match anything in the 10.0.0.0/8 network with /16 or above; 10.10.0.0/16 will match, and 10.10.0.0/12 will not match.

To configure an IPv4 prefix list:
config router prefix-list
    edit "prefix-list1"
        config rule
            edit 1
                set action {permit | deny}
                set prefix <IPv4_address>
                set ge <integer>
                set le <integer>
            next
        end
    next
end
To configure an IPv6 prefix list:
config router prefix-list6
    edit "prefix-list-IPv6"
        config rule
            edit 1
                set action {permit | deny}
                set prefix6 <IPv6_address>
                set ge <integer>
                set le <integer>
            next
        end
    next
end

In RIP, an prefix list can be used in the distribute-list setting to filter received or advertised routes.

To use a prefix list in RIP:
config router rip
    config distribute-list
        edit <id>
            set listname <string>
        next
    end
end

listname <string>

Enter the distribute access or prefix list name.

In OSPF, a prefix list can be used in the distribute-list-in setting to act as a filter to prevent a certain route from being inserted into the routing table.

To use a prefix list in OSPF:
config router ospf
    set distribute-list-in <string>
end

distribute-list-in <string>

Enter the filter for incoming routes.

In BGP, a prefix list can be used to filter updates from a neighbor or to a neighbor.

To use a prefix list in BGP:
config router bgp
    config neighbor
        edit <ip>
            set prefix-list-in <string>
            set prefix-list-in6 <string>
            set prefix-list-in-vpnv4 <string>
            set prefix-list-out <string>
            set prefix-list-out6 <string>
            set prefix-list-out-vpnv4 <string>
        next
    end
end

prefix-list-in <string>

Enter the IPv4 inbound filter for updates from this neighbor.

prefix-list-in6 <string>

Enter the IPv6 inbound filter for updates from this neighbor.

prefix-list-in-vpnv4 <string>

Enter the inbound filter for VPNv4 updates from this neighbor.

prefix-list-out <string>

Enter the IPv4 outbound filter for updates to this neighbor.

prefix-list-out6 <string>

Enter the IPv6 outbound filter for updates to this neighbor.

prefix-list-out-vpnv4 <string>

Enter the outbound filter for VPNv4 updates to this neighbor.

In a route map, a prefix list can be used to match IP addresses and next hops.

To use a prefix list in a route map:
config router route-map
    edit <name>
        config rule
            edit <id>
                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-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.

Prefix lists

Similar to access lists, prefix lists are simple lists used for filtering routes based on a prefix consisting of an IPv4 or IPv6 address and netmask, but they use settings to specify the minimum (ge, greater than or equal) and maximum (le, less than or equal) prefix length to be matched. For example, a prefix of 10.0.0.0/8 with a ge of 16 will match anything in the 10.0.0.0/8 network with /16 or above; 10.10.0.0/16 will match, and 10.10.0.0/12 will not match.

To configure an IPv4 prefix list:
config router prefix-list
    edit "prefix-list1"
        config rule
            edit 1
                set action {permit | deny}
                set prefix <IPv4_address>
                set ge <integer>
                set le <integer>
            next
        end
    next
end
To configure an IPv6 prefix list:
config router prefix-list6
    edit "prefix-list-IPv6"
        config rule
            edit 1
                set action {permit | deny}
                set prefix6 <IPv6_address>
                set ge <integer>
                set le <integer>
            next
        end
    next
end

In RIP, an prefix list can be used in the distribute-list setting to filter received or advertised routes.

To use a prefix list in RIP:
config router rip
    config distribute-list
        edit <id>
            set listname <string>
        next
    end
end

listname <string>

Enter the distribute access or prefix list name.

In OSPF, a prefix list can be used in the distribute-list-in setting to act as a filter to prevent a certain route from being inserted into the routing table.

To use a prefix list in OSPF:
config router ospf
    set distribute-list-in <string>
end

distribute-list-in <string>

Enter the filter for incoming routes.

In BGP, a prefix list can be used to filter updates from a neighbor or to a neighbor.

To use a prefix list in BGP:
config router bgp
    config neighbor
        edit <ip>
            set prefix-list-in <string>
            set prefix-list-in6 <string>
            set prefix-list-in-vpnv4 <string>
            set prefix-list-out <string>
            set prefix-list-out6 <string>
            set prefix-list-out-vpnv4 <string>
        next
    end
end

prefix-list-in <string>

Enter the IPv4 inbound filter for updates from this neighbor.

prefix-list-in6 <string>

Enter the IPv6 inbound filter for updates from this neighbor.

prefix-list-in-vpnv4 <string>

Enter the inbound filter for VPNv4 updates from this neighbor.

prefix-list-out <string>

Enter the IPv4 outbound filter for updates to this neighbor.

prefix-list-out6 <string>

Enter the IPv6 outbound filter for updates to this neighbor.

prefix-list-out-vpnv4 <string>

Enter the outbound filter for VPNv4 updates to this neighbor.

In a route map, a prefix list can be used to match IP addresses and next hops.

To use a prefix list in a route map:
config router route-map
    edit <name>
        config rule
            edit <id>
                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-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.