To configure a CoS rule, include the rule rule-name statement at the [edit services cos] hierarchy level:
- [edit services cos]
-
rule rule-name {
-
match-direction (input | output | input-output);
-
-
term term-name {
-
-
from {
-
applications [ application-names ];
-
application-sets [ set-names ];
-
destination-address address;
-
source-address address;
- }
-
-
then {
-
application-profile profile-name;
-
dscp (alias | bits);
-
forwarding-class class-name;
-
syslog;
-
-
(reflexive | reverse) {
-
application-profile profile-name;
-
dscp (alias | bits);
-
forwarding-class class-name;
-
syslog;
- }
- }
- }
- }
Each CoS rule consists of a set of terms, similar to a filter configured at the [edit firewall] hierarchy level. A term consists of the following:
In addition, each rule must include a match-direction statement that specifies the direction in which the rule match is applied. To configure where the match is applied, include the match-direction statement at the [edit services cos rule rule-name] hierarchy level:
-
match-direction (input | output | input-output);
If you configure match-direction input-output, bidirectional rule creation is allowed.
The match direction is used with respect to the traffic flow through the AS PIC. When a packet is sent to the AS PIC, direction information is carried along with it.
With an interface service set, packet direction is determined by whether a packet is entering or leaving the interface on which the service set is applied.
With a next-hop service set, packet direction is determined by the interface used to route the packet to the AS PIC. If the inside interface is used to route the packet, the packet direction is input. If the outside interface is used to direct the packet to the AS PIC, the packet direction is output. For more information on inside and outside interfaces, see the JUNOS Services Interfaces Configuration Guide.
On the AS PIC, a flow lookup is performed. If no flow is found, rule processing is performed. All rules in the service set are considered. During rule processing, the packet direction is compared against rule directions. Only rules with direction information that matches the packet direction are considered.
The following sections describe CoS rule content in more detail: