How to Set DSCP Values for Transit on Junos Routers

By Walter J. Goralski, Cathy Gadecki, Michael Bushong

If Differentiated Service Code Point (DSCP) values aren’t set correctly upon entering your network, you must be able to set them so that the rest of your behavior aggregate (BA) classifiers within your network will function as expected. A typical CoS implementation includes this functionality on edge routers via the DSCP rewrite capabilities. Essentially, you match on the destination address or port or whatever field you’re using to identify traffic.

Then based on the type of traffic you know it to be, you configure the router to overwrite the existing DSCP value and use the value that corresponds to the type of traffic you’re matching on. When the packet is forwarded to the next hop within your network, that next router can simply look at the DSCP value and treat the packet accordingly.

To configure DSCP rewrites, you simply specify what code points you want associated with a particular forwarding class. This configuration is pretty straightforward; you simply configure the code points you want to match on for a particular forwarding class. Then you explicitly write those values upon ingress into your network.

Here’s where you define the DSCPs to match on:

[edit class-of-service]
classifiers {
  dscp dscp-classifier {
   forwarding-class cos-voice {
     loss-priority low code-points ef;
   }
   forwarding-class cos-video {
     loss-priority high code-points cs1;
     loss-priority low code-points af11;
   }
   forwarding-class cos-buscrit {
     loss-priority low code-points af13;
   }
   forwarding-class cos-noncrit {
     loss-priority high code-points cs5;
     loss-priority low code-points af43;
   }
  }
}

To configure rewrites that match the values the rest of your network is keying on:

[edit class-of-service]
rewrite-rules {
  dscp rewrite-dscps {
   forwarding-class cos-voice {
     loss-priority low code-points ef;
   }
   forwarding-class cos-video {
     loss-priority high code-points cs1;
     loss-priority low code-points af11;
   }
   forwarding-class cos-buscrit {
     loss-priority low code-points af13;
   }
   forwarding-class cos-noncrit {
     loss-priority high code-points cs5;
     loss-priority low code-points af43;
   }
  }
}

Now you need to apply these rewrite rules to an interface:

[edit class-of-service]
interfaces t1-0/0/1 {
  unit 0 {
   rewrite-rules dscp rewrite-dscps;
  }
}

All traffic on the specified interface that is assigned to one of the forwarding classes will have its DSCPs rewritten to match the expected DSCP values for the rest of the network. Basically, you use a firewall filter to assign traffic to a forwarding class, and then you use the DSCP rewrite functionality to mark the traffic for subsequent CoS processing within your network.