Understanding Firewall Filter Match Conditions
Learn how to configure match conditions for firewall filters on Juniper switches.
Before configuring firewall filter terms, understand how match conditions work and how to specify different match types for desired filtering results.
Filter Match Conditions
In the from statement of a firewall filter term, specify conditions that trigger actions in the then statement. All conditions must match for the action to occur. The order of conditions is unimportant.
[edit firewall family family-name filter filter-name term term-name from] user@switch# set protocol [tcp|udp] user@switch# set source-address 10.1.1.1 user@switch# set source-address 10.1.1.2
Unlike traditional Junos OS firewall filters:
- Individual conditions cannot contain value lists (ranges/multiple addresses)
- Conditions cannot be negated using
except
Numeric Match Conditions
Match numeric fields (port/protocol numbers) using:
- Single number:
source-port 25 - Text synonym:
source-port http
Specify multiple values:
source-port 22; source-port 23;
Interface Match Conditions
Match interfaces using these formats:
interface ge-0/0/1; interface ge-0/0/6.0; interface ge-0/*/1;
QFX Series requirement: Always include logical unit (ge-0/0/6.0). Wildcards allowed: ge-0/0/6.*
EX Series note: Logical units not required for port/VLAN interfaces, but may be used for router interfaces (ge-0/1/0.0).
IP Address Match Conditions
Match IP prefixes:
destination-address 10.2.1.0/24;
Omitted prefix-length defaults to /32:
set destination-address 10.0.0.0 → 10.0.0.0/32
MAC Address Match Conditions
Match MAC addresses using these formats:
destination-mac-address 00:11:22:33:44:55; destination-mac-address 0011.2233.4455; destination-mac-address 001122334455;
All formats resolve to standard 00:11:22:33:44:55.
Bit-Field Match Conditions
Match specific bits in packet fields:
tcp-flags "rst"; tcp-flags "syn&!ack"; tcp-flags tcp-initial;
| Operator | Description |
|---|---|
! |
Negation |
& |
Logical AND |
| |
Logical OR |
Operator usage guidelines:
- Enclose values in quotes:
"syn|fin" - No spaces between operators
- Maximum two values per OR operation