Understanding the Use of Policers in Firewall Filters
Policing, or rate limiting, is an important component of firewall filters that lets you control the amount of traffic that enters an interface on Juniper Networks EX Series Ethernet Switches. You can achieve policing by including policers in firewall filter configurations.
Policers Overview
You can use policers to specify rate limits on traffic. A firewall filter configured with a policer permits only traffic within a specified set of rate limits, thereby providing protection from denial-of-service (DoS) attacks. Traffic that exceeds the rate limits specified by the policer is either discarded immediately or is marked as lower priority than traffic that is within the rate limits. The switch discards the lower-priority traffic when there is traffic congestion.
A policer applies two types of rate limits on traffic:
Bandwidth—The number of bits per second permitted, on average.
Maximum burst size—The maximum size permitted for bursts of data that exceed the given bandwidth limit.
Policing uses an algorithm to enforce a limit on average bandwidth while allowing bursts up to a specified maximum value. You can define specific classes of traffic on an interface and apply a set of rate limits to each class. After you name and configure a policer, it is stored as a template. You can then use the policer in a firewall filter configuration.
On all EX Series switches except Juniper Networks EX8200 Ethernet Switches, each policer that you configure includes an implicit counter that counts the number of packets that exceed the rate limit specified for the policer. Each EX8200 switch contains three global management counters. You must assign ingress policers to these global management counters to obtain policer statistics. You can assign any number of ingress policers to each global management counter. The policer statistics for each global management counter are the aggregate of the policer statistics for all policers associated with that global management counter.
To get filter-specific packet counts, you must configure a different policer for each firewall filter. Policers give term-specific counts by default.
Policer Types
Switches support three types of policers:
Single-rate two-color—A two-color policer (sometimes called simply “policer”) meters the traffic stream and classifies packets into two categories of packet loss priority (PLP) according to a configured bandwidth and burst-size limit. You can mark packets that exceed the bandwidth and burst-size limit or simply discard them. A two-color policer is most useful for metering traffic at the port (physical interface) level.
Single-rate three-color—This type of policer is defined in RFC 2697, A Single Rate Three Color Marker, as part of an assured forwarding (AF) per-hop-behavior (PHB) classification system for a Differentiated Services (DiffServ) environment. This type of policer meters traffic based on the configured committed information rate (CIR), committed burst size (CBS), and the excess burst size (EBS). Traffic is marked as belonging to one of three categories (green, yellow, or red) based on whether the packets are arriving at rates that are below the CBS (green), exceed the CBS but not the EBS (yellow), or exceed the EBS (red). A single-rate three-color policer is most useful when a service is structured according to packet size and not according to peak arrival rate.
Two-rate three-color—This type of policer is defined in RFC 2698, A Two Rate Three Color Marker, as part of an assured forwarding (AF) per-hop-behavior (PHB) classification system for a Differentiated Services (DiffServ) environment. This type of policer meters traffic based on the configured CIR and the peak information rate (PIR), along with their associated burst sizes; the CBS, and the peak burst size (PBS). Traffic is marked as belonging to one of three categories (green, yellow, or red) based on packets are arriving at rates that are below the CIR (green), exceed the CIR but not the PIR (yellow), or exceed the PIR (red). A two-rate three-color policer is most useful when a service is structured according to arrival rates and not to packet size.
Policer Actions
Policer actions can be implicit or explicit and vary by policer type. The term implicit means that Junos OS assigns a loss-priority value automatically; explicit means that you configure the action. Table 1 lists policer actions.
Policer |
Marking |
Implicit Action |
Configurable Action |
---|---|---|---|
Single-rate two-color |
Green (Conforming) |
Assign low loss priority |
None |
Red (Nonconforming) |
None |
Assign low or high loss priority, assign a forwarding class, or discard |
|
Yellow |
Not supported |
Not supported |
|
Single-rate three-color |
Green (Conforming) |
Assign low loss priority |
None |
Red (Above the EBS) |
Assign high loss priority |
Discard |
|
Yellow (Exceeds the CBS but not the EBS) |
Assign high loss priority Note:
Not supported on EX8200 switches |
None Note:
Not supported on EX8200 switches |
|
Two-rate three-color |
Green (Conforming) |
Assign low loss priority |
None |
Red (Above the PIR) |
Assign high loss priority |
Discard |
|
Yellow (Exceeds the CIR but not the PIR) |
Assign high loss priority Note:
Not supported on EX8200 switches |
None Note:
Not supported on EX8200 switches |
You cannot apply a policer with an action of forwarding-class
to an output
firewall filter.
Beginning with Junos OS Release 17.1, on EX4300
switches, you can configure the policer action loss-priority
to be low
, medium-low
, medium-high
, or high
.
Policer Levels
You can configure policers at the queue level, logical interface level, or Layer 2 (MAC) level. Only a single policer is applied to a packet at the egress queue. The search for policers occurs in this order:
Queue level
Logical interface level
Layer 2 (MAC) level
Color Modes
Tricolor marking (TCM) policers are not bound by a green-yellow-red coloring convention. Packets are marked with low or high PLP bit configurations based on color. Therefore, both three-color policer types (single-rate and two-rate) extend the functionality of class-of-service (CoS) traffic policing by providing three levels of drop precedence (loss priority) instead of the two normally available in policers. Both single-rate and two-rate three-color policer types can operate in two modes:
Color-blind—In color-blind mode, the three-color policer operates without reference to whether the examined packets have been previously marked or metered. In other words, the three-color policer is blind to any previous coloring a packet might have had.
Color-aware—In color-aware mode, the three-color policer operates with reference to any previous marking or metering of the examined packets. In other words, the three-color policer is aware of the previous coloring a packet might have had. In color-aware mode, the three-color policer can increase the PLP of a packet but can never decrease it. For example, if a color-aware three-color policer meters a packet with a low PLP marking, it can raise the PLP level to high. But it cannot reduce a high PLP level to low.
Naming Conventions for Policers
We recommend you use the naming convention rate-TCMnumber-colortype when configuring three-color policers. TCM stands for tricolor marking. Because policers can be numerous and must be applied correctly to work, observing a simple naming convention makes it easier to apply the policers properly.
For example, if you configure a single-rate, three-color, color-aware policer, name it srTCM1-ca. If you configure a two-rate, three-color, color-blind policer, name it trTCM2-cb.
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.
loss-priority
to be low
, medium-low
, medium-high
, or high
.