REFERENCE

v6.11.0

IPv6 Firewall — Mangle

IPv6 mangle rules: connection/packet/routing marks, DSCP, hop-limit (`/ipv6 firewall mangle`).

Tools

create_ipv6_mangle_rule

Create IPv6 Firewall Mangle Rule · Risk: write

Creates an IPv6 mangle rule (/ipv6 firewall mangle add) — the packet-marking and header-modification table for IPv6 traffic, used to mark connections/packets/routing or change DSCP/hop-limit/MSS. For accept/drop decisions use create_ipv6_filter_rule; for address translation use create_ipv6_nat_rule; for pre-connection-tracking drops use create_ipv6_raw_rule. chain: prerouting/input/forward/output/postrouting. action: mark-connection/mark-packet/mark-routing/change-dscp/change-hop-limit/change-mss/accept/etc. Set the matching new--mark field for mark- actions; keep passthrough=true so later rules can also match the same packet. place_before accepts a rule number or ID (*N) to control insertion position. Returns the created rule's detail including its .id.

ParameterRequiredDefinition
chainYes{"type":"string","enum":["prerouting","input","forward","output","postrouting"]}
actionYes{"type":"string","enum":["accept","drop","mark-connection","mark-packet","mark-routing","change-dscp","change-hop-limit","change-mss","jump","log","passthrough","return","set-priority","sniff-tzsp"]}
src_addressNo{"type":"string"}
dst_addressNo{"type":"string"}
src_portNo{"type":"string"}
dst_portNo{"type":"string"}
protocolNo{"type":"string"}
in_interfaceNoNegatable, e.g. "!ether1" {"type":"string"}
out_interfaceNo{"type":"string"}
in_interface_listNoInterface list, negatable e.g. "!WAN" {"type":"string"}
out_interface_listNo{"type":"string"}
src_address_listNoMatch src in a named list; negate "!name" {"type":"string"}
dst_address_listNoMatch dst in a named list; negate "!name" {"type":"string"}
src_address_typeNoe.g. "unicast", "local", "!local" {"type":"string"}
dst_address_typeNo{"type":"string"}
src_mac_addressNoSource MAC, negatable e.g. "!00:11:..." {"type":"string"}
portNoMatch if src OR dst port matches (with protocol) {"type":"string"}
connection_stateNoe.g. "new", "established,related", "!invalid" {"type":"string"}
connection_typeNoHelper, e.g. "sip", "ftp" {"type":"string"}
connection_bytesNoe.g. "1000000-0" (>1 MB connections) {"type":"string"}
connection_limitNoe.g. "100,128" {"type":"string"}
connection_rateNoe.g. "100k-1M" {"type":"string"}
per_connection_classifierNoPCC for load balancing, e.g. "both-addresses:2/0" {"type":"string"}
tcp_flagsNoRouterOS flag expression e.g. "syn,!ack" {"type":"string"}
tcp_mssNoMatch TCP MSS, e.g. "1400-1500" or "!1460" {"type":"string"}
icmp_optionsNoMatch ICMPv6 type:code, e.g. "128:0" {"type":"string"}
packet_sizeNoe.g. "1500" or "0-500" {"type":"string"}
dscpNoMatch incoming DSCP (0-63) {"type":"string"}
priorityNoMatch packet/queue priority (0-63) {"type":"string"}
ingress_priorityNoMatch ingress (VLAN/MPLS) priority (0-63) {"type":"string"}
ipsec_policyNoe.g. "in,ipsec" or "out,none" {"type":"string"}
nthNoe.g. "2,1" — every 2nd packet {"type":"string"}
randomNoMatch a random N% of packets (1-99) {"type":"string"}
timeNoe.g. "8h-16h,mon,tue,wed,thu,fri" {"type":"string"}
hop_limitNoMatch hop-limit, e.g. "equal:64", "less-than:10" {"type":"string"}
contentNoMatch packets containing this text {"type":"string"}
headersNoMatch IPv6 extension headers, e.g. "hop:contains" {"type":"string"}
limitNoRate limit matcher, e.g. "50,5:packet" {"type":"string"}
dst_limitNoPer-destination rate matcher, e.g. "50,5,dst-address/1m" {"type":"string"}
connection_markNo{"type":"string"}
packet_markNo{"type":"string"}
routing_markNo{"type":"string"}
new_connection_markNo{"type":"string"}
new_packet_markNo{"type":"string"}
new_routing_markNo{"type":"string"}
new_dscpNo0-63, for change-dscp {"type":"string"}
new_hop_limitNoe.g. "decrement", "increment", or "set:64" {"type":"string"}
new_mssNoe.g. "1440" or "clamp-to-pmtu", for change-mss {"type":"string"}
new_priorityNoe.g. "4" or "from-dscp", for set-priority {"type":"string"}
jump_targetNoTarget chain name for action=jump {"type":"string"}
sniff_targetNoTZSP collector IP for action=sniff-tzsp {"type":"string"}
sniff_target_portNoTZSP collector UDP port for sniff-tzsp {"type":"string"}
passthroughNo{"type":"boolean"}
commentNo{"type":"string"}
disabledYes{"default":false,"type":"boolean"}
logYes{"default":false,"type":"boolean"}
log_prefixNo{"type":"string"}
place_beforeNoRule number or ID (*N) to insert before {"type":"string"}

