routeros-firewall
Installation
SKILL.md
RouterOS Firewall
Rule Ordering — Sequential, Not Priority-Based
Rules are evaluated top-to-bottom — first match wins. This is the biggest source of iptables confusion.
place-before=0inserts at the top; defaultaddappends at the bottom- An
action=acceptrule must appear BEFORE anyaction=dropfor the same traffic - Non-terminal actions do NOT stop evaluation:
action=add-src-to-address-list,action=add-dst-to-address-list,action=log, and any rule withpassthrough=yescontinue to the next rule. Adroprule below anadd-src-to-address-listwill still fire.
# WRONG — drop fires before accept can match
/ip/firewall/filter/add chain=input action=drop
/ip/firewall/filter/add chain=input src-address=10.0.0.1 action=accept
# CORRECT — accept first, drop catches the rest
/ip/firewall/filter/add chain=input src-address=10.0.0.1 action=accept place-before=0
/ip/firewall/filter/add chain=input action=drop