![MikroTik RouterOS v2.9 Reference Manual Download Page 454](http://html1.mh-extra.com/html/mikrotik/routeros-v2-9/routeros-v2-9_reference-manual_1794644454.webp)
•
packet arrival time
•
and much more!
General Filtering Principles
The firewall operates by means of firewall rules. A rule is a definitive form expression that tells the
router what to do with a particular IP packet. Each rule consists of two parts that are the matcher
which matches traffic flow against given conditions and the action which defines what to do with
the mathched packets. Rules are organized in chains for better management.
The filter facility has three default chains: input, forward and output that are responsible for
traffic coming from, throurh and to the router, respectively. New user-defined chains can be added,
as necessary. Since these chains have no default traffic to match, rules with action=jump and
relevant jump-target should be added to one or more of the three default chains.
Filter Chains
As mentioned before, the firewall filtering rules are grouped together in chains. It allows a packet to
be matched against one common criterion in one chain, and then passed over for processing against
some other common criteria to another chain. For example a packet should be matched against the
IP address:port pair. Of course, it could be achieved by adding as many rules with IP
address:port match as required to the forward chain, but a better way could be to add one rule that
matches
traffic
from
a
particular
IP
address,
e.g.:
/ip
firewall
filter
add
src-address=1.1.1.2/32
jump-target="mychain"
and in case of successfull match passes control
over the IP packet to some other chain, id est mychain in this example. Then rules that perform
matching against separate ports can be added to mychain chain without specifying the IP addresses.
• input - used to process packets entering the router through one of the interfaces with the
destination IP address which is one of the router's addresses. Packets passing through the router
are not processed against the rules of the input chain
• forward - used to process packets passing through the router
• output - used to process packets originated from the router and leaving it through one of the
interfaces. Packets passing through the router are not processed against the rules of the output
chain
There are three predefined chains, which cannot be deleted:
When processing a chain, rules are taken from the chain in the order they are listed there from top to
bottom. If a packet matches the criteria of the rule, then the specified action is performed on it, and
no more rules are processed in that chain (the exception is the passthrough action). If a packet has
not matched any rule within the chain, then it is accepted.
Property Description
action ( accept | add-dst-to-address-list | add-src-to-address-list | drop | jump | log | passthrough |
reject | return | tarpit ; default: accept ) - action to undertake if the packet matches the rule
• accept - accept the packet. No action is taken, i.e. the packet is passed through and no more
rules are applied to it
Page 440 of 695
Copyright 1999-2007, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA.
Other trademarks and registred trademarks mentioned herein are properties of their respective owners.