2950端口限速配置
Step 1 access-list 1 permit 172.20.10.16
Step 2 class-map videoclass
Step 3 match access-group 1
Step 4 exit
Step 5 policy-map
Step 6 class videoclass
Step 7 police 5000000 8192 exceed-action drop .
Step 8 exit
Step 9 exit
Step 10 interface gigabitethernet0/1
Step 11 service-policy input videopolicy
Step 12 exit
一台2950交换机,要对第二个端口限速,第一个端口是上联交换机端口。
配置如下:
class-map match-all 3M
match access-group 101
!
!
policy-map test
class 3M
police 3000000 32768 exceed-action drop
!
ip subnet-zero
!
spanning-tree extend system-id
!
!
interface FastEthernet0/1
no ip address
!
interface FastEthernet0/2
switchport mode access
no ip address
service-policy input test
!
interface FastEthernet0/3
no ip address
!!
interface Vlan1
no ip route-cache
!
access-list 101 permit ip any any
发现只在第二端口做策略限速不成功,后来在第一个端口也做了数据后限速成功了,请问这是什么原因?
做策略 可以给每个单口一个策略,
if)service-policy input/out name
config)class-map match-all map-name
match xxx
config)policy-map name
class map-name
police cir xxxx
2621限速配置
1. 在全局模式下开启cef:
Router(config)#ip cef
2. 定义标准或者扩展访问列表:
Router(config)#access-list 2 permit 192.168.6.0 0.0.0.255
3. 在希望限制的端口上进行rate-limit:
Rounter(config-if)#rate-limit output access-group 2 128000 16000 16000 conform-action transmit exceed-action drop
这样我们就对192.168.6.0网段进行了限速,速率为128kbps。
下面,重点介绍一下rate-limit的命令格式:
#rate-limit {input|output} [access-group number] bps burst-normal burst-max conform-action action exceed-action action
input|output:这是定义数据流量的方向。
access-group number:定义的访问列表的号码。
bps:定义流量速率的上限,单位是bps。
burst-normal burst-max:定义的数据容量的大小,一般采用8000,16000,32000,单位是字节,当到达的数据超过此容量时,将触发某个动作,丢弃或转发等,从而达到限速的目的。
conform-action和exceed-action:分别指在速率限制以下的流量和超过速率限制的流量的处理策略。
action:是处理策略,包括drop和transmit等。
ip cef
access 2 permit x.x.x.3 0.0.0.0
int f0/1
rate-limit output access-group 2 2048000 256000 256000 conform-action transmit exceed-action drop