In a firewall filter term, you can specify the action to take if the packet matches the conditions you have configured in the term. To configure a filter action, include the then statement:
- then {
-
action;
-
action-modifiers;
- }
If you omit the then statement or do not specify an action, the packets that match the conditions in the from statement are accepted.
For IPv4 traffic, configure the filter action at the [edit firewall family inet filter filter-name term term-name] hierarchy level. For IPv6 traffic, configure the filter action at the [edit firewall family inet6 filter filter-name term term-name] hierarchy level. For MPLS traffic, configure the filter action at the [edit firewall family mpls filter filter-name term term-name] hierarchy level.
For Layer 2 traffic in a bridging environment, configure the filter action at the [edit firewall family bridge filter filter-name term term-name] hierarchy level. The bridge option is supported only on MX-series routers.
![]() |
Note: We strongly recommend that you always explicitly configure an action in the then statement. |
You can specify one of the following filter actions:
In the filter action statement, you can also specify one or more of the following action modifiers:
![]() |
Note: You must configure tricolor marking policer to set PLP to medium. |
![]() |
Note: The firewall filter syslog action stops logging at a high traffic rate to protect the Routing Engine from an excessive flow of messages. |
You can specify only one filter action statement (or omit it), but you can specify any combination of action modifiers. For the action or action modifier to take effect, all conditions in the from statement must match. If you specify log as one of the actions in a term, this constitutes a termination action; whether any additional terms in the filter are processed depends on the traffic through the filter.
The action modifier operations carry a default accept action. For example, if you specify an action modifier and do not specify an action, the specified action modifier is implemented and the packet is accepted.
![]() |
Note: You cannot configure both the loss-priority and three-color-policer action modifiers for the same firewall filter term. |
Policing uses a specific type of action, known as a policer action. For more information, see Policer Configuration.
For more information about forwarding classes and loss priority, see the JUNOS Class of Service Configuration Guide.
Table 28 shows the complete list of filter actions and action modifiers.
Table 28: Firewall Filter Actions and Action Modifiers
|
Action or Action Modifier |
Description |
|---|---|
| Actions | |
|
accept |
Accept a packet. |
|
count counter-name |
Count the packet in the specified counter. |
|
dscp |
Set the IPv4 or the IPv6 Differentiated Services code point (DSCP) bit to 0. |
|
discard |
Discard a packet silently, without sending an Internet Control Message Protocol (ICMP) message. Discarded packets are available for logging and sampling. |
|
forwarding-class class |
Classify the packet into one of the following forwarding classes: as, assured-forwarding, best-effort, expedited-forwarding, or network-control. |
|
ipsec-sa ipsec-sa |
Use the specified IPsec security association. |
|
load-balance group-name |
Use the specified load-balancing group. |
|
logical-system logical-system-name |
Use the specified logical system. This action is supported for both IPv4 and IPv6 firewall filters. |
|
loss-priority (high | low | medium) |
Set the loss priority level for packets. |
|
out-of-profile |
Indicate that the upper or lower bound of a policer has been met and starvation of queues is possible. The packets are marked as out of the profile of the policer. This action is supported on the J-series Services Router only as part of strict priority queuing. Out-of-profile packets are queued only if the port is not congested. |
|
next term |
Continue to the next term for evaluation. |
|
next-hop-group group-name |
Use the specified next-hop group. |
|
policer policer-name |
Rate-limit packets based on the specified policer. |
|
port-mirror |
Port-mirror the packets. |
|
prefix-action name |
Count or police packets based on the specified action name. |
|
reject message-type |
Discard a packet, sending an ICMPv4 or an ICMPv6 destination unreachable message. Rejected packets can be logged or sampled if you configure either the sample or the syslog action modifier. You can specify one of the following message codes: administratively-prohibited (default), bad-host-tos, bad-network-tos, host-prohibited, host-unknown, host-unreachable, network-prohibited, network-unknown, network-unreachable, port-unreachable, precedence-cutoff, precedence-violation, protocol-unreachable, source-host-isolated, source-route-failed, or tcp-reset. If you specify tcp-reset, a Transmission Control Protocol (TCP) reset is returned if the packet is a TCP packet. Otherwise, nothing is returned. |
|
routing-instance routing-instance |
Specify a routing instance to which packets are forwarded. |
|
sample |
Sample the packets. |
|
topology topology-name |
Specify a topology to which packets are forwarded. |
| Action Modifiers | |
|
count counter-name |
Number of packets passing this filter/term/policer. The name can contain letters, numbers, underscores (_), and hyphens (-), and can be up to 64 characters long. A counter name is specific to the filter that uses it, so all interfaces that use the same filter increment the same counter. |
|
forwarding-class class-name |
Particular forwarding class. |
|
ipsec-sa sa-name |
IPsec SA for the packet. Used with the source-address and destination-address match conditions. |
|
log |
Log the packet header information in a buffer within the Packet Forwarding Engine. You can access this information by issuing the show firewall log command at the command-line interface (CLI). |
|
loss-priority priority |
Set the PLP to low or high. You cannot also configure the three-color-policer action modifier for the same firewall filter term. These two action modifiers are mutually exclusive. |
|
policer policer-name |
Apply rate limits to the traffic using the named policer. |
|
sample |
Sample the traffic on the interface. Use this modifier only when traffic sampling is enabled. For more information, see Traffic Sampling and Forwarding Configuration. |
|
syslog |
Store the packet header information on the Routing Engine and log it to the system log. |
|
three-color-policer policer-name |
Apply rate limits to the traffic using the tricolor marking policer. You cannot also configure the loss-priority action modifier for the same firewall filter term. These two action modifiers are mutually exclusive. |