实验要求:给上一个实验所定义的3种流量,QQ,SMTP,FTP分配不同的带宽
1 定义流量 (直接调用上一个实验的配置)
R1()#class-map QQ
R1(config-cmap)#match access-group name QQ //匹配一个名为QQ的命名ACL
R1(config-cmap)#exit
R1(config)#ip access-list extended QQ
R1(config-ext-nacl)#permit ip 61.172.240.0 0.0.0.255
R1(config-ext-nacl)#permit udp any any eq 4000
R1(config-ext-nacl)#permit udp any any eq 8000
R1(config-ext-nacl)#exit
R1(config)#class-map smtp
R1(config-cmap)#match access-group 100
R1(config-cmap)#exit
R1(config)#access-list 100 permit tcp any any eq smtp
R1(config)#class-map ftp
RR1(config-cmap)#match access-group 101
R1(config-cmap)#exit
R1(config)#access-list 101 permit tcp any any eq 20
R1(config)#access-list 101 permit tcp any any eq 21
2 定义策略
R1(config)#policy-map CBWFQ
R1(config-pmap)#class QQ
R1(config-pmap-c)#bandwidth percent 50 //为类型为QQ的流量分配50%的带宽
R1(config-pmap-c)#class smtp
R1(config-pmap-c)#bandwidth percent 25
R1(config-pmap-c)#class ftp
R1(config-pmap-c)#bandwidth percent 20
R1(config-pmap-c)#exit
3:应用到接口上
R1(config)#int s2/0
R1(config-if)#service-policy ?
history Keep history of QoS metrics
input Assign policy-map to the input of an interface
output Assign policy-map to the output of an interface
R1(config-if)#service-policy output CBWFQ
//进来或出来都可以.
4:验证:
R1#show policy-map
Policy Map CBWFQ
Class QQ
Bandwidth 50 (%) Max Threshold 64 (packets)
Class smtp
Bandwidth 25 (%) Max Threshold 64 (packets)
Class ftp
Bandwidth 20 (%) Max Threshold 64 (packets)