Prefix Lists

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

General Information

Summary

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

Specifications

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

Related Documents

Description

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.

Setup

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

Notes

An empty prefix list matches all prefixes

Example

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: 0.0.0.0/0) - 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

Notes

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=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.

Example

To accept the routes to the 172.16.0.0/16 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=172.16.0.0/16 \
\... prefix-length=16-24
[admin@MikroTik] routing prefix-list list cybernet> print
  # PREFIX             PREFIX-LENGTH ACTION
  0 172.16.0.0/16      16-24         accept
[admin@MikroTik] routing prefix-list list cybernet>