20120112_cht_tl_教育訓練 day7
TRANSCRIPT
© 2011 Juniper Networks, Inc. All rights reserved. | www.juniper.net
中華電信研究所網路技術基礎訓練課程
Day 7
CoS/QoS(Class of Service)/(Quality of Service)
Johnson [email protected] Jan.12 , 2012
© 2011 Juniper Networks, Inc. All rights reserved. | www.juniper.net
CoS Overview
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 3
Class of Service Overview
What is CoS?• Ability to treat packets differently as they transit a
network device• End-to-end mechanism
• Does not pertain to only a single network device
Why CoS?• Convergence of voice and data networks• Differentiation between applications• Guaranteed bandwidth
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 4
CoS Defined
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 5
CoS for Converged Networks
Identify traffic and its requirements
Divide traffic into classes
Define CoS policies for each class
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 6
CoS is Unidirecrional
CoS configuration is unidirectional• You must explicitly configure settings in both
directions
CoS Domain
Traffic flow
C1
C2
PE1
PE2 P1
P2fe-1/1/1
fe-1/1/1 fe-2/0/1fe-2/0/2
fe-0/0/3
fe-0/0/2
fe-1/0/2
fe-3/0/2
fe-1/0/0
fe-0/0/0
ingress
egress
Traffic flow
ingress
egress
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 7
A Historic Perspective
Circuit-switched networks• Designed around service levels needed for
telephony• Connection-oriented; one user per connection
• Suitable for real-time, loss-sensitive applications• Low (fixed) delay• Blocking of new connections during congestion
CoS is not required in the historic environment• The network is purpose-built to support
application (telephony) requirements
VoiceVoice
PSTN
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 8
Network Advances
Packet-switched networks• Developed to optimize efficiency for machine-to-
machine communications• Multiple users share a connection• Unexpected delays and loss during congestion
CoS is still not applicable• The network is purpose-built to support
application requirements• Applications do not require CoS
(Expand bandwidth to solve congestion issue when needed)
Data
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 9
Network Convergence Drives CoS
Convergence drives the need for CoS• Multiple applications supported over a common
network infrastructure• Traffic from specific applications must be recognized
and treated accordingly• Special handling is necessary to ensure that unique
applications perform as expected in the face of congestion or queuing delays
• User bandwidth usage must be controlled• IP is the convergence technology of choice
Video
Data
Voice
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 10
Definition of CoS Parameters
CoS parameters• Bandwidth: End-to-end information carrying
capacity• Delay: End-to-end delay for information delivery• Jitter(Delay variation): Variation in end-to-end
delays caused by packet queuing• Loss: Percentage of packets not delivered, usually
related to congestion Network CoS parameters affect a user’s
perception of performance
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 11
Three Models for Quality of Service
• Best-Effort: No QoS is applied to packets. • IntServ: Applications signal to the network that they require special QoS.
• DiffServ: The network recognizes classes that require special QoS.
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 12
Best-Effort Model
It will get there when it gets there.
• Internet initially based on a best-effort packet delivery service
• The default mode for all traffic
• No differentiation between types of traffic
• Like using standard mail
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 13
IntServ Model
• Some applications have special bandwidth or delay requirements or both
• IntServ introduced to guarantee a predictable behavior of the network for these applications
• Guaranteed delivery: no other traffic can use reserved bandwidth
• Like having your own private courier plane
It will be there by 10:30 a.m.
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 14
DiffServ Model
• Network traffic identified by class
• Network QoS policy enforces differentiated treatment of traffic classes
• You choose level of service for each traffic class
• Like using a package delivery service
Do you want overnight delivery?
Do you want two-day air delivery?
Do you want three- to seven-day ground delivery?
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 15
A Brief History of IP CoS—IntServ
Integrated Services(InterServ):• IETF’s first attempt at extending IP for other than
best-effort services• RSVP signaling used to describe specific CoS
requirements to the network(Host-to-Host)• Routers reserve resources across the network• Resembled a circuit-switched call setup
• Never deployed…• Scalability issues
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 16
A Brief History of IP CoSType-of-Service Field
Type-of-Service(TOS) byte in the IP header• Defined in RFC 791• IP Precedence(0~7) field to prioritize discards
• Industry supported precedence bits to minimize loss of network-control packets
IP Precedence Reserved
Bits0 1 2 4 5 6 73
D T R
MSB LSB
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 17
DiffServ architecture
DiffServ architecture:• Defined in RFCs 2474 and 2475• Redefined the IPv4 ToS field to support a 6-bit
DiffServ Code Point (DSCP)• DiffServ has no signaling component
• Operates on hop-by-hop basis
------------------------------------ DSCP ------------------------------------
------- ECN -------
0 1 2 4 5 6 73 BitsMSB LSB
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 18
DiffServ Terminology (1 of 2)
Key DiffServ terms:• IP Precedence
• 3-bit value (0~7)• Original IPv4 ToS byte
• DSCP• 6-bit value (0~63)• This is the CoS value for a packet
• Behavior Aggregate (BA)• Classification based on DSCP• Packets with a common DSCP belong to the same BA
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 19
DSCP Encoding
• DiffServ field: The IP version 4 header ToS octet or the IPv6 traffic class octet, when interpreted in conformance with the definition given in RFC 2474
• DSCP: The first six bits of the DiffServ field, used to select a PHB (forwarding and queuing method)
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 20
DiffServ Terminology (2 of 2)
Key DiffServ terms (contd.):• Per-Hop Behavior (PHB)
• Forwarding treatment associated with a given BA• Packets with the same DSCP value have the same PHB
• PHB group• A set of one or more PHBs with related forwarding
behavior • Example: assured forwarding (AF) is a PHB group,
consisting of multiple PHBs : AF1, AF2, AF3, and AF4
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 21
Per-Hop Behavior
Per Hop Behavior (PHB) • description of the externally observable forwarding
behavior of a DS node applied to a the set of packets with the same DSCP
• PHB may be defined in terms of • DS nodes resources priority relative to other PHBs• observable traffic characteristics (delay, loss, …)
PHBs are defined as “black box”• does NOT mandate particular implementation
mechanisms !
Different boxes implement PHBs in different ways which are optimised for each platform
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 22
Per-Hop Behaviors
DSCP selects PHB throughout the network.• Default (FIFO, Tail drop)• EF (Expedited Forwarding)• AF (Assured Forwarding)• CS (Class-Selector) mapping to IPP(IP
Precedence)
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 23
Per-Hop Behaviors (Cont.)
• Each AF class uses three DSCP values.• Each AF class is independently forwarded with
its guaranteed bandwidth.
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 24
Standardized DiffServ PHBs (1 of 2) Expedited Forwarding(EF)
• Designed to provide for low loss, low delay, and low jitter services
• Example: Voice• Recommended code point: 101110(usually
mapped to IPP(5)) Assured Forwarding(AF)
• Primarily concerned with controlling packet loss• Four classes: AF1, AF2, AF3, and AF4• Each class supports three drop probabilities; for
example, AF11 (low), AF12 (medium), and AF13 (high)AF 11/12/13
AF 21/22/23
AF 31/32/33
AF 41/42/43
Low 001010 010010 011010 100010
Medium 001100 010100 011100 100100
High 001110 010110 011110 100110
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 25
Standardized DiffServ PHBs (2 of 2)
Class Selector(CS)• Provide IP precedence compatibility• Typically used for network control traffic
Best effort is not specifically defined• Best effort is the default PHB
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 26
EF PHB Definition
RFC 2598 Expedited Forwarding PHB, June 99
EF PHB can be used to build a low loss, low latency, low jitter, assured bandwidth, end-to-end service – targets VoIP, Virtual Leased Lines– Assured traffic sees no (or very small)
queues/delay– Constraint: at every transit node, the
aggregate’s max arrival rate is less than the aggregate min departure rate
An example of how EF can be implemented is a Priority Queue (with rate limit).
Recommended DSCP=101110 (46)
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 27
AF PHB Group Definition
RFC2597, Assured Forwarding PHB Group, June 99
Assured Forwarding (AF) PHB Group is meant to offer different levels of forwarding assurances for IP packets received from a customer DS domain
Olympic Service (Gold, Silver, Bronze)• gold (C1) >= silver (C2) >= bronze (C3)
No quantifiable timing requirements!• delay or delay variation
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 28
Recommended DSCPs
IANA maintains a list of recommended DSCPs• Based on RFC recommendations for defined PHBs
Name DSCP
CS0 000000 (0)
CS1 001000 (8)
CS2 010000 (16)
CS3 011000 (24)
CS4 100000 (32)
CS5 101000 (40)
CS6 110000 (48)
CS7 111000 (56)
Name DSCP
AF11 001010 (10)
AF12 001100 (12)
AF13 001110 (14)
AF21 010010 (18)
AF22 010100 (20)
AF23 010110 (22)
AF31 011010 (26)
AF32 011100 (28)
AF33 011110 (30)
AF41 100010 (34)
AF42 100100 (36)
AF43 100110 (38)
EF 101110 (46)
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 29
• IEEE specification
• 802.1P user priority field
• Supports up to 8 classes of service
• Focuses on support for QoS over LANs and 802.1Q ports
Classification and Marking at the Data-Link Layer—Ethernet 802.1Q Class of Service
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 30
• Frame Relay DTE devices can set the DE bit of a frame so that if the network becomes congested, Frame Relay devices will discard frames with the DE bit set before discarding those that do not have the DE bit set.
• Preserved throughout the Frame Relay network.
Classification and Marking at the Data-Link Layer—Frame Relay/ATM QoS
• The CLP bit indicates that the cell should be discarded if it encounters congestion as it moves through the network.
• Preserved throughout the ATM network.
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 31
• MPLS uses a 32-bit label field (shim header) which is inserted between Layer 2 and Layer 3 headers (frame mode).
• Supports up to 8 classes of service.
• The IP precedence or DSCP field is not directly visible to MPLS label switch routers.
• In most casen, routers will copy the three most significant bits of the DSCP or the IP precedence of the IP packet to the EXP field.
• Preserved throughout the MPLS network.
Classification and Marking at the Data-Link Layer—MPLS Experimental Bits
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 32
Comparison
Best-Effort Diffserv Intserv
Service •Connectivity•No isolation•No guarantees
•Per aggregation isolation•Per aggregation guarantee
•Per flow isolation•Per flow guarantee
Service Scope
End-to-end Domain End-to-end
Complexity No set-up Long term setup Per flow setup
Scalability •Highly scalable•(nodes maintain only routing state)
Scalable (edge routers maintains per aggregate state; core routers per class state)
Not scalable (each router maintains per flow state)
© 2011 Juniper Networks, Inc. All rights reserved. | www.juniper.net
CoS Processing Stages
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 34
What is Class of Service ?
CoS provides mechanisms for categorizing traffic and meeting performance requirements within a network
Note: CoS does not make a network faster or reduce congestion!
Packet B Packet CPacket A
Voice
Packet A
Video
Packet B
Data
Packet C
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 35
CoS components:• Traffic classification• Policing• Queuing• Scheduling• Rewrite rules
CoS Components
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 36
ShaperScheduler
Overview of CoS Processing
Forwarding Class
BA Classifier
Policing (Ingress)
Rewrite
Marker
Multifield
Classifier
Fabric
Ingress
Egress
Forwarding Policy
Policing (Egress)
Multifield Classifier
Loss Priority
RED
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 37
Meeting Performance Requirements
CoS meets a network’s performance requirements by:• Prioritizing latency-sensitive traffic such as VoIP• Controlling congestion to ensure service level
agreement(SLA) maintenance• Allocating bandwidth for different classes of traffic
Devices should treat traffic consistently throughout the entire network
Voice
Data
VoIP
Data
VoIP
Data
Voice
Data
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 38
Forwarding Classes
Forwarding classes:• Identify traffic that should receive common
treatment• Used to assign traffic to output queues
Packet B Packet CPacket A
Voice
Packet A
Video
Packet B
Data
Packet C
Queue 2
Queue 1
Queue 0
Forwarding Class Output Queue
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 39
Loss Priority
Loss priority:• Identifies the priority a system should give to
dropping a packet• Used to select the drop profile used in the
RED(Random Early Detection) process
If congestion exists…
Drop first
Data
VoIP
Voice
Data
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 40
JUNOS CoS Defaults
4 Queues Assigned to 4 Forwarding classes(up to 8 Queues/16 Forwarding classes)
In a default configuration, input BA classification is performed by the ipprec-compatibility table
Queue
Forwarding Class PriorityTransmit
RateDrop
Profile
0 Best-effort (BE) Low 95% Tail drop
1 Expedited-Forwarding (EF)
– –
2 Assured-Forwarding (AF)
– –
3 Network-Control (NC) Low 5% Tail drop
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 41
Typical CoS Processing Stages
Egress
Policing orRate Limit
Classify
Class 0
Class 1
Class 2
Class 3
Class n
IngressTo
Fabric
Scheduling and
Prioritization
Queue 0
(Class 0)
Queue 1(Class 1)
Queue 2(Class 2)
Queue 3
(Class 3)
HeaderRewrite
From Fabric
Input Processing
Output Processing
Congestion Control (WRED)
The order of stages can vary slightly across Junos
devices.
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 42
Traffic Classification
Classifiers map traffic to a forwarding class at ingress• Can match on existing CoS values
• BA classification• Can match on protocol, port, addresses, and so
forth• Multifield classification
• Support for IP precedence, DSCP (IPv4 and IPv6), MPLS EXP, and IEEE 802.1p
Classifier
Basic Service(BE)
Premium Service(EF)
Control Traffic(NC)
Packet APacket BPacket C
NC: Network control class
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 43
Policing
Policing limits traffic volume and burstiness• Enforces and protects CoS SLAs• Excess traffic can be marked or discarded• Functions at ingress, egress, or both
Policer within MF Classifier
InterfacePolicer
InterfacePolicer
Ingress Interface
Egress Interface
MF: Multifield
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 44
Policing vs Shaping
• These mechanisms must classify packets before policing or shaping the traffic rate.
• Shaping queues excess packets to stay within the desired traffic rate.
• Policing typically drops or marks excess traffic to stay within a traffic rate limit.
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 45
Policing vs. Shaping
• Out-of-profile packets are dropped
• Dropping causes TCP retransmits
• Less buffer usage (shaping requires an additional shaping queuing system)
• Out-of-profile packets are queued until a buffer gets full
• Buffering minimizes TCP retransmits
• Shaping supports interaction with Frame Relay congestion indication
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 46
CoS and Forwarding Policy
Policy can select the forwarding next hop for traffic associated with a particular forwarding class• CoS-Based Forwarding (CBF)
BE packetEF packetBE pack
et
EF packet
CBF in place at R2 for the BE
forwarding class
R1 R2 R4
R3
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 47
Schedulers
Schedulers define the prioritization properties of forwarding classes (queues):• Transmission rate
• Guaranteed and maximum rates
• Queue priority• Support for five priority levels
• Delay buffer• Storage space for traffic bursts
• Congestion management and avoidance• Support for RED for equal, random dropping of traffic• Support for WRED for weighted, preferred dropping of
traffic
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 48
First In First Out(FIFO)
• First packet in is first packet out• Simplest of all• One queue• All individual queues are FIFO
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 49
Priority Queuing(PQ)
• Uses multiple queues• Allows prioritization• Always empties first
queue before going to the next queue:– Empty Queue 1– If Queue 1 empty, then
dispatch one packet from Queue 2
– If both Queue 1 and Queue 2 empty, then dispatch one packet from Queue 3
• Queues 2 and 3 may “starve”
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 50
Round Robin
• Uses multiple queues• No prioritization• Dispatches one packet from each queue in each round– One packet from Queue 1– One packet from Queue 2– One packet from Queue 3– Then repeat
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 51
Weighted Round Robin(WRR)
• Allows prioritization• Assign a “weight” to each queue
• Dispatches packets from each queue proportionally to an assigned weight:– Dispatch up to 4 from
Queue 1– Dispatch up to 2 from
Queue 2– Dispatch 1 from Queue 3– Go back to Queue 1
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 52
RED Modes
• RED has three modes:• No drop: When the average queue size is
between 0 and the minimum threshold• Random drop: When the average queue size is
between the minimum and the maximum threshold
• Full drop (tail drop): When the average queue size is at maximum threshold or above
• Random drop should prevent congestion (prevent tail drops)
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 53
Weighted RED
Packet
Dro
p
Pro
bab
ilit
y
Queue Length
“Slope” is adjustable
(Random drop)
Queue Max
Packet
Dro
p
Pro
bab
ilit
y
Queue Length Queue Max
Packet
Dro
p
Pro
bab
ilit
y
Queue Length
Standard Service
Queue Max
WithoutRED
WithRED
WithWRED
Premium Service
Std. Min.
Prem. Min.
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 54
Standard Premium
Weighted Random Early Detection(WRED)
Upon congestion, packets from lower precedence are selectively discarded first
Minimize the congestion impact on higher precedence services
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 55
TCP Traffic Before RED
• TCP synchronization prevents average link utilization close to the link bandwidth.
• Tail drops cause TCP sessions to go into slow-start.
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 56
TCP Traffic After RED
• Average link utilization is much closer to link bandwidth.
• Random drops cause TCP sessions to reduce window sizes.
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 57
Scheduling Overview
Components of scheduling:• Priority• Transmission rate• Buffer size• RED configuration
Defines the order in which packets transmitDefines the storage and dropping of packets
Scheduler Map
Queue 0 Queue 1 Queue 2 Queue 3
Dat
aD
at
aD
at
aD
at
a
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 58
Queue Priority
Queues receive service according to their assigned priority; common priorities include:• Strict-High(might starve low priority queue)• High• Medium high• Medium low• Low
Sch
ed
ule
r M
ap
Queue 0(L)
Queue 1(ML)
Queue 2(MH)
Queue 3(H)
462715
15
7
2
46
Data
Serviced first
Serviced last
Queue 4(SH)
3
3
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 59
Rewrite Markers
The packet header rewrite sets CoS values for outbound traffic• Can be used by BA classification in downstream
nodes• Support for IP precedence, DSCP (IPv4 and IPv6),
MPLS EXP, and IEEE 802.1p
Packet
DSCP = 0001001
The inbound classifier assigns a packet to
forwarding class
Packet
DSCP = 000000
Rewrite sets the packet’s DSCP coding based on the forwarding
class
© 2011 Juniper Networks, Inc. All rights reserved. www.juniper.net | 60
Review of CoS Processing
ShaperScheduler
Forwarding Class
BA Classifi
er
Policing (Ingres
s)
Rewrite
Marker
Multifield
Classifier
Fabric
Ingress
Egress
Forwarding
Policy
Policing
(Egress)
Multifield
Classifier
Loss Priority
RED
Reference:JUNOS CoS Configurtion Guide (JUNOS 11.4)