5

I'm trying to do destination based CoS on Juniper MX basing on destination ASN. I've tried config below.

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

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 forwarding-class network-control
set routing-options forwarding-table export MARK-POLICY-1

set class-of-service interfaces ge-7/2/2 unit 0 rewrite-rules inet-precedence default

I expect traffic to AS65512 destinations to be marked as network-control, however tcpdump shows 0x0 tos filed. Looks like term-1 condition is right, since if I change 'then forwarding-class network-control' to 'then reject' traffic towards AS65512 is indeed rejected.

Let's ignore for a moment 'network-control' it's here only to see that marking is indeed happens (which is not the case).

What could be wrong with my config?

3

Packet classification occurs when the packet enters the router. You're trying to apply it on the forwarding table. That's not supported.

The Juniper documentation shows the packet flow in the router:

Packet flow in MX Routers

So try to apply the policy on the input interface like so:

set interfaces ge-x/x/x.x family inet policer input MARK-POLICY-1

Another way to update a packet in the forwarding-table is to use the classification-override feature:

Overriding the Input Classification

set class-of-service forwarding-policy class POLICY-1 classification-override forwarding-class network-control
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
  • Overriding the Input Classification is exactly the thing I was looking for. Thanks! – Alex_www Feb 7 '14 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.