思科交换机端口限速实战

网络 路由交换
本文通过一个实例详细的介绍了配置思科交换机端口限速的全过程。

简介

CISCO3550交换机作为我们单位的核心网络交换机,已经稳定运行了多年,功能上也能满足我们的需求,但是其端口限速功能却不像其它的一些交换机那样容易实现,好在最近找到了实现的办法,配置完成后,配合iperf这款测速软件进行验证,结果证明这个方法是行之有效的,下面是具体实现步骤。

一、创建ACL

由于这是一台三层交换机,所以虽然是对端口进行限速,但是还要考虑这个端口上通过的网络地址,本例中,我们选择对CISCO3550交换机的第22口进行限速,该端口属于VLAN66,IP地址段为10.66/16,所以首先要创建一个ACL,如下所示:

  1. 3550#conf t  
  2.  
  3. Enter configuration commands, one per line. End with CNTL/Z.  
  4.  
  5. 3550(config)#access-list 15 permit 10.66.0.0 0.0.255.255 

二、创建class-map

  1. 3550#conf t  
  2.  
  3. Enter configuration commands, one per line. End with CNTL/Z.  
  4.  
  5. 3550(config)#class-map dkxs  
  6.  
  7. 3550(config-cmap)#match access-group 15 

这一步操作的主要目的就是创建了一个class-map,在这里面引用了我们事先创建好的ACL 15,方便我们以后对22端口进行操作。

三、创建policy-map

出于测试的需要,我们创建了多个policy-map,分别设置不同的限制带宽,如80k,1m,5m,10m,分别如下:

  1. 3550#conf t  
  2.  
  3. Enter configuration commands, one per line. End with CNTL/Z.  
  4.  
  5. 3550(config)#policy-map 80k  
  6.  
  7. 3550(config-pmap)#class dkxs  
  8.  
  9. 3550(config-pmap-c)# police 80000 8000 exceed-action drop  
  10.  
  11. 3550#conf t  
  12.  
  13. Enter configuration commands, one per line. End with CNTL/Z.  
  14.  
  15. 3550(config)#policy-map 1m  
  16.  
  17. 3550(config-pmap)#class dkxs  
  18.  
  19. 3550(config-pmap-c)# police 1000000 100000 exceed-action drop  
  20.  
  21. 3550#conf t  
  22.  
  23. Enter configuration commands, one per line. End with CNTL/Z.  
  24.  
  25. 3550(config)#policy-map 5m  
  26.  
  27. 3550(config-pmap)#class dkxs  
  28.  
  29. 3550(config-pmap-c)# police 5000000 500000 exceed-action drop  
  30.  
  31. 3550#conf t  
  32.  
  33. Enter configuration commands, one per line. End with CNTL/Z.  
  34.  
  35. 3550(config)#policy-map 10m  
  36.  
  37. 3550(config-pmap)#class dkxs  
  38.  
  39. 3550(config-pmap-c)# police 10000000 1000000 exceed-action drop 

四、查看配置信息

  1. 3550#show run  
  2.  
  3. policy-map 5m  
  4.  
  5. class dkxs  
  6.  
  7. police 5000000 500000 exceed-action drop  
  8.  
  9. policy-map 1m  
  10.  
  11. class dkxs  
  12.  
  13. police 1000000 100000 exceed-action drop  
  14.  
  15. policy-map 80k  
  16.  
  17. class dkxs  
  18.  
  19. police 80000 8000 exceed-action drop  
  20.  
  21. policy-map 10m  
  22.  
  23. class dkxs  
  24.  
  25. police 10000000 1000000 exceed-action drop 

#p#

五、通过iperf软件进行验证

即先在一台服务器上运行iperf的服务器端,命令如下:

  1. F:\tools>iperf -s  
  2.  
  3. ------------------------------------------------------------  
  4.  
  5. Server listening on TCP port 5001  
  6.  
  7. TCP window size: 8.00 KByte (default)  
  8.  
  9. ------------------------------------------------------------ 

然后在交换机的22口上分别应用表示不同速率的policy-map,每应用一次,通过一台连接到22端口的笔记本电脑运行iperf的客户端,进行端口速率测试,结果分别如下:

(交换机设置)

  1. 3550(config-if)#service-policy input 80k 

(IPERF客户端测试结果)

  1. F:\tools>iperf -c 10.66.66.8  
  2.  
  3. ------------------------------------------------------------  
  4.  
  5. Client connecting to 10.66.66.8, TCP port 5001  
  6.  
  7. TCP window size: 8.00 KByte (default)  
  8.  
  9. ------------------------------------------------------------  
  10.  
  11. [1912] local 10.66.123.66 port 1147 connected with 10.66.66.8 port 5001  
  12.  
  13. [ ID] Interval Transfer Bandwidth  
  14.  
  15. [1912] 0.0-12.5 sec 104 KBytes 68.3 Kbits/sec  
  16.  
  17. F:\tools>iperf -c 10.66.66.8  
  18.  
  19. ------------------------------------------------------------  
  20.  
  21. Client connecting to 10.66.66.8, TCP port 5001  
  22.  
  23. TCP window size: 8.00 KByte (default)  
  24.  
  25. ------------------------------------------------------------  
  26.  
  27. [1912] local 10.66.123.66 port 1151 connected with 10.66.66.8 port 5001  
  28.  
  29. [ ID] Interval Transfer Bandwidth  
  30.  
  31. [1912] 0.0-12.0 sec 104 KBytes 70.8 Kbits/sec 

