Firewall Filter Match Conditions for IPv4 Traffic
You can configure a firewall filter with match conditions for Internet Protocol version 4
(IPv4) traffic (family inet).
Table 1 describes the match-conditions you can configure
at the [edit firewall family inet filter filter-name term
term-name from] hierarchy level.
|
Match Condition |
Description |
|
|---|---|---|
|
|
Match the IPv4 source or destination address field unless the
|
|
|
|
(M Series routers, except M120 and M320) Match the IPsec authentication header (AH) security parameter index (SPI) value. |
|
|
|
(M Series routers, except M120 and M320) Do not match the IPsec AH SPI value. |
|
|
|
Match the IPv4 destination address field unless the
You cannot specify both the |
|
|
|
Match one or more specified destination class names (sets of destination prefixes grouped together and given a class name). For more information, see Firewall Filter Match Conditions Based on Address Classes. |
|
|
|
Do not match one or more specified destination class names. For
details, see the |
|
|
|
Match the UDP or TCP destination port field. You cannot specify both the When configuring port based matches
you must also configure the In place of the numeric value, you can specify
one of the following text synonyms (the port numbers are also
listed): |
|
|
|
Match source or destination ports in the specified named port list. |
|
|
|
Do not match the UDP or TCP destination port field. For details, see
the |
|
|
destination-port-list port-list-name |
Match destination ports in the specified named port list |
|
|
|
Match destination prefixes in the specified
list unless the
Specify the name of a prefix list defined at the |
|
|
|
Match the Differentiated Services code point (DSCP). The DiffServ protocol uses the type-of-service (ToS) byte in the IP header. The most significant 6 bits of this byte form the DSCP. For more information, see Understanding How Behavior Aggregate Classifiers Prioritize Trusted Traffic. Support was added for filtering on Differentiated Services Code Point (DSCP) and forwarding class for Routing Engine sourced packets, including IS-IS packets encapsulated in generic routing encapsulation (GRE). Subsequently, when upgrading from a previous version of Junos OS where you have both a class of service (CoS) and firewall filter, and both include DSCP or forwarding class filter actions, the criteria in the firewall filter automatically takes precedence over the CoS settings. The same is true when creating new configurations; that is, where the same settings exist, the firewall filter takes precedence over the CoS, regardless of which was created first. You can specify a numeric value from In place of the numeric value, you can specify one of the following text synonyms (the field values are also listed):
|
|
|
|
Do not match on the DSCP number. For more information, see the
|
|
|
|
Match the IPsec encapsulating security payload (ESP) SPI value. Match on this specific SPI value. You can specify the ESP SPI value in hexadecimal, binary, or decimal form. |
|
|
|
Match the IPsec ESP SPI value. Do not match on this specific SPI value. |
|
|
|
Match if the packet is the first fragment of a fragmented packet.
Do not match if the packet is a trailing fragment of a fragmented
packet. The first fragment of a fragmented packet has a fragment
offset value of This match condition is an alias for the bit-field match condition
To match both first and trailing fragments, you can use two terms
that specify different match conditions:
|
|
|
first-byte-of-payload |
Match first byte of payload value. Match condition can only be applied in the ingress direction. Does not work on the egress binding of the firewall filter. Supported on INET, INET6 and ANY firewall filter families only. Not supported on FFT filter and egress FLT filter. |
|
|
first-byte-of-payload-except |
Do not match specified first byte of payload value. Match condition can only be applied in the ingress direction. Does not work on the egress binding of the firewall filter. Supported on INET, INET6 and ANY firewall filter families only. Not supported on FFT filter and egress FLT filter. |
|
|
|
|
Length of the data to be matched in bits, not needed for string input (0..128) |
|
|
Bit offset after the (match-start + byte) offset (0..7) |
|
|
|
Byte offset after the match start point |
|
|
|
Select a flexible match from predefined template field |
|
|
|
Mask out bits in the packet data to be matched |
|
|
|
Start point to match in packet |
|
|
|
Value data/string to be matched |
|
|
|
|
Length of the data to be matched in bits (0..32) |
|
|
Bit offset after the (match-start + byte) offset (0..7) |
|
|
|
Byte offset after the match start point |
|
|
|
Select a flexible match from predefined template field |
|
|
|
Start point to match in packet |
|
|
|
Range of values to be matched |
|
|
|
Do not match this range of values |
|
|
|
Match the forwarding class of the packet. Specify For information about forwarding classes and router-internal output queues, see Understanding How Forwarding Classes Assign Classes to Output Queues. |
|
|
|
Do not match the forwarding class of the packet. For details, see the
|
|
|
|
(Ingress only) Match the three-bit IP fragmentation flags field in the IP header. In place of the numeric field value, you can specify one of the
following keywords (the field values are also listed):
|
|
|
|
Match the 13-bit fragment offset field in the IP header. The value is
the offset, in 8-byte units, in the overall datagram message to the
data fragment. Specify a numeric value, a range of values, or a set
of values. An offset value of The To match both first and trailing fragments, you can use two terms
that specify different match conditions
( |
|
|
|
Do not match the 13-bit fragment offset field. |
|
|
|
Match the gre-key field. The GRE key field is a 4 octet number inserted by the GRE encapsulator. It is an optional field for use in GRE encapsulation. The range can be a single GRE key number or a range of key numbers. For MX Series routers with MPCs, initialize new firewall filters that include this condition by walking the corresponding SNMP MIB. |
|
|
|
Match the ICMP message code field. Note: When using this match condition, you should
also configure the
protocol icmp match condition in
the same term for proper packet classification.term match-icmp-unreachable {
from {
protocol icmp;
icmp-type destination-unreachable;
icmp-code host-unreachable;
}
}
In place of the numeric value, you can specify one of the following text synonyms (the field values are also listed). The keywords are grouped by the ICMP type with which they are associated:
|
|
|
|
Do not match the ICMP message code field. For details, see the
|
|
|
|
Match the ICMP message type field. Note:
When using this match condition, you should also configure the protocol icmp match condition in the same term for proper packet classification. term match-icmp-echo {
from {
protocol icmp;
icmp-type echo-request;
}
}
Note:
You must configure the In place of the numeric value, you can specify
one of the following text synonyms (the field values are also
listed): |
|
|
|
Do not match the ICMP message type field. For details, see the
|
|
|
|
Match the interface on which the packet was received. Note:
If you configure this match condition with an interface that does not exist, the term does not match any packet. |
|
|
|
Match the logical interface on which the packet was received to the
specified interface group or set of interface groups. For
To assign a logical interface to an interface group
For more information, see Filtering Packets Received on a Set of Interface Groups Overview. |
|
|
|
Do not match the logical interface on which the packet was received
to the specified interface group or set of interface groups. For
details, see the |
|
|
|
Match the interface on which the packet was received to the specified interface set. To define an interface set, include the
For more information, see Filtering Packets Received on an Interface Set Overview. |
|
|
|
Match the 8-bit IP option field, if present, to the specified value or list of values. In place of a numeric value, you can specify one of the following
text synonyms (the option values are also listed):
To match any value for the IP option, use the text synonym
For example, the match condition
For most interfaces, a filter term that specifies an
|
|
|
|
Do not match the IP option field to the specified value or list of
values. For details about specifying the
|
|
|
|
Using this condition causes a match if the More Fragments flag is enabled in the IP header and if the fragment offset is not zero. On MX Series Routers, Note:
To match both first and trailing fragments, you can use two terms
that specify different match conditions
( |
|
|
|
Match the packet loss priority (PLP) level. Specify a single level or multiple levels: |
|
|
|
Do not match the PLP level. For details, see the
|
|
|
|
Match the length of the received packet, in bytes. The length refers only to the IP packet, including the packet header, and does not include any Layer 2 encapsulation overhead. You can also specify a range of values to be matched. |
|
|
|
Do not match the length of the received packet, in bytes. For
details, see the |
|
payload-source-ipv4-address
source IPv4 address |
Match the payload of the packet with this source IPv4 address. |
|
payload-destination-ipv4-address
destination IPv4 address |
Match the payload of the packet with this destination IPv4 address. |
|
payload-source-mac-address
source mac address |
Match the payload of the packet with this source MAC address. |
|
payload-destination-mac-address
destination mac address |
Match the payload of the packet with this destination MAC address. |
|
|
|
Match traffic based on the applied
|
|
|
|
Match the UDP or TCP source or destination port field. If you configure this match condition, you cannot
configure the When configuring port based matches
you must also configure the In place of the numeric value, you can specify
one of the text synonyms listed under
|
|
|
|
Do not match either the source or destination UDP or TCP port field.
For details, see the |
|
|
|
Match the IP precedence field. In place of the numeric field value, you can specify one of the
following text synonyms (the field values are also listed):
|
|
|
|
Do not match the IP precedence field. In place of the numeric field value, you can specify one of the
following text synonyms (the field values are also listed):
|
|
|
|
Match the prefixes of the source or destination address fields to the
prefixes in the specified list
unless the The prefix list is defined at the |
|
|
|
Match the IP protocol type field. In place of the numeric value, you
can specify one of the following text synonyms (the field values are
also listed): |
|
|
|
Do not match the IP protocol type field. In place of the numeric
value, you can specify one of the following text synonyms (the field
values are also listed): |
|
|
|
Match the radio-access technology (RAT) type specified in the 8-bit Tech-Type field of Proxy Mobile IPv4 (PMIPv4) access technology type extension. The technology type specifies the access technology through which the mobile device is connected to the access network. Specify a single value, a range of values, or a set of values. You can specify a technology type as a numeric value from 0 through 255 or as a system keyword.
|
|
|
|
Do not match the RAT Type. |
|
|
|
Match traffic based on the forwarding redirect reason. You can specify individual values or multiple values within square brackets. Supported values:
Syntax:
Use cases:
Examples: term match-billing {
from {
redirect-reason aoc;
}
}
term match-prepaid {
from {
redirect-reason aolb;
}
}
term match-inspection {
from {
redirect-reason dpi;
}
}
term match-multiple {
from {
redirect-reason [ aoc aolb ];
}
}
|
|
|
|
Match a packet received from a filter where a
|
|
|
|
Match the IPv4 address of the source node sending the packet unless
the You cannot specify both the |
|
|
|
Match one or more specified source class names (sets of source prefixes grouped together and given a class name). For more information, see Firewall Filter Match Conditions Based on Address Classes. |
|
|
|
Do not match one or more specified source class names. For details,
see the |
|
|
|
Match the UDP or TCP source port field. You cannot specify the When configuring port based matches
you must also configure the In place of the numeric value, you can specify
one of the text synonyms listed with the |
|
|
|
Do not match the UDP or TCP source port field. For details, see the
|
|
|
|
Match source ports in the specified named port list. |
|
|
|
Match source prefixes in the specified
list unless the
Specify the name of a prefix list defined at the |
|
|
|
Match TCP packets of an established TCP session (packets other than
the first packet of a connection). This is an alias for
This match condition does not implicitly check that the protocol is
TCP. To check this, specify the |
|
|
|
Match one or more of the low-order 6 bits in the 8-bit TCP flags field in the TCP header. To specify individual bit fields, you can specify the following text synonyms or hexadecimal values:
In a TCP session, the SYN flag is set only in the initial packet sent, while the ACK flag is set in all packets sent after the initial packet. You can string together multiple flags using the bit-field logical operators. For combined bit-field match conditions, see the
If you configure this match
condition, we recommend that you also configure the For IPv4 traffic only, this match condition does not implicitly check
whether the datagram contains the first fragment of a fragmented
packet. To check for this condition for IPv4 traffic only, use the
|
|
|
|
Match the initial packet of a TCP connection. This is an alias for
This condition does not implicitly check that the protocol is TCP. If
you configure this match condition, we recommend that you also
configure the |
|
|
|
Match the IPv4 time-to-live number. Specify a TTL value or a range of
TTL values. For |
|
|
|
Do not match on the IPv4 TTL number. For details, see the
|
|
Platform-Specific Behavior
Use Feature Explorer to confirm platform and release support for specific features.
Use the following table to review platform-specific behaviors for your platform.
|
Platform |
Difference |
|---|---|
|
MX Series routers |
For MX Series routers with MPCs, you need to initialize the
filter counter for Trio-only match filters in the MIB by walking
the corresponding SNMP MIB, for example,
On MX series routers, filter matches using
On MX Series Routers, For For information about the |
|
EX2300 |
|
|
EX3400 |
|
|
PTX |
|
|
EX4100 , EX4400 , and QFX5120 switches |
|
Change History Table
Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.
ip-options
any match condition is supported on PTX10003 and PTX10008 Series
routers.