list_ipv6_mangle_rules

List IPv6 Firewall Mangle Rules · Risk: read

Lists IPv6 mangle rules (/ipv6 firewall mangle print) — returns all rules in the mangle table with their IDs, chains, actions, and match criteria. For IPv6 filter use list_ipv6_filter_rules; for IPv6 NAT use list_ipv6_nat_rules; for IPv6 raw use list_ipv6_raw_rules. Optionally filter by chain, action, connection-mark, packet-mark, disabled, invalid, or dynamic status. Rule .id values from this output are required by get_ipv6_mangle_rule, update_ipv6_mangle_rule, remove_ipv6_mangle_rule, move_ipv6_mangle_rule, enable_ipv6_mangle_rule, and disable_ipv6_mangle_rule.

ParameterRequiredDefinition
chain_filterNo{"type":"string"}
action_filterNo{"type":"string"}
connection_mark_filterNo{"type":"string"}
packet_mark_filterNo{"type":"string"}
disabled_onlyYes{"default":false,"type":"boolean"}
invalid_onlyYes{"default":false,"type":"boolean"}
dynamic_onlyYes{"default":false,"type":"boolean"}

get_ipv6_mangle_rule

Get IPv6 Firewall Mangle Rule Details · Risk: read

Retrieves full detail for a single IPv6 mangle rule (/ipv6 firewall mangle print detail where .id=). Use when you need all fields of one specific rule rather than the full table listing. For the full list use list_ipv6_mangle_rules. rule_id takes the .id value (e.g. "*1" or "0") returned by list_ipv6_mangle_rules.

ParameterRequiredDefinition
rule_idYesRule ID from list output e.g. "*1" or "0" {"type":"string"}

update_ipv6_mangle_rule

Update IPv6 Firewall Mangle Rule · Risk: write-idempotent

Updates fields on an existing IPv6 mangle rule (/ipv6 firewall mangle set) — change chain, action, match criteria, mark values, DSCP, hop-limit, or flags without recreating the rule. To toggle enabled state only use enable_ipv6_mangle_rule or disable_ipv6_mangle_rule. rule_id takes the .id from list_ipv6_mangle_rules. Pass "" (empty string) for an optional field to clear it. Returns the updated rule's full detail.

