Routing Prefix Lists

Document revision 21-Aug-2002
This document applies to MikroTik RouterOS V2.6

Overview

Prefix lists are used to filter routes received from or sent to other routers.

Topics covered in this manual:

Prefix List Installation on the MikroTik RouterOS

The plist-2.6.y.npk package is required. The package can be downloaded from MikroTik’s web page www.mikrotik.com. To install the package, please upload one to the router with ftp and reboot. You may check to see if the package is installed with the command:

[admin@MikroTik] > system package print
Flags: I - invalid
  #   NAME                  VERSION              BUILD-TIME           UNINSTALL
  0   system                2.6beta4             aug/09/2002 20:22:14 no
  1   rip                   2.6beta4             aug/09/2002 20:33:41 no
  2   ppp                   2.6beta4             aug/09/2002 20:28:01 no
  3   plist                 2.6beta4             aug/09/2002 20:32:58 no
  4   pppoe                 2.6beta4             aug/09/2002 20:29:18 no
  5   pptp                  2.6beta4             aug/09/2002 20:28:43 no
  6   ssh                   2.6beta4             aug/09/2002 20:25:31 no
  7   advanced-tools        2.6beta4             aug/09/2002 20:53:37 no
  7   bgp                   2.6beta4             aug/09/2002 20:34:22 no
  9   ipsec                 2.6beta4             aug/09/2002 20:24:51 no
 10   ospf                  2.6beta4             aug/09/2002 20:34:08 no
[admin@MikroTik] >

Prefix List Setup

Filtering by prefix list involves matching the prefixes of routes with those listed in the prefix list. When there is a match, the route is used. The prefix lists are used when specifying the BGP peers under /routing bgp peer or RIP interfaces under /routing rip interface. An empty prefix list permits all prefixes.

To add a prefix list, use the /routing prefix-list add command, for example:

[admin@MikroTik] routing prefix-list> add name=cybernet
[admin@MikroTik] routing prefix-list> print
  # NAME                                                         DEFAULT-ACTION
  0 cybernet                                                     accept
[admin@MikroTik] routing prefix-list>

Argument description:

name - Name for the prefix list
default-action - Default action for all members of this list (accept, reject)

The list members can be added using the /routing prefix-list list _listname_ add command, for example:

[admin@MikroTik] routing prefix-list> list cybernet
[admin@MikroTik] routing prefix-list list cybernet> add prefix=172.16.0.0 \
\... prefix-length=16
[admin@MikroTik] routing prefix-list list cybernet> print
  # PREFIX             PREFIX-LENGTH ACTION
  0 172.16.0.0/0       16            accept
[admin@MikroTik] routing prefix-list list cybernet>

Argument description:

prefix - network prefix, e.g., 198.168.0.0
prefix-length - length (range) of the network prefix in bits, e.g., 16-24
action - action for the list member (accept, reject)

You can add as many members to the list as required.

Note that there are two different values to match - prefix (i.e. destination address of the route applying the network mask) and prefix length. Prefix length match network mask of the received route. For example:

if prefix=172.16.0.0/16 and prefix=length=16-24, then received route for 172.16.24.0/24 will match, but route for 172.16.24.0/25 will not.


© Copyright 1999-2002, MikroTik