Beginning with Junos 14.2R3, there is a packet marking scheme, called policy map, that allows the definition of rewrite rules on a per-customer basis. Policy maps are defined at the [edit class-of-service policy-map] hierarchy level and can be assigned to a customer through a firewall action, an ingress interface, or a routing policy. 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. This article provides a configuration example.
Traditionally, packet marking in Junos uses the forwarding class and loss priority determined from a BA classifier or multifield classifier. This approach does not allow for direct assignment of rewrite rules on a per-customer basis due to the limited number of combinations of forwarding class and loss priority. However, packet marking with policy map allows rewrite rules on a per-customer basis. The Junos 14.2 Release Notes refers to the following new feature:
[edit class-of-service policy-map policy-map-name] user@host# set inet-precedence proto-ip code-point [alias | bits]; user@host# set inet-precedence proto-mpls code-point [alias | bits] user@host# set dscp proto-ip code-point [alias | bits] user@host# set dscp proto-mpls code-point [alias | bits] user@host# set dscp-ipv6 proto-ip code-point [alias | bits] user@host# set dscp-ipv6 proto-mpls code-point [alias | bits] user@host# set exp all-label code-point [alias | bits] user@host# set exp outer-label code-point [alias | bits] user@host# set ieee-802.1 outer code-point [alias | bits] user@host# set ieee-802.1 outer-and-inner code-point [alias | bits] user@host# set ieee-802.1ad outer code-point [alias | bits] user@host# set ieee-802.1ad outer-and-inner code-point [alias | bits]
[edit class-of-service] user@host# set policy-map pm1 dscp proto-ip code-point 111000 user@host# set policy-map pm1 ieee-802.1 outer code-point 001
[edit firewall family protocol-family-name filter filter-name] user@host# set term term-name from match-conditions user@host# set term term-name then policy-map policy-map-name
[edit firewall family inet filter f1] user@host# set term t1 from address 10.2.2.0/24 user@host# set term t1 then policy-map p1
[edit class-of-service] user@host# set routing-instances routing-instance-name policy-map policy-map-name
[edit class-of-service] user@host# set routing-instances r1 policy-map p1
[edit class-of-service] user@host# set interfaces interface-name unit logical-unit-number policy-map policy-map-name
[edit class-of-service] user@host# set interfaces xe-4/0/0 unit 0 policy-map p1
user@host> show class-of-service policy-map Policy-map: P-1, Index: 1 Type Code Point Option inet-precedence 110 (proto-ip) inet-precedence 110 (proto-mpls) dscp-ipv6 101010 (proto-ip) dscp-ipv6 101010 (proto-mpls) exp 110 (all-label) exp 111 (outer-label) ieee-802.1ad 0110 (outer-and-inner) show class-of-service policy-map Output Fields Field Name Field Description Type The type of packetmarking to rewrite. Code Point The code point the packetmarking should be rewritten to. Option The type of the traffic the packetmarking should be rewritten for.