Prefix Lists

Document revision:1.2 (Wed Mar 24 12:31:52 GMT 2004)
Applies to: V2.8

General Information


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


Packages required: routing
License required: Level1
Submenu level: /routing prefix-list
Hardware usage: Not significant

Related Documents


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.

To match a prefix-list entry, a route should have its prefix (i.e. destination address) matching prefix property of the entry, and it should have the length of its prefix (i.e. mask of destination address) matching prefix-length property of the entry.


Submenu level: /routing prefix-list

Property Description

name (name; default: "") - a name for the prefix list

default-action (accept | reject; default: accept) - default action for all members of the list


An empty prefix list matches all prefixes


To add a cybernet list that rejects the routes by default:

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

Prefix List Rules

Submenu level: /routing prefix-list list <listname>

Property Description

prefix (IP address mask; default: - network prefix to match

prefix-length (integer; default: 0-32) - length (range) of the network prefix in bits

action (accept | reject; default: accept) - action to perform on list member


There are two different values to match - prefix (i.e. destination address of the route applying the network mask) and prefix length. Prefix length matches network mask of the received route.

For example, if prefix= and prefix-length=16-24, then received route for will match, but route for will not.


To accept the routes to the network and any of it's subnetworks that has their network mask between 16 and 24:

[admin@MikroTik] routing prefix-list> list cybernet
[admin@MikroTik] routing prefix-list list cybernet> add prefix= \
\... prefix-length=16-24
[admin@MikroTik] routing prefix-list list cybernet> print
  0      16-24         accept
[admin@MikroTik] routing prefix-list list cybernet>