Destination based CoS reclassification based on ASN

Fri 07 February 2014 by someone

Example in context of the Class of service. All above tested on Juniper MX. For example we want to have all traffic towards AS65512 being marked as CoS1

set class-of-service forwarding-policy class POLICY-1 classification-override forwarding-class CoS1
set policy-options policy-statement MARK-POLICY-1 term term-1 to as-path BGP-PATH-TO-MARK-COS
set policy-options policy-statement MARK-POLICY-1 term term-1 then class POLICY-1
set policy-options policy-statement MARK-POLICY-1 term term-2 then accept
set routing-options forwarding-table export MARK-POLICY-1

set policy-options as-path BGP-PATH-TO-MARK-COS "65512 .*"

Define a policy class set class-of-service forwarding-policy class POLICY-1 classification-override forwarding-class CoS1.

Associate the policy class with a routing policy

set policy-options policy-statement MARK-POLICY-1 term term-1 to as-path BGP-PATH-TO-MARK-COS
set policy-options policy-statement MARK-POLICY-1 term term-1 then class POLICY-1
set policy-options policy-statement MARK-POLICY-1 term term-2 then accept

Apply the policy by including the export statement at the routing-options forwarding-table set routing-options forwarding-table export MARK-POLICY-1.

Surely all above will remark packets leaving routers only if you have rewrite rule on outgoing interface set class-of-service interfaces ge-7/2/2 unit 0 rewrite-rules inet-precedence REWRITE_PREC.

Juniper link about Overriding the Input Classification

Juniper destination based CoS question on StackExchange