Topic: tech juniper ijos prev next

tech juniper ijos > 16: Class of Service

16: Class of Service

CoS Overview

Packets are normally queued in the order they are received, without controlling throughput or delay (“best effort” forwarding). CoS can transmit in order of service class.

CoS marks traffic as it enters at the edge of the network. A classifier assigns each packet a forwarding class and a priority. Based on the forwarding class, the packet is assigned to an outbound forwarding queue. CoS can, for example, send high priority traffic over different links.

Across the network, devices examine the CoS settings of packets they receive. Devices should treat traffic consistently across the entire network.

A classifier examines and incoming packet and assigns a forwarding class and a loss priority to it. Based on the forwarding class, the packet is assigned to an outbound transmission queue. Input policers meter traffic to see if the traffic flow exceeds its service level. Policers might discard the packet, or change the forwarding class or loss priority.

Scheduling maps are applied to interfaces and also associate outgoing packets with a scheduler and forwarding class. The scheduler defines how a packet is treated in the output transmission queue based on the configured transmit rate, buffer size, priority, and drop profile. The buffer size determines the period for which a packet is stored using congestions. The scheduling priority and transmit rate determine the order in which the packet is transmitted. The drop profile determines have aggressively packets are dropped for a given scheduler.

Output policers meter traffic and might change the forwarding class and loss priority of a packet is a traffic flow exceeds its service level. The rewrite rule writes CoS information to the packet header. This information is carried to the next device.

Note that CoS support varies between platforms.

Forwarding classes identify traffic that should have common treatment and assigns it to output queues. During processing, the system assigns traffic to an output queue and rewrites BA (behaviour aggregate) markers based on the forwarding class. There is usually a one-to-one mapping of forwarding classes to output queues, however, some systems support a many-to-one mapping of forwarding class to output queue.

PLP (packet loss priority) is used to drop low priority packets in the event of congestion. Low priority packets are marked with a high loss priority. PLP is set by a classifier or a policer.

Traffic Classification

Junos supports multifield classifers and BA classifiers. Multifield classifiers look at multiple fields in the packet header. BA classifers look at the CoS fields set by other classifiers.

There are two deployment models. In-the-box uses multifield classifiers only. Across-the-network uses a multifield classifier at the edge and BA classifiers in the core.

Multifield classifiers are configured like firewall filters. The forwarding class is set in the ‘then’ part of the firewall filter term.

edit firewall family inet
show filter apply-cos-markings

term admin {
    from {
        source-address {
            192.168.200.0/25;
        }
    }
    then {
        forwarding-class expedited-forwarding;
        loss-priority low;
        accept;
    }
}
term all-other-traffic {
    then accept;
}

show ge-0/0/1

unit 0 {
    family inet {
        filter {
            input apply-cos-markings;
        }
        address ...
    }
}

A rewrite rule modifies the CoS bits in an outgoing packet. This enables the next device to classify the packet into the appropriate service group. Typically, this happens on the outbound interface of an edge device to meet the policies of the targeted peer.

Rewrite rules are applied to the ‘class-of-service’ hierarchy.

edit class-of-service
show
interfaces {
    ge-0/0/3 {
        unit 0 {
            rewrite-rules {
                inet-precedence fault;
            }
        }
    }
}

A BA classifer operates on a packet as it enters the device. A BA classifer aggregates different types of traffic into the same forawrding class, to ensure different types of traffic get the same treatment. A BA classifier can operate on the DSCP value.

edit class-of-service
show
classifiers {
    inet-precedence data {
        forwarding-class expedited-forwarding {
            loss-priority low code-points 000;
        }
    }
}

Show the default classifiers;

show class-of-service classifier type inet-precedence

Policers can also be used to set the forwarding class or loss priority. Traffic exceeding configured limits can be assigned a different forwarding class;

show firewall
policer admin-traffic-policer {
    if-exceeding {
        bandwidth-limit 1m;
        burst-size-limit 3k;
    }
    then forwarding-class best-effort;
 }

The forwarding class and loss priority statements from the policer override the forwarding class and loss priority from the firewall filter.

Traffic Queuing

When traffic reaches the outbound interface, the system places traffic associated with each forwarding class in its own queue.

Queues:

By default, network control traffic goes into queue 3 and all other traffic goes into queue 0. Classifiers must be configured to send traffic to any other queue.

Traffic Scheduling

Junos devices transmit packets in queues with a higher priority before packets in queues with a lower priority. By default, 95% of the bandwith is assigned to the queue associated with the best-effort forwarding class, typically queue 0. 5% is assigned to the network-control forwarding class (queue 3). Other queues are assigned no bandwith. Packets will still be sent from lower priority queues if spare bandwith is available.

Priority and transmission rate determine the order in which packets transmit. Buffer size and random early detection (RED) configuration determine the storage and dropping of packets.

Define a drop profile and a scheduler using that drop profile.

class-of-service {
    drop-profiles {
        BE-drop-profile {
            fill-level 75 drop-probability 25;
            fill-level 90 drop-probability 40;
        }
    }
}

The buffer-size is the same as the transmit-rate. This is acceptable in most situations.

class-of-service {
    schedulers {
        sched-BE {
            transmit-rate percent 40
            buffer-size percent 40;
            priority low;
            drop-profile-map loss-priority low protocol any drop-profile BE-drop-profile;
        }
    }
}

Schedulers must be associated with queues.

class-of-service {
    scheduler-maps {
        sched-map-example {
            forwarding-class best-effort scheduler sched-BE;
            forwarding-class expedited-forwarding scheduler sched-EF;
            forwarding-class assured-forwarding scheduler sched-AF;
            forwarding-class network-control scheduler sched-NC;
    }
}

The interface must be associated with the scheduler map.

class-of-service {
    interfaces {
        fe-* {
            scheduler-map sched-map-example;
        }
    }
}

CoS Use Case

firewall {
    family inet {
        filter apply-cos-markings {
            term from-professors {
                from {
                    source-address {
                        192.168.25.64/26;
                    }
                }
                then {
                    forwarding-class professors;
                    accept;
                }
            }
            term from-students {
                from {
                    source-address {
                        192.168.25.128/26;
                    }
                }
                then {
                    policer student-policer;
                    forwarding-class students;
                    accept;
                }
            }
            term default {
                then accept;
            }
        }
    }
}

firewall {
    family inet {
        filter apply-cos-markings {
            term to-professors {
                from {
                    destination-address {
                        192.168.25.64/26;
                    }
                }
                then {
                    forwarding-class professors;
                    accept;
                }
            }
            term to-students {
                from {
                    destination-address {
                        192.168.25.128/26;
                    }
                }
                then {
                    forwarding-class students;
                    accept;
                }
            }
            term default {
                then accept;
            }
        }
    }
}

class-of-service {
    schedulers {
        sched-network-control {
            transmit-rate percent 5;
            buffer-size percent 5;
            priority high;
        }
        sched-professors {
            transmit-rate percent 45;
            buffer-size percent 45;
            priority medium-high;
        }
        sched-students {
            transmit-rate percent 40;
            buffer-size percent 40;
            priority medium-low;
        }
        sched-best-effot {
            transmit-rate percent 10 exact;
            buffer-size percent 10;
            priority low;
        }
    }

    interfaces {
        ge-0/0/2 {
            scheduler-map professor-student-scheduler;
        }
        ge-0/0/3 {
            scheduler-map professor-student-scheduler;
            unit 0 {
                classifiers {
                    inet-precedence default;
                }
                rewrite-rules {
                    inet-precedence default;
                }
            }
        }
    }
}