IP Precedence、DSCP、TOS

刚开始接触QoS时,经常会被IP Precedence、DSCP、TOS这些名词搞迷糊,那么接下来就梳理一下。

首先 IP Precedence

IPv4中有8bit作为TOS字段,一开始RFC791定义了TOS前三位为IP Precedence,划分了8个优先级,可用于流分类,数值越大表示优先级越高。IP Precedence与CoS相同,都有8种服务(0-7).。
一般对应的应用类型:
7 预留(Reserved)
6 预留(Reserved)
5 语音(Voice)
4 视频会议(Video Conference)
3 呼叫信号(Call Signaling)
2 高优先级数据(High-priority Data)
1 中优先级数据(Medium-priority Data)
0 尽力服务数据(Best-effort Data)

DSCP 出现

在这里插入图片描述
随着网络的发展,8个优先级已经不能满足实际需要,于是RFC2474又对TOS重新进行了定义,把前六位定义为DSCP差分服务代码(Differentiated Services Code Point),后两位保留。
RFC3168中将TOS最后两位定义为ECN字段,用来控制拥塞比如用在RoCEv2环境。如果不了解ECN可以参考一下这篇文章:RoCEv2网络

DSCP关键字形式

由于DSCP和IP PRECEDENCE是共存的,于是存在了一些兼容性的问题,DSCP的可读性比较差,比如DSCP 43我们并不知道对应着IP PRECEDENCE的什么取值,于是就把DSCP进行了进一步的分类。DSCP总共分成了4类:
1. Default(BE) 000 000: 默认值
2. Class Selector(CS) xxx 000 :CS的DSCP后三位为0,也就是说CS仍然沿用了IP Precedence只不过CS定义的DSCP=IP Precedence*8,比如:CS6(110 000)=6 x 8=48,CS7(111 000)=7 x 8=56
3. Expedited Forwarding(EF) 101 110 :EF含义为加速转发,也可以看作为IP Precedence为5,是一个比较高的优先级,取值为101110(46),但是RFC并没有定义为什么EF的取值为46。
4. Assured Forwarding(AF) aaa bb0:AF分为两部分,a部分(IP优先级)和b部分 如下图:
在这里插入图片描述
a部分为3 bit仍然可以和IP Precedence对应;
b部分为2 bit表示丢弃性,可以表示3个丢弃优先级,可以应用于RED或者WRED。
目前a部分有三个bit最大取值为8,但是目前只用到了1~4。为了迅速的和10进制转换,可以用如下方法,先把10进制数值除8得到的整数就是AF值,余数换算成二进制看前两位就是丢弃优先级,比如34/8=4余数为2,2 换算成二进制为010,那么换算以后可以知道34代表AF4丢弃优先级为middle的数据报。
确定转发(AF),定义了4个服务等级,每个服务等级有3个下降过程,因此使用了12个DSCP值((10,12,14),(18,20,22),(26,28,30),(34,36,38))

DSCP和TOS对照

举个例子:DSCP=001010 十进制就是10 十六进制就是a,相对应的TOS=00101000 十进制就是40 十六进制就是28
对应关系如下表所示:

在这里插入图片描述

tcpdump抓包

这里再分享一下tcpdump 过滤TOS值和DSCP值的抓包分享:
首先在一台Linux机器上持续ping,-Q 40 标识ICMP包的DSCP字段为40,对应AF11
在这里插入图片描述