(交换机设置)

  1. 3550(config-if)#service-policy input 1m 

(IPERF客户端测试结果)

  1. F:\tools>iperf -c 10.66.66.8  
  2.  
  3. ------------------------------------------------------------  
  4.  
  5. Client connecting to 10.66.66.8, TCP port 5001  
  6.  
  7. TCP window size: 8.00 KByte (default)  
  8.  
  9. ------------------------------------------------------------  
  10.  
  11. [1912] local 10.66.123.66 port 1155 connected with 10.66.66.8 port 5001  
  12.  
  13. [ ID] Interval Transfer Bandwidth  
  14.  
  15. [1912] 0.0-10.5 sec 1.08 MBytes 860 Kbits/sec  
  16.  
  17. F:\tools>iperf -c 10.66.66.8  
  18.  
  19. ------------------------------------------------------------  
  20.  
  21. Client connecting to 10.66.66.8, TCP port 5001  
  22.  
  23. TCP window size: 8.00 KByte (default)  
  24.  
  25. ------------------------------------------------------------  
  26.  
  27. [1912] local 10.66.123.66 port 1159 connected with 10.66.66.8 port 5001  
  28.  
  29. [ ID] Interval Transfer Bandwidth  
  30.  
  31. [1912] 0.0-10.0 sec 1.09 MBytes 910 Kbits/sec 

(交换机设置)

  1. 3550(config-if)#service-policy input 5m 

(IPERF客户端测试结果)

  1. F:\tools>iperf -c 10.66.66.8  
  2.  
  3. ------------------------------------------------------------  
  4.  
  5. Client connecting to 10.66.66.8, TCP port 5001  
  6.  
  7. TCP window size: 8.00 KByte (default)  
  8.  
  9. ------------------------------------------------------------  
  10.  
  11. [1912] local 10.66.123.66 port 1163 connected with 10.66.66.8 port 5001  
  12.  
  13. [ ID] Interval Transfer Bandwidth  
  14.  
  15. [1912] 0.0-10.5 sec 5.84 MBytes 4.67 Mbits/sec  
  16.  
  17. F:\tools>iperf -c 10.66.66.8  
  18.  
  19. ------------------------------------------------------------  
  20.  
  21. Client connecting to 10.66.66.8, TCP port 5001  
  22.  
  23. TCP window size: 8.00 KByte (default)  
  24.  
  25. ------------------------------------------------------------  
  26.  
  27. [1912] local 10.66.123.66 port 1167 connected with 10.66.66.8 port 5001  
  28.  
  29. [ ID] Interval Transfer Bandwidth  
  30.  
  31. [1912] 0.0-10.7 sec 5.98 MBytes 4.68 Mbits/sec 

(交换机设置)

  1. 3550(config-if)#service-policy input 10m 

(IPERF客户端测试结果)

  1. F:\tools>iperf -c 10.66.66.8  
  2.  
  3. ------------------------------------------------------------  
  4.  
  5. Client connecting to 10.66.66.8, TCP port 5001  
  6.  
  7. TCP window size: 8.00 KByte (default)  
  8.  
  9. ------------------------------------------------------------  
  10.  
  11. [1912] local 10.66.123.66 port 1171 connected with 10.66.66.8 port 5001  
  12.  
  13. [ ID] Interval Transfer Bandwidth  
  14.  
  15. [1912] 0.0-10.1 sec 11.8 MBytes 9.83 Mbits/sec  
  16.  
  17. F:\tools>iperf -c 10.66.66.8  
  18.  
  19. ------------------------------------------------------------  
  20.  
  21. Client connecting to 10.66.66.8, TCP port 5001  
  22.  
  23. TCP window size: 8.00 KByte (default)  
  24.  
  25. ------------------------------------------------------------  
  26.  
  27. [1912] local 10.66.123.66 port 1175 connected with 10.66.66.8 port 5001  
  28.  
  29. [ ID] Interval Transfer Bandwidth  
  30.  
  31. [1912] 0.0-10.2 sec 12.0 MBytes 9.87 Mbits/sec 

为了使测试的结果更准确,每种速率下都进行了两次测试,从测试的结果看,端口限速确实生效了。【编辑推荐】

  1.  Secpath典型配置之访问控制列表(ACL)
  2. 更改公用文件夹ACL(访问控制列表)
  3. 访问控制列表ACL技术
责任编辑:佚名 来源: 比特网
相关推荐

2009-07-20 09:59:35

华为交换机端口限速华为认证

2010-01-08 16:36:12

华为交换机端口限速

2010-01-11 16:22:59

交换机端口限速

2010-01-19 10:31:20

思科交换机模块

2013-08-27 09:47:09

QOS限速思科交换机

2010-03-16 14:35:53

思科交换机模块

2010-01-13 16:47:02

思科交换机模块

2010-01-18 15:22:47

交换机MAC地址

2010-01-04 16:52:51

2011-03-09 14:00:21

trunkVLAN

2010-01-08 10:54:25

2010-01-25 14:49:18

思科刀片交换机

2013-04-09 15:36:19

交换机交换机端口设备端口模式

2010-03-17 13:42:58

交换机端口

2010-03-22 17:08:00

交换机端口

2011-12-06 10:06:12

交换机端口

2011-09-02 14:59:15

2009-07-16 09:37:37

CCNA思科交换机

2010-01-05 17:33:02

Catalyst交换机

2010-01-26 10:51:27

思科VLAN交换机
点赞
收藏

51CTO技术栈公众号