Applying Policers
Policers allow you to perform simple traffic policing on specific interfaces or Layer 2 virtual private networks (VPNs) without configuring a firewall filter. To apply policers, include the
policerstatement:policer {arppolicer-template-name;inputpolicer-template-name;outputpolicer-template-name;}You can include these statements at the following hierarchy levels:
[edit interfacesinterface-nameunitlogical-unit-numberfamilyfamily]- [
edit logical-routerslogical-router-nameinterfacesinterface-nameunitlogical-unit-numberfamilyfamily]In the
familystatement, the protocol family can beccc,inet,inet6,mpls,tcc, orvpls.In the
arpstatement, list the name of one policer template to be evaluated when Address Resolution Protocol (ARP) packets are received on the interface. By default, an ARP policer is installed that is shared among all the Ethernet interfaces on which you have configured thefamily inetstatement. If you want more stringent or lenient policing of ARP packets, you can configure an interface-specific policer and apply it to the interface. You configure an ARP policer just as you would configure any other policer, at the[edit firewall policer]hierarchy level. If you apply this policer to an interface, the default ARP packet policer is overridden. If you delete this policer, the default policer takes effect again.In the
inputstatement, list the name of one policer template to be evaluated when packets are received on the interface.In the
outputstatement, list the name of one policer template to be evaluated when packets are transmitted on the interface.
NOTE: To use policing on a CCC or TCC interface, you must configure the CCC or TCC protocol family.
You can configure a different policer on each protocol family on an interface, with one input policer and one output policer for each family. When you apply policers, you can configure the family
ccc,inet,tcc, orvplsonly, and one ARP policer for the familyinetprotocol only. Each time a policer is referenced, a separate copy of the policer is installed on the packet forwarding components for that interface.If you apply both policers and firewall filters to an interface, input policers are evaluated before input firewall filters, and output policers are evaluated after output firewall filters.
If you apply the policer to the interface
lo0, it is applied to packets received or transmitted by the Routing Engine.On M-series platforms (except the M320 router), if you apply a firewall filter or policer to multiple interfaces, the filter or policer acts on the sum of traffic entering or exiting those interfaces. On T-series and M320 platforms, the filter or policer acts on the sum of traffic, if the interfaces are on the same FPC.
For more information about policers, see the JUNOS Policy Framework Configuration Guide.
Applying Aggregate Policers
By default, if you apply a policer to multiple protocol families on the same logical interface, the policer restricts traffic for each protocol family individually. For example, a policer with a 50 Mbps bandwidth limit applied to both IPv4 and IPv6 traffic would allow the interface to accept 50 Mbps of IPv4 traffic and 50 Mbps of IPv6 traffic. If you apply an aggregate policer, the policer would allow the interface to receive only 50 Mbps of IPv4 and IPv6 traffic combined.
To configure an aggregate policer, include the logical-interface-policer statement at the [edit firewall policer
policer-template-name] hierarchy level:[edit firewall policerpolicer-template-name]logical-interface-policer;For the policer to be treated as an aggregate, you must apply it to multiple protocol families on a single logical interface by including the policer statement:
policer {arppolicer-template-name;inputpolicer-template-name;outputpolicer-template-name;}You can include these statements at the following hierarchy levels:
[edit interfacesinterface-nameunitlogical-unit-numberfamilyfamily]- [
edit logical-routerslogical-router-nameinterfacesinterface-nameunitlogical-unit-numberfamilyfamily]In the
familystatement, the protocol family can beccc,inet,inet6,mpls,tcc, orvpls.The protocol families on which you do not apply the policer are not affected by the policer. For example, if you configure a single logical interface to accept MPLS, IPv4, and IPv6 traffic and you apply the logical interface policer
policer1to only the IPv4 and IPv6 protocol families, MPLS traffic is not subject to the constraints ofpolicer1.If you apply
policer1to a different logical interface, there are two instances of the policer. This means the JUNOS software polices traffic on separate logical interfaces separately, not as an aggregate, even if the same logical-interface policer is applied to multiple logical interfaces on the same physical interface port.
Example: Applying Aggregate Policers
Configure two logical interface policers:
aggregate_police1andaggregate_police2. Applyaggregate_police1to IPv4 and IPv6 traffic received on logical interface fe-0/0/0.0. Applyaggregate_police2to CCC and MPLS traffic received on logical interface fe-0/0/0.0. This configuration causes the software to create only one instance ofaggregate_police1and one instance ofaggregate_police2.Apply
aggregate_police1to IPv4 and IPv6 traffic received on another logical interface fe-0/0/0.1. This configuration causes the software to create a new instance ofaggregate_police1, one that applies to unit 0 and another that applies to unit 1.[edit firewall]policer aggregate_police1 {logical-interface-policer;if-exceeding {bandwidth-limit 100m;burst-size-limit 500k;}then {discard;}}policer aggregate_police2 {logical-interface-policer;if-exceeding {bandwidth-limit 10m;burst-size-limit 200k;}then {discard;}}[edit interfaces fe-0/0/0]unit 0 {family inet {policer {input aggregate_police1;}}family inet6 {policer {input aggregate_police1;}}family ccc {policer {input aggregate_police2;}}family mpls {policer {input aggregate_police2;}}}unit 1 {family inet {policer {input aggregate_police1;}}family inet6 {policer {input aggregate_police1;}}}