Title: Destination based CoS reclassification based on ASN Date: 2014-02-07 10:20 Category: CoS Tags: Juniper, junos, CoS Slug: juniper-mx-overriding-the-input-classification-CoS Author: someone Summary: Destination based CoS reclassification based on ASN
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]( https://www.juniper.net/techpubs/en_US/junos12.3/topics/usage-guidelines/cos-overriding-the-input-classification.html )
[Juniper destination based CoS question on StackExchange]( http://networkengineering.stackexchange.com/questions/6192/juniper-destination-based-cos )