
参加免费公开课,请您说是由【攻城狮论坛】推荐的。报名收费培训的论坛会员,可享受优惠价格+赠送攻城狮论坛VIP会员。本文转自 三旗培训 http://www.37vi.com/,版权归原作者所有。························································
Task 46.1 在所有的交换网络中,确保COS的值为3,4和5分别映射给DSCP CS3,DSCPAF41,和DSCP EF。
首先要划分网络中QoS策略流量类型,并且标记DSCP的值。列如,一个数据包被标记为AF31,通常有一个更高优先级的数据包被标记为AF11,并且得到相应的处理,但不被强制。
在思科交换机中(3750和EHWIC模块),它目前使用DSCP值是重要的,并且还接受COS值(二层QoS),并且转换它们为合适的DSCP值。我们需要计算DSCP的值。每个DSCP的值被认为是per-hop behaviors(每跳行为PHB)。每个PHB的值为一个十进制的值。列如,如果AF41为一个34的十进制的值。我们要怎么到达它呢?首先,考虑到每个PHB都为一个独立的值。我们应该转换它们为一个等量的二进制值。
在下面的图片中,我们有一个8-bit的二进制号码描述DSCP值。从右向左,有两个“Unused” bits,这是没有参与计算。接着有一个“Always 0”bit,确保十进制的DSCP值不会是一个“odd”号码。剩下的五个bits作为值得描述。以上作为说明,我们必须分离这两个独立的号码。二进制号码4在下面表现为3-bits,并且写为“100”。二进制号码1在下面表现为2-bits,并且写为“01”。结合这个两个值,结果为“10001”。当添加“Always 0”的值为第一个二进制bit(最右边)时,这个结果就为“100010”。
clip_image001
公式8x+2y,这里“x”为第一个值(4),“y”为第二个值(1)。我们可以快速的算出这个值:8(4)+2(1)=34。再一次,这是一个计算QoS策略的重要方法。
来配置这个3750交换机(SW1)的COS的值为3,4和5分别映射给DSCP CS3(DSCP 24),DSCPAF41(DSCP 34),和DSCPEF(DSCP 46)。我们必须在交换机的全局模式下首先输入mls qos命令,来开启QoS。接着,我们必须定义mls qos mapcos-dscp命令,为了分配适当的值。我们可以先使用show mls qos mapcos-dscp命令来验证配置。按照输出信息,这里有两个值必须修改(COS4和COS 5),当前的map是不正确的DSCP值。分别设置正确的值为34和46。
SW1&
SW1(config)#mls qos
SW1#sh mls qos maps cos-dscp
Cos-dscp map:
cos: 0 1 2 3 4 5 6 7
--------------------------------
dscp: 0 8 16 2432 40 4856
SW1(config)#mls qos map cos-dscp 0 8 16 24 34 46 48 56
在每个交换机上面配置(R2和R3EHWICs模块),我们可以粘贴上面的全局配置。在这些设备上,不需要使用mlsQoS命令,开启QoS。
R2&
R2(config)#mls qos map cos-dscp 0 8 16 24 34 46 48 56
R3&
R3(config)#mls qos map cos-dscp 0 8 16 24 34 46 48 56
在每个设备上使用show mls qos maps cos-dscp命令查看状态。
SW1&
SW1#show mls qos maps cos-dscp
Cos-dscp map:
cos: 0 1 2 3 4 5 6 7
--------------------------------
dscp: 0 8 16 2434 46 48 56
R2&
R2#show mls qos maps cos-dscp
Cos-dscp map:
cos: 0 1 2 3 4 5 6 7
--------------------------------
dscp: 0 8 16 2434 46 48 56
R3&
R3#show mls qos maps cos-dscp
Cos-dscp map:
cos: 0 1 2 3 4 5 6 7
--------------------------------
dscp: 0 8 16 2434 46 48 56
························································
Task 46.2 在3750交换机上配置电话的接口,来信任为电话准备好的标记。
为了配置电话交换端口信任标记,我们必须在电话和交换端口之间配置一个“trust”状态。在交换端口下面使用mls qos trust devicecisco-phone命令。这是非常有益的,因为它会很困难的使用其他的机制划分流量,列如access-lists和NBAR。
SW1&
SW1(config)#interface FastEthernet 1/0/13
SW1(config-if)#mls qos trust device cisco-phone
SW1(config)#interface FastEthernet 1/0/14
SW1(config-if)#mls qos trust device cisco-phone
Jan 609:13:14.721: %SWITCH_QOS_TB-5-TRUST_DEVICE_DETECTED: cisco-phonedetected on port Fa1/0/13,
port's configured trust state is now operational
Jan 609:13:52.151: %SWITCH_QOS_TB-5-TRUST_DEVICE_DETECTED: cisco-phonedetected on port Fa1/0/14,
port's configured trust state is now operational
························································
Task 46.3 确保在电话上面的PC端口接收所有的流量,在3750交换机上重写COS 1。
思科电话能够连接一个PC到电话的“Computer/PCPort”。这是非常有益的,因为只要一根网线就可以代替两根网线。默认,没有PC被信任,并且数据包的值为COS 0,或“best effort”。
为了满足任务需求,重新COS的值为“1”。我们必须在连接电话的接口下面,使用switchport priorityextend命令。我们可以选择信任从PC端口进入的所有流量,或者我们可以设置一个特殊的COS值。这里,我们选择设置一个特殊的值。
SW1&
SW1(config)#interface FastEthernet 1/0/13
SW1(config-if)#switchport priority extend cos 1
SW1(config)#interface FastEthernet 1/0/14
SW1(config-if)#switchport priority extend cos 1
························································
Task 46.4 在R2和R3上面使用NBAR(网络应用程序识别),来划分每个电话端口的流量。语音流量,信令流量,和视频流量都应该分别被标记为EF,CS3,和AF41。
NetworkBased Application Recognition(网络应用程序识别NBAR)是一个非常强大的工具,对于划分和分析网络流量类型。它使用已知的数据标签,端口,有效载荷类型,和其他的方式来定义流量。使用标准的MQC很容易部署。
首先,我们必须使用NBAR来划分语音流量。因为我们知道所有的语音流量都利用RTP,我们可以使用这个协议来帮助鉴定流量。然而,我们不能说所有的RTP流量就是语音流量,因为视频流量也利用RTP。我们必须分别RTP的有效载荷类型。NBAR使用match protocol rtpaudio和match protocol rtpvideo命令。这个前一段RTP有效载荷类型为0-23,后一段为24-34。我们只使用“RTP Audio”流量类型,这样鉴定语音流量是很容易的。
我们现在必须创建一个被NBAR识别的语音流量类型,使用class-map命令。
R2
R2(config)#class-map NBAR-VOICE
R2(config-cmap)#match protocol rtp audio
R3
R3(config)#class-map NBAR-VOICE
R3(config-cmap)#match protocol rtp audio
接着,我们必须识别信令流量,并且创建其他的类别。再一次,使用matchprotocol命令,后面跟着协议。协议众多,使用match-any是个好主意。
R2
R2(config)#class-map match-any NBAR-SIGNALING
R2(config-cmap)#match protocol skinny
R2(config-cmap)#match protocol sip
R2(config-cmap)#match protocol mgcp
R2(config-cmap)#match protocol h323
R2(config-cmap)#match protocol rsvp
R3
R3(config)#class-map match-any NBAR-SIGNALING
R3(config-cmap)#match protocol skinny
R3(config-cmap)#match protocol sip
R3(config-cmap)#match protocol mgcp
R3(config-cmap)#match protocol h323
R3(config-cmap)#match protocol rsvp
最后,我们必须分类视频流量,使用match protocolrtpvideo命令。正如前面所说,只包含RTP有效载荷类型24-34,包括H.264。对于CUCM,“97”或者“126”被作为RTP有效载荷类型的首选。基于IOS系统,dial-peers使用RTP有效载荷类型默认为“119”。我们必须使用所有的这些类型,来成功的识别H.264视频流量。
R2
R2(config-cmap)#class-map match-any NBAR-VIDEO
R2(config-cmap)#match protocol rtp payload-type 97
R2(config-cmap)#match protocol rtp payload-type 119
R2(config-cmap)#match protocol rtp payload-type 126
R3
R3(config)#class-map match-any NBAR-VIDEO
R3(config-cmap)#match protocol rtp payload-type 97
R3(config-cmap)#match protocol rtp payload-type 119
R3(config-cmap)#match protocol rtp payload-type 126
现在基于NBAR的class-maps已经配置,我们必须在R2和R3上创建一个policy-map,来识别从电话交换机端口进入路由器的流量。在每个类别下面使用setdscp命令配置类别的值。
R2
R2(config)#policy-map MARK
R2(config-pmap)#class NBAR-VOICE
R2(config-pmap-c)#set dscp ef
R2(config-pmap)#class NBAR-VIDEO
R2(config-pmap-c)#set dscp af41
R2(config-pmap)#class NBAR-SIGNALING
R2(config-pmap-c)#set dscp cs3
R3
R3(config)#policy-map MARK
R3(config-pmap)#class NBAR-VOICE
R3(config-pmap-c)#set dscp ef
R3(config-pmap)#class NBAR-VIDEO
R3(config-pmap-c)#set dscp af41
R3(config-pmap)#class NBAR-SIGNALING
R3(config-pmap-c)#set dscp cs3
最后把这个policy-map应用到接口。由于policy-map不能直接应用到EHWIC交换端口,它必须被应用到每个站点的语音Vlan SVI。我们在接口下面使用service-policyinput命令来应用。
R2
R2(config)#int vlan 21
R2(config-if)#service-policy input MARK
R3
R3(config)#int vlan 31
R3(config-if)#service-policy input MARK
我们现在可以使用show policy-map interface命令,来验证测量详情,并且显示即时信息。
R2
R2#sh policy-map interface vlan 21
Vlan21
Service-policy input: MARK
Class-map: NBAR-VOICE (match-all)
11020 packets, 815480 bytes
5 minute offered rate 22000 bps, drop rate 0000 bps
Match: protocol rtp audio
QoS Set
dscp ef
Packets marked 11021
Class-map: NBAR-VIDEO (match-any)
0 packets, 0 bytes
5 minute offered rate 0000 bps, drop rate 0000 bps
Match: protocol rtp payload-type"97"
0 packets, 0 bytes
5 minute rate 0 bps
Match: protocol rtp payload-type"126"
0 packets, 0 bytes
5 minute rate 0 bps
Match: protocol rtp payload-type"119"
0 packets, 0 bytes
5 minute rate 0 bps
QoS Set
dscp af41
Packets marked 0
Class-map: NBAR-SIGNALING (match-any)
169 packets, 13264 bytes
5 minute offered rate 0000 bps, drop rate 0000 bps
Match: protocol skinny
169 packets, 13264 bytes
5 minute rate 0 bps
Match: protocol sip
0 packets, 0 bytes
5 minute rate 0 bps
Match: protocol mgcp
0 packets, 0 bytes
5 minute rate 0 bps
Match: protocol h323
0 packets, 0 bytes
5 minute rate 0 bps
Match: protocol rsvp
0 packets, 0 bytes
5 minute rate 0 bps
QoS Set
dscp cs3
Packets marked 169
Class-map: class-default (match-any)
867 packets, 94772 bytes
5 minute offered rate 3000 bps, drop rate 0000 bps
Match: any
R3
R3#sh policy-map interface vlan31
Vlan31
Service-policy input: MARK
Class-map: NBAR-VOICE (match-all)
9490 packets, 707530 bytes
5 minute offered rate 22000 bps, drop rate 0000 bps
Match: protocol rtp audio
QoS Set
dscp ef
Packets marked 9490
Class-map: NBAR-VIDEO (match-any)
12191 packets, 7866516 bytes
5 minute offered rate 145000 bps, drop rate 0000 bps
Match: protocol rtp payload-type"97"
12191 packets, 7866516 bytes
5 minute rate 145000 bps
Match: protocol rtp payload-type"126"
0 packets, 0 bytes
5 minute rate 0 bps
Match: protocol rtp payload-type"119"
0 packets, 0 bytes
5 minute rate 0 bps
QoS Set
dscp af41
Packets marked 12191
Class-map: NBAR-SIGNALING (match-any)
203 packets, 38021 bytes
5 minute offered rate 0000 bps, drop rate 0000 bps
Match: protocol skinny
129 packets, 10622 bytes
5 minute rate 0 bps
Match: protocol sip
74 packets, 27399 bytes
5 minute rate 0 bps
Match: protocol mgcp
0 packets, 0 bytes
5 minute rate 0 bps
Match: protocol h323
0 packets, 0 bytes
5 minute rate 0 bps
Match: protocol rsvp
0 packets, 0 bytes
5 minute rate 0 bps
QoS Set
dscp cs3
Packets marked 203
Class-map: class-default (match-any)
77 packets, 9727 bytes
5 minute offered rate 0000 bps, drop rate 0000 bps
Match: any
························································
Task46.5 在3750交换机电话端口上开启自动QoS,并且观察配置。确保前面的任务功能仍然起作用。
首先,在接口配置一个片段,这样我们就可以跟踪变化了。
SW1
SW1#sh run int fa1/0/13
Building configuration...
Current configuration : 242 bytes
interface FastEthernet1/0/13
description *** REMOTE HQ PHONE ***
switchport access vlan 12
switchport mode access
switchport voice vlan 11
switchport priority extend cos 1
mls qos trust device cisco-phone
spanning-tree portfast
end
SW1#sh run int fa1/0/14
Building configuration...
Current configuration : 242 bytes
interface FastEthernet1/0/14
description *** REMOTE HQ PHONE ***
switchport access vlan 12
switchport mode access
switchport voice vlan 11
switchport priority extend cos 1
mls qos trust device cisco-phone
spanning-tree portfast
end
来实现自动QoS,进入电话接口配置,在auto qos voip命令后面有一些选项。
SW1
SW1(config-if)#auto qos voip ?
cisco-phone Trust the QoS marking of Cisco IP Phone
cisco-softphone Trust the QoS marking of Cisco IP SoftPhone
trust Trust the DSCP/CoS marking
这里,我们将选择信任思科电话,在每个电话交换端口下输入auto qos voip cisco-phone命令。
SW1
SW1(config)#int fa1/0/13
SW1(config-if)#auto qos voip cisco-phone
让我们来观察添加的自动QoS进程。
SW1
SW1#sh run
Building configuration...
...
mls qos map policed-dscp 24 26 46 to 0
mls qos map cos-dscp 0 8 16 24 32 46 48 56
mls qos srr-queue input bandwidth 90 10
mls qos srr-queue input threshold 1 8 16
mls qos srr-queue input threshold 2 34 66
mls qos srr-queue input buffers 67 33
mls qos srr-queue input cos-map queue 1 threshold 2 1
mls qos srr-queue input cos-map queue 1 threshold 3 0
mls qos srr-queue input cos-map queue 2 threshold 1 2
mls qos srr-queue input cos-map queue 2 threshold 2 4 6 7
mls qos srr-queue input cos-map queue 2 threshold 3 3 5
mls qos srr-queue input dscp-map queue 1 threshold 2 9 10 11 12 13 14 15
mls qos srr-queue input dscp-map queue 1 threshold 3 0 1 2 3 4 5 6 7
mls qos srr-queue input dscp-map queue 1 threshold 3 32
mls qos srr-queue input dscp-map queue 2 threshold 1 16 17 18 19 20 21 22 23
mls qos srr-queue input dscp-map queue 2 threshold 2 33 34 35 36 37 38 39 48
mls qos srr-queue input dscp-map queue 2 threshold 2 49 50 51 52 53 54 55 56
mls qos srr-queue input dscp-map queue 2 threshold 2 57 58 59 60 61 62 63
mls qos srr-queue input dscp-map queue 2 threshold 3 24 25 26 27 28 29 30 31
mls qos srr-queue input dscp-map queue 2 threshold 3 40 41 42 43 44 45 46 47
mls qos srr-queue output cos-map queue 1 threshold 3 5
mls qos srr-queue output cos-map queue 2 threshold 3 3 6 7
mls qos srr-queue output cos-map queue 3 threshold 3 2 4
mls qos srr-queue output cos-map queue 4 threshold 2 1
mls qos srr-queue output cos-map queue 4 threshold 3 0
mls qos srr-queue output dscp-map queue 1 threshold 3 40 41 42 43 44 45 46 47
mls qos srr-queue output dscp-map queue 2 threshold 3 24 25 26 27 28 29 30 31
mls qos srr-queue output dscp-map queue 2 threshold 3 48 49 50 51 52 53 54 55
mls qos srr-queue output dscp-map queue 2 threshold 3 56 57 58 59 60 61 62 63
mls qos srr-queue output dscp-map queue 3 threshold 3 16 17 18 19 20 21 22 23
mls qos srr-queue output dscp-map queue 3 threshold 3 32 33 34 35 36 37 38 39
mls qos srr-queue output dscp-map queue 4 threshold 1 8
mls qos srr-queue output dscp-map queue 4 threshold 2 9 10 11 12 13 14 15
mls qos srr-queue output dscp-map queue 4 threshold 3 0 1 2 3 4 5 6 7
mls qos queue-set output 1 threshold 1 138 138 92 138
mls qos queue-set output 1 threshold 2 138 138 92 400
mls qos queue-set output 1 threshold 3 36 77 100 318
mls qos queue-set output 1 threshold 4 20 50 67 400
mls qos queue-set output 2 threshold 1 149 149 100 149
mls qos queue-set output 2 threshold 2 118 118 100 235
mls qos queue-set output 2 threshold 3 41 68 100 272
mls qos queue-set output 2 threshold 4 42 72 100 242
mls qos queue-set output 1 buffers 10 10 26 54
mls qos queue-set output 2 buffers 16 6 17 61
mls qos
!
...
!
class-map match-all AutoQoS-VoIP-RTP-Trust
match ip dscp ef
class-map match-all AutoQoS-VoIP-Control-Trust
match ip dscp cs3 af31
!!
policy-map AutoQoS-Police-CiscoPhone
class AutoQoS-VoIP-RTP-Trust
set dscp ef
police 320000 8000 exceed-action policed-dscp-transmit
class AutoQoS-VoIP-Control-Trust
set dscp cs3
police 32000 8000 exceed-action policed-dscp-transmit
!
interface FastEthernet1/0/13
description *** REMOTE HQ PHONE ***
switchport access vlan 12
switchport mode access
switchport voice vlan 11
switchport priority extend cos 1
srr-queue bandwidth share 10 10 60 20
priority-queue out
mls qos trust device cisco-phone
mls qos trust cos
auto qos voip cisco-phone
spanning-tree portfast
service-policy input AutoQoS-Police-CiscoPhone
!
你可以看到,交换机添加的配置:policed-dscp map,cos-dscp map,srr-queues,queue-sets,class-maps,policy-maps等等。自动QoS包含命令:mls qos map cos-dscp 0 8 16 24 32 46 48 56。我们现在只要改变一个值(COS 4–34)代替两个。
任务还要求确保前面的任务功能仍然起作用。我们必须修改COS-DSCP map,使用前面的任务最初配置的值。并且在电话的交换端口上移除mls qos trust cos命令,因为附加的PC应该使用COS 1(我们不应该信任这个PC)。
SW1
SW1(config)#mls qos map cos-dscp 0 8 16 24 34 46 48 56
SW1(config)#int fa1/0/13
SW1(config-if)#no mls qos trust cos |
|