ParameterRequiredDefinition
rule_idYes{"type":"string"}
chainNo{"type":"string"}
actionNo{"type":"string"}
src_addressNo{"type":"string"}
dst_addressNo{"type":"string"}
src_portNo{"type":"string"}
dst_portNo{"type":"string"}
protocolNo{"type":"string"}
in_interfaceNo{"type":"string"}
out_interfaceNo{"type":"string"}
in_interface_listNo{"type":"string"}
out_interface_listNo{"type":"string"}
src_address_listNoNegate with "!name" {"type":"string"}
dst_address_listNoNegate with "!name" {"type":"string"}
src_address_typeNo{"type":"string"}
dst_address_typeNo{"type":"string"}
src_mac_addressNo{"type":"string"}
portNo{"type":"string"}
connection_stateNo{"type":"string"}
connection_typeNo{"type":"string"}
connection_bytesNo{"type":"string"}
connection_limitNo{"type":"string"}
connection_rateNo{"type":"string"}
per_connection_classifierNo{"type":"string"}
tcp_flagsNo{"type":"string"}
tcp_mssNo{"type":"string"}
icmp_optionsNo{"type":"string"}
packet_sizeNo{"type":"string"}
dscpNo{"type":"string"}
priorityNo{"type":"string"}
ingress_priorityNo{"type":"string"}
ipsec_policyNo{"type":"string"}
nthNo{"type":"string"}
randomNo{"type":"string"}
timeNo{"type":"string"}
hop_limitNo{"type":"string"}
contentNo{"type":"string"}
headersNo{"type":"string"}
limitNo{"type":"string"}
dst_limitNo{"type":"string"}
connection_markNo{"type":"string"}
packet_markNo{"type":"string"}
routing_markNo{"type":"string"}
new_connection_markNo{"type":"string"}
new_packet_markNo{"type":"string"}
new_routing_markNo{"type":"string"}
new_dscpNo{"type":"string"}
new_hop_limitNo{"type":"string"}
new_mssNo{"type":"string"}
new_priorityNo{"type":"string"}
jump_targetNo{"type":"string"}
sniff_targetNo{"type":"string"}
sniff_target_portNo{"type":"string"}
passthroughNo{"type":"boolean"}
commentNo{"type":"string"}
disabledNo{"type":"boolean"}
logNo{"type":"boolean"}
log_prefixNo{"type":"string"}

remove_ipv6_mangle_rule

Remove IPv6 Firewall Mangle Rule · Risk: destructive

Permanently deletes an IPv6 mangle rule (/ipv6 firewall mangle remove) — verifies the rule exists first, then removes it. To only deactivate without deleting use disable_ipv6_mangle_rule. rule_id takes the .id from list_ipv6_mangle_rules. Returns confirmation on success or a not-found message if the ID is absent.

ParameterRequiredDefinition
rule_idYes{"type":"string"}

move_ipv6_mangle_rule

Move IPv6 Firewall Mangle Rule · Risk: write-idempotent

Reorders an IPv6 mangle rule to a specific position (/ipv6 firewall mangle move) — mangle rules are evaluated top-down, so position controls which rules fire first. For IPv6 filter reordering use move_ipv6_filter_rule. rule_id takes the .id from list_ipv6_mangle_rules; destination is the 0-based target index. Verifies the rule exists before moving.

ParameterRequiredDefinition
rule_idYes{"type":"string"}
destinationYes0-based target position index {"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}

enable_ipv6_mangle_rule

Enable IPv6 Firewall Mangle Rule · Risk: write-idempotent

Enables a disabled IPv6 mangle rule (/ipv6 firewall mangle set disabled=no) so it participates in packet processing again. To deactivate use disable_ipv6_mangle_rule; to delete permanently use remove_ipv6_mangle_rule. rule_id takes the .id from list_ipv6_mangle_rules. Returns the updated rule's detail.

ParameterRequiredDefinition
rule_idYes{"type":"string"}

disable_ipv6_mangle_rule

Disable IPv6 Firewall Mangle Rule · Risk: write-idempotent

Disables an active IPv6 mangle rule (/ipv6 firewall mangle set disabled=yes) — the rule remains in the table but is skipped during packet processing. To re-enable use enable_ipv6_mangle_rule; to delete permanently use remove_ipv6_mangle_rule. rule_id takes the .id from list_ipv6_mangle_rules. Returns the updated rule's detail.

ParameterRequiredDefinition
rule_idYes{"type":"string"}

On this page