Examples: Configuring Policing
The following example shows a complete filter configuration containing a policer. It limits all FTP traffic from a given source to certain rate limits. Traffic exceeding the limits is discarded, and the remaining traffic is accepted and counted.
The following example shows a complete filter configuration containing two policers, and includes the next term action. Policer policer-1 limits all traffic from a given source to certain rate limits, and then sets the forwarding class. Policer policer-2 limits all traffic to a second set of rate limits. Traffic exceeding the limits is discarded; the remaining traffic is accepted.
The following example limits all FTP traffic from a given source to certain rate limits, but defines the policer outside the filter, thereby creating a template that can be referenced by more than one filter or more than one term within a filter. Traffic exceeding the limits is discarded, and the remaining traffic is accepted and counted.
The following example shows a filter intended to thwart denial-of-service (DoS) SYN attacks:
The following example uses one filter to do the following:
- Stop all User Datagram Protocol (UDP) and Internet Control Message Protocol (ICMP) traffic destined to these addresses (in term a).
- Send ICMP through the policer (in term b).
- Accept all other ICMP and other traffic (in term c).
Note: It is important to keep the terms in order; once a packet has a match within the firewall filter, it is not examined in subsequent terms. For example, if you configured the filter to send ICMP traffic through the policer before discarding ICMP and UDP traffic to the addresses (in term a), you would not get the desired result.
[edit firewall]policer policer-1 {if-exceeding {bandwidth-limit 200k;burst-size-limit 3k;}then {loss-priority high;forwarding-class 1;}}term a {from {destination-address {10.126.50.2/23;10.130.12.1/23;10.82.16.0/24 except;10.82.0.3/18;}protocol [icmp udp];}then {count packets-dropped;discard;}}term b {from {protocol icmp;}then policer policer-1;}term c {then accept;}