然后我们另开一个shell 用tcpdump抓包:sudo tcpdump -v -i eth0 ‘ip[1]&0xfc == 40’,ip[1] 是过滤IP包头的第2个字节,0xfc相当于掩码忽略掉后两位ECN位。
在这里插入图片描述
这样就可以抓到AF11的包,对应上表DSCP值10[0x0a],TOS值40[0x28]。
在这里插入图片描述

  • 9
    点赞
  • 40
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1 An Introductionto theTechnologiesofIPand ATM 3 Circuit Switching 3 PacketSwitching 5 Cell Switching andATM 7 Connection-orientatedService 8 Connectionless Service andIP 9 Buffering in ATMswitches and IP routers 11 Buffer Management 11 Traffic Control 13 2 Traffic Issues andSolutions 15 Delayand Loss Performance 15 Source models 16 Queueingbehaviour 18 Coping withMulti-service Requirements:DifferentiatedPerformance 30 Buffer sharing and partitioning 30 Celland packet discard mechanisms 32 Queue schedulingmechanisms 35 Flows, ConnectionsandAggregates 37 Admission control mechanisms 37 Policingmechanisms 40 Dimensioningand configuration 41 3 Teletraffic Engineering 45 Sharing Resources 45 Mesh andStar Networks 45 Traffic Intensity 47 Performance 49 TCP: Traffic, CapacityandPerformance 49 VariationofTraffic Intensity 50 Erlang’s Lost Call Formula 52 Traffic Tables 53 viii CONTENTS 4 Performance Evaluation 57 Methods ofPerformanceEvaluation 57 Measurement 57 Predictive evaluation:analysis/simulation 57 Queueing Theory 58 Notation 60 Elementary relationships 60 The M/M/1queue 61 The M/D/1/K queue 64 Delayinthe M/M/1 and M/D/1 queueingsystems 65 5 FundamentalsofSimulation 69 Discrete Time Simulation 69 Generating random numbers 71 M/D/1 queue simulator inMathcad 73 Reachingsteady state 74 Batch means and confidence intervals 75 Validation 77 Accelerated Simulation 77 Cell-rate simulation 77 6TrafficModels 81 Levels ofTraffic Behaviour 81 Timing Informationin Source Models 82 Time betweenArrivals 83 Counting Arrivals 86 RatesofFlow 89 PARTII ATMQUEUEINGAND TRAFFICCONTROL 95 7 Basic Cell Switching 97 The Queueing BehaviourofATMCells in OutputBuffers 97 Balance EquationsforBuffering 98 Calculating theState ProbabilityDistribution 100 Exact Analysis forFINITE OutputBuffers 104 Delays 108 End-to-end delay 110 8 Cell-Scale Queueing 113 Cell-scale Queueing 113 Multiplexing Constant-bit-rateTraffic 114 Analysis ofanInfinite Queue withMultiplexed CBRInput: The 115 NDD/D/1 Heavy-traffic ApproximationfortheM/D/1Queue 117 Heavy-traffic ApproximationfortheNDD/D/1Queue 119 Cell-scale Queueing in Switches 121 9 Burst-ScaleQueueing 125 ATM Queueing Behaviour 125 Burst-scale Queueing Behaviour 127 CONTENTS ix Fluid-flow Analysis ofaSingle Source –Per-VCQueueing 129 Continuous Fluid-flow Approach 129 Discrete ‘Fluid-flow’ Approach 131 Comparingthe Discrete andContinuous Fluid-flow Approaches 136 Multiple ON/OFF Sources ofthe Same Type 139 The Bufferless Approach 141 The Burst-scale DelayModel 145 10 ConnectionAdmissionControl 149 The TrafficContract 150 Admissible Load:The Cell-scale Constraint 151 A CACalgorithm based onM/D/1 analysis 152 A CACalgorithm based onNDD/D/1 analysis 153 The cell-scaleconstraint instatistical-bit-rate transfer capability,based on 155 M/D/1 analysis Admissible Load:The Burst Scale 157 A practical CAC scheme 159 Equivalent cellrate and linearCAC 160 Two-levelCAC 160 Accounting forthe burst-scale delayfactor 161 CAC in TheStandards 165 11 Usage Parameter Control 167 Protectingthe Network 167 Controlling the MeanCell Rate 168 Algorithms forUPC 172 The leakybucket 172 PeakCell RateControlusing the LeakyBucket 173 The problemoftolerances 176 Resourcesrequired fora worst-case ON/OFF cell stream from peakcell 178 rate UPC Traffic shaping 182 Dual LeakyBuckets: The LeakyCupandSaucer 182 Resourcesrequiredfora worst-case ON/OFF cellstream from sustainable 184 cellrate UPC 12 Dimensioning 187 Combining TheBurst and CellScales 187 Dimensioning The Buffer 190 Small buffers for cell-scalequeueing 193 Large buffers forburst-scale queueing 198 Combining TheConnection,Burst andCell Scales 200 13 PriorityControl 205 Priorities 205 Space Priority andThe CellLoss Priority Bit 205 Partial BufferSharing 207 Increasing the admissible load 214 Dimensioningbuffers forpartial buffer sharing 215 Time Priority in ATM 218 Meanvalue analysis 219 x CONTENTS PARTIII IPPERFORMANCE 227 AND TRAFFICMANAGEMENT 14 Basic Packet Queueing 229 The Queueing BehaviourofPacketsin anIP RouterBuffer 229 Balance EquationsforPacketBuffering: The Geo/Geo/1 230 Calculating the state probability distribution 231 DecayRateAnalysis 234 Using the decayrate to approximate the buffer overflowprobability 236 Balance EquationsforPacketBuffering: Excess-rate Queueing 238 Analysis The excess-rate M/D/1, forapplicationto voice-over-IP 239 The excess-rate solutionforbest-effort traffic 245 15 Resource Reservation 253 Quality ofService andTraffic Aggregation 253 Characterizingan AggregateofPacketFlows 254 PerformanceAnalysis ofAggregate PacketFlows 255 Parameterizing the two-state aggregate process 257 Analysing the queueingbehaviour 259 Voice-over-IP, Revisited 261 Traffic Conditioning ofAggregateFlows 265 16 IP BufferManagement 267 First-in First-outBuffering 267 RandomEarly Detection–Probabilistic PacketDiscard 267 Virtual Buffers andScheduling Algorithms 273 Precedence queueing 273 Weightedfair queueing 274 Buffer Space Partitioning 275 Shared BufferAnalysis 279 17 Self-similar Traffic 287 Self-similarity andLong-range-dependentTraffic 287 The ParetoModel ofActivity 289 Impact ofLRDTraffic onQueueing Behaviour 292 The Geo/Pareto/1 Queue 293 References 299 Index 301

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值