Summary:
There are differences in the way QoS rewrite takes place between EX-series switches running JUNOS 9.4 and prior versions. This document explains the differences, and provides an example for rewrite of switched frames using code prior to JUNOS 9.4; since the documentation only describes the procedure for rewriting routed packets.
Symptoms:
How do I rewrite QoS values (CoS, DSCP or IP-prec) on an EX?
Solution:
On an EX-series switch using JUNOS prior to version 9.4, a rewrite rule is applied only for routed packets be default. To apply the rewrite for switched frames, we need to apply a firewall filter on the egress VLAN or interface so that the rewrite rule may be applied. However in JUNOS 9.4 and after, rewrite-rules defined under class-of-service stanza apply to both routed and switched packets.
This document assumes that only QoS re-write is taking place on the EX, and there is no classification, queuing, or scheduling taking place. Such a configuration was purposely omitted from this KB for simplicity and to focus on a working rewrite example. Please consult the EX JUNOS documentation for information on configuring QoS.
Example: Rewriting switched frames with DSCP 46 (EF) to IEEE CoS 6.
The frames are switched from ge-0/0/1 to ge-0/0/0. Using JUNOS 9.3R2.8 on EX, a traffic generator is used to pump IP packets with DSCP 46 in interface ge-0/0/1. Interface ge-0/0/0 can be connected to a PC which can receive tagged frames where a sniffer can show the incoming frames to verify if the remarking or rewriting took place.
EX configuration:
[edit]
root# show class-of-service
forwarding-classes {
class voice queue-num 5;
}
rewrite-rules {
ieee-802.1 voice {
forwarding-class voice {
loss-priority low code-point 110;
}
}
}
root# show firewall
family ethernet-switching {
filter rewrite-filter {
term voice {
from {
dscp ef; # any condition could be specified here
}
then {
forwarding-class voice;
loss-priority low;
count voice-hits;
}
}
}
}
root# show interfaces ge-0/0/0
unit 0 {
family ethernet-switching {
port-mode trunk;
vlan {
members 1;
}
filter {
output rewrite-filter;
}
}
}
Note: The above filter could also be applied to VLAN 1 egress instead.
As seen above, the forwarding class (FC) needs to be defined else the configuration will not commit. The FC however is just a dummy mapped to queue 5 in this case, and it is not actually used since there is no classifier configuration.