add_firewall_rule
Adds a MikroTik firewall filter rule with matching conditions, actions, and placement before an existing rule ID to prevent dead rules after a final drop.
Instructions
Add a firewall filter rule.
Order decides everything in a RouterOS firewall: the first matching
rule wins. A new rule appended after a final drop is dead code, so
set place_before unless the end of the chain is genuinely what you
want.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| log | No | ||
| chain | Yes | 'input', 'forward', 'output', or a custom chain. | |
| action | Yes | What to do with matching traffic. | |
| comment | No | Strongly recommended — an uncommented rule is very hard to audit later. | |
| disabled | No | Add the rule disabled, to position it before it takes effect. | |
| dst_port | No | ||
| protocol | No | ||
| src_port | No | ||
| log_prefix | No | ||
| dst_address | No | ||
| src_address | No | ||
| in_interface | No | ||
| place_before | No | Rule 'id' to insert before. Without it the rule lands at the end of the list, which for a chain ending in a drop rule usually means it never matches. | |
| out_interface | No | ||
| connection_state | No | Comma-separated, e.g. 'established,related'. | |
| dst_address_list | No | ||
| src_address_list | No | ||
| in_interface_list | No | ||
| out_interface_list | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |