Assigning Rewrite Rules on a Per-Customer Basis Using Policy Maps
This topic describes the purpose and configuration of policy maps. Policy maps enable you to assign rewrite rules on a per-customer basis.
Policy Maps Overview
Most commonly, packet marking (that is, setting rewrite rules) in Junos uses the forwarding class and loss priority determined through a behavior aggregate (BA) classifier or multifield classifier. The forwarding class and loss priority are also used to decide queuing and scheduling behavior. This approach does not allow you to directly assign rewrite rules to each customer because of the limited number of combinations of forwarding class and loss priority. When a new customer is added, setting rewrite rules using this approach requires changes to the configuration on the core interfaces, which is undesirable as one mistake can affect traffic from all customers.
An alternative packet marking scheme, called policy map, enables you to define rewrite rules on a per-customer basis (that is, for each customer) separate from queuing and scheduling behavior. The policy map makes it possible to use any packet field to identify a given flow and specify a rewrite value for that flow.
A policy map is defined at the [edit class-of-service policy-map]
hierarchy level. Depending on your platform and software release, the policy map can
define the following types of packet marking:
-
IPv4 Precedence with the following options:
-
proto-ip– Mark the packet for IPv4 to IPv4 traffic. -
proto-mpls– Mark the packet for an IPv4 packet entering an MPLS tunnel. -
proto-all– Enable IP header marking.
-
-
IPv6 Precedence with the following options:
-
proto-ip– Mark the packet for IPv6 to IPv6 traffic. -
proto-mpls– Mark the packet for an IPv6 packet entering an MPLS tunnel.
-
-
IPv4 DSCP with the following options:
-
proto-ip– Mark the packet for IPv4 to IPv4 traffic. -
proto-mpls– Mark the packet for an IPv4 packet entering an MPLS tunnel. -
proto-all– Enable IP header marking.
-
-
IPv6 DSCP with the following options:
-
proto-ip– Mark the packet for IPv6 to IPv6 traffic. -
proto-mpls– Mark the packet for an IPv6 packet entering an MPLS tunnel. -
proto-all– Enable IPv6 header marking.
-
-
MPLS EXP with the following options:
-
all-label– Mark all labels. -
outer-label– Mark only the outer label.
-
-
IEEE 802.1p with the following options:
-
outer– Mark only the outer VLAN header. -
outer-and-inner– Mark both the outer and inner VLAN headers.
-
-
IEEE 802.1ad with the following options:
-
outer– Mark only the outer VLAN header. -
outer-and-inner– Mark both the outer and inner VLAN headers.
-
To enable the policy map feature:
-
On most devices, enable
enhanced-ip,enhanced-ethernet, orenhanced-modeunder[edit chassis network-services]. -
On PTX10002-36QDD routers, enable
policy-map-markingon each egress logical interface that you want to do policy map marking. You enablepolicy-map-markingat the[edit class-of-service interfaces interface-name unit unit-number]hierarchy level.
Policy maps have the following configuration restrictions:
-
When configuring both
proto-ipandproto-mplsoptions forinet-precedence,inet6-precedence,dscp, ordscp-ipv6, you must configure both options with the same code point or code point alias. -
You cannot configure
inet-precedenceanddscpin the same policy map. -
You cannot configure
inet6-precedenceanddscp-ipv6in the same policy map. -
In case of MPLS SWAP/PUSH operation, only the new labels are marked on all label-switching routers (LSRs), except the penultimate hop case where if it exposes the next label in the stack, then the exposed label is marked. Therefore, with the penultimate hop, the service label is changed.
-
You cannot configure
ieee-802.1andieee-802.1adin the same policy map. -
You cannot configure both
outerandouter-and-inneroptions forieee-802.1andieee-802.1adcode points in the same policy map. -
For IEEE 802.1ad with the
outer-and-inneroption, the discard eligibility (DE) bit is marked only for the outer VLAN header. For the inner VLAN header, only the three CoS Bits are marked.
You assign a policy map to a customer through a firewall action on an ingress or egress firewall filter (where the match conditions identify the customer). Alternatively, you can assign a policy map to an ingress interface or a routing instance. You can assign multiple policy maps to a customer, one for each of the customer’s traffic flows. Also, you can assign a single policy map to multiple customers.
A policy map is executed on a packet just before it is queued, so it overrides any other packet- marking scheme that was previously applied to the packet.
Configuring Policy Maps
To assign rewrite rules on a per-customer basis:
Use Policy Maps to Pass Meta Data
On PTX10002-36QDD routers, you can also use policy maps to pass meta data between firewall filters. That is, a policy map value set in an ingress filter can be matched on in an egress filter, enabling you to perform any firewall action based on that meta data.
Use of policy maps for this purpose is not a CoS function and does not require a QoS license. When committing a configuration for this purpose, you can safely ignore any notice of the requirement of a QoS license.
As an example, consider a device with an ingress interface of xe-0/0/0 and an egress interface of xe-1/0/0. You can define an input firewall filter for xe-0/0/0 with a policy map as an action based on any desired match conditions. You can then define an egress firewall filter for xe-1/0/0 with that policy map as a match condition and apply any desired actions for packets that have that policy map applied.
Platform-Specific Policy Map Behavior
Use Feature Explorer to confirm platform and release support for policy maps.
Use the following table to review platform-specific behaviors for your platform:
|
Platform |
Difference |
|---|---|
|
PTX10002-36QDD |
|