opn_add_firewall_rule
Create firewall filter rules with automatic rollback protection. Rules revert in 60 seconds unless changes are confirmed.
Instructions
Create a new MVC firewall filter rule with savepoint protection.
Use this when you need to add a firewall rule. Changes auto-revert in 60 seconds unless confirmed with opn_confirm_changes.
IMPORTANT: This creates MVC rules (Settings > Firewall > Automation), not legacy GUI rules.
Parameters:
action: 'pass', 'block', or 'reject'
direction: 'in' or 'out'
interface: interface name (e.g. 'lan', 'wan', 'opt1')
ip_protocol: 'inet' (IPv4), 'inet6' (IPv6), or 'inet46' (dual-stack)
protocol: 'any', 'TCP', 'UDP', 'TCP/UDP', 'ICMP', etc.
source_net: source address/network or 'any'
source_not: invert source match (True = NOT source_net)
source_port: source port number or range, or empty for any
destination_net: destination address/network or 'any'
destination_not: invert destination match (True = NOT destination_net, e.g. !Private_Networks)
destination_port: port number or range (e.g. '80', '1000-2000'), or empty for any
gateway: force traffic via specific gateway (e.g. 'WAN_GW') for policy routing, or empty for default
log: enable logging for this rule (default: off)
quick: first-match wins (default: True). Set False for last-match-wins logic
sequence: rule ordering within priority group (default: 1, higher = later)
categories: comma-separated category UUIDs to assign to this rule
description: human-readable rule description
Returns: dict with 'revision' (str), 'uuid' (str), and 'result' (str).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | pass | |
| direction | No | in | |
| interface | No | lan | |
| ip_protocol | No | inet | |
| protocol | No | any | |
| source_net | No | any | |
| source_not | No | ||
| source_port | No | ||
| destination_net | No | any | |
| destination_not | No | ||
| destination_port | No | ||
| gateway | No | ||
| log | No | ||
| quick | No | ||
| sequence | No | ||
| categories | No | ||
| description | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||