CoS and configuration: From JUNOS

  • Terminologies:
    • Classification: examine the incoming packets and associate with a service.
    • Behavior Aggregate: A method of classification. Single field is examined. (Cos bits)
    • Multi-field classifier: A method of classification. Multiple fields are examined.
    • Queuing: Packets queued in internal buffer before sending out of an interface.
    • Scheduling: with multiple queues, this process selects which queue to service.
    • Rewrite rules: To set cos bits in the outgoing packet for next downstream router to classify.
  • In type-of-service byte of IPv4 packets, bits 5 to 7 are used to classify traffic. By default, JUNOS uses IP precedence bits for classification. After new standards introduced DSCP, JUNOS supports DSCP.
  • In MPLS, EXP bits in MPLS header are used for classification.

Software implementation:

  • After receiving packet by physical interface connector (PIC), link layer information is validated and the packets are passed to Flexible PIC concentrator (FPC) for validating L2/L3 information. It segments packet into 64-byte J-cells and they are written into packet storage memory. ‘Notification cell’ is sent to route lookup engine and the next-hop address is written in same packet which now called as ‘result cell’. This cell is queued on appropriate outbound FPC until the egress interface is ready to Tx packet. FPC reads  J-cells from memory, reform the original packet and sent it out via PIC
  • Cos actions are performed in 3 locations:
    • Incoming I/O manager:
      • When packets are received by ingress FPC, packet header is examined by BA classifier and associates with particular forwarding class and set the LP (loss priority)
      • Both forwarding class (FC) and LP are placed in notification cell and sent to internet processor ASIC.
    • Internet processor ASIC:
      • Any firewall filters configured on ingress/egress interface is evaluated here.
      • Filter can perform MF classifier and overwrite FC/LP values.
      • The result cell is passed to I/O manager ASIC associated with egress interfaces.
    • Outgoing I/O manager:
      • Result cell is placed in queue based on FC and LP values.
      • Packets can be dropped during congestion based on LP and drop-profile.
      • Cos bits are correctly set by rewrite rules before transmitting packets.
  • Configuration options:
    • Code point alias:
      • Assign code-points if we need to change default alias to user-defined names.
    • Forwarding class:
      • A user-defined class which is assigned to each queue. Referenced in both classifier and rewrite rules.
    • BA classifier:
      • This assigns a packet to a forwarding class and set the packets loss priority value to high or low.
      • JUNOS uses a default classifier called ‘ipprec-compatability’ on all router interfaces.
    • MF classifier:
      • Juniper uses firewall filter to implement MF. To change FC or LP, use the action statement, ‘then forwarding-class’ or ‘then loss-priority’
    • Drop profiles:
      • To implement Random Early detection (RED).
      • Uses two variables to build drop profile. Queue fullness (fill-level) and drop prob.
      • Fill-level is the percentage of memory allocated for result-cell to store compared to total memory available for that queue.
      • Drop probability is the likelihood of packets that can be dropped in network.
      • Two types of graph are available. Segmented and interpolated.
      • When a packet reaches head of queue, a random number is generated and if that number falls below the profile line, the packet is dropped.
    • Schedulers:
      • To define the property of an individual queue.
      • ‘transmit-rate’ command allocate the amount of interface BW allocated to a queue.
      • ‘buffer-size’ command to allocate amount of memory buffer allocated to store and queue the result cell. Value can be either percentage (of total memory) or particular value(amount of time a cell can be queued)
      • By default, buffer-size is set same as ‘transmit-rate’ and it is recommended.
      • We can set priority of a queue using ‘priority’ command. Can be low or high.
    • Scheduler-map:
      • Matches a scheduler to a forwarding class and assign to interface.
    • Queue servicing:
      • Junos performs priority queuing by servicing in-profile (Tx-ed amount less than allocated) queues and then out of profile queues. Within in profile/out-of profile, high priority queues are served before low priority queues.
    • Rewrite-rules:
      • Out-going packets’ cos settings can be changed using rewrite rules. Same configuration steps as classifier. Forwarding-class is invoked.
  • Commands:
    • Show class-of-service interfaces
    • Show class-of-service classifier <type/name>
    • Show class-of-service
  • Sample configuration:

1. Assign Code point aliase if we need user-named words

2. Create a forwarding class and assign it to queue.

3. Create Classifiers and assign the code-points to each class with LP set to high/low.

4. Create a schedulers and assign transmit-rate, buffer-size, drop profiles etc

5. Create scheduler-map to link schedulers to forwarding-class.

6. Create rewrite rules if needed.

7. Assign classifier, scheduler-map and rewrite-rules to each interface.

root@Juniper> show configuration class-of-service

classifiers {

inet-precedence sample-classify {

forwarding-class c-best-effort {

loss-priority high code-points best-effort;

}

forwarding-class c-gold {

loss-priority low code-points gold;

}

forwarding-class c-silver {

loss-priority low code-points silver;

}

forwarding-class c-net-control {

loss-priority high code-points net-control;

}

}

}

code-point-aliases {

inet-precedence {

best-effort 000;

gold 011;

silver 100;

net-control 111;

}

}

drop-profiles {

high-drop-prof {

interpolate {

fill-level [ 25 50 75 ];

drop-probability [ 50 80 95 ];

}

}

low-drop-prof {

interpolate {

fill-level [ 25 50 75 ];

drop-probability [ 10 20 30 ];

}

}

}

forwarding-classes {

queue 0 c-best-effort;

queue 1 c-gold;

queue 2 c-silver;

queue 3 c-net-control;

}

rewrite-rules {

inet-precedence sample-rewrite {

forwarding-class c-best-effort {

loss-priority high code-point best-effort;

}

forwarding-class c-gold {

loss-priority low code-point gold;

}

forwarding-class c-silver {

loss-priority low code-point silver;

}

forwarding-class c-net-control {

loss-priority high code-point net-control;

}

}

}

scheduler-maps {

sample-scheduler-map {

forwarding-class c-gold scheduler s-gold;

forwarding-class c-best-effort scheduler s-best-effort;

forwarding-class c-net-control scheduler s-net-control;

forwarding-class c-silver scheduler s-silver;

}

}

schedulers {

s-gold {

transmit-rate percent 40;

buffer-size percent 40;

priority high;

drop-profile-map loss-priority low protocol any drop-profile low-drop-prof;

drop-profile-map loss-priority high protocol any drop-profile high-drop-prof;

}

s-silver {

transmit-rate percent 20;

buffer-size percent 20;

priority low;

drop-profile-map loss-priority low protocol tcp drop-profile low-drop-prof;

drop-profile-map loss-priority high protocol non-tcp drop-profile high-drop-prof;

}

s-best-effort {

transmit-rate remainder;

buffer-size remainder;

priority low;

drop-profile-map loss-priority any protocol any drop-profile low-drop-prof;

}

s-net-control {

transmit-rate 1m exact;

buffer-size percent 5;

priority high;

drop-profile-map loss-priority any protocol any drop-profile low-drop-prof;

}

}

root@Juniper>

root@Juniper# show

em0 {

unit 0 {

classifiers {

inet-precedence sample-classify;

}

}

}

em1 {

scheduler-map sample-scheduler-map;

unit 0 {

rewrite-rules {

inet-precedence sample-rewrite;

}

}

}

[edit class-of-service interfaces]

root@Juniper# commit check

[edit class-of-service interfaces]

’em0′

Cannot configure class-of-service on interface em0.

error: configuration check-out failed

[edit class-of-service interfaces]

root@Juniper#

<Seems we cannot set Cos to em interfaces in Qemu>

Advertisements
This entry was posted in jncis, Junos, QOS and tagged , , , , . Bookmark the permalink.

One Response to CoS and configuration: From JUNOS

  1. Kai Ren says:

    Hi,
    I have a question on Cos , I help you could help me out.
    I need to apply dscp marking for egress of a layer 3 interface on a Juniper EX4200 Switch. Do you know if this is possible on this layer 3 switch? I need to ensure that all packets reached uplink router is marked cs2.
    I have tried to create a rewrite rule and apply it on the interface ge-0/0/0. that didn’t seems to work, I used a laptop connected directly to this port and used wireshark to capture the icmp packets. dscp was still showing 0x00 which is no marking.

    there is not a lot of good examples out there to learn.
    Hope you could point me to the right direction.

    thanks,

    Kai

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s