步驟一:定義标準通路控制清單
S3760>en
S3760#conf
S3760(config)#ip access-list standard vlan10 ----定義标準通路控制清單
s3760(config-std-nacl)#permit host 192.168.1.0
S3760(config)#ip access-list standard vlan20 ----定義标準通路控制清單
s3760(config-std-nacl)#permit host 192.168.2.0
步驟二:建立規則類,應用之前定義的主機範圍
S3760(config)#class-map vlan10 ----建立class-map,名字為xiansu101
S3760(config-cmap)#match access-group vlan10 ----比對IP位址
S3760(config-cmap)#exit
S3760(config)#class-map vlan20 ----建立class-map,名字為xiansu102
S3760(config-cmap)#match access-group vlan20 ----比對IP位址
步驟三:建立政策類:應用之前定義的規則,配置限速大小
S3760(config)#policy-map xiansu ----建立policy-map,名字為xiansu
S3760(config-pmap)#class vlan10 ----符合class xiansu101
S3760(config-pmap-c)#police 64 64 exceed-action drop ----限制64Kbit
S3760(config-pmap)#class vlan20 ----符合class xiansu102
S3760(config-pmap-c)#police 64 64 exceed-action drop ----限速值為4000Kbit
S3760(config-pmap-c)#end
為了效果明顯,限制為最小速度
步驟四:進入接口,應用之前定義的政策
S3760(config)#int fa 0/6,11 ----進入接口
S3760(config-if)#service-policy input xiansu ----将該限速政策應用在這個接口上
配置檔案,已經自行劃分vlan配置好ip
s3760(config)#show run
Building configuration...
Current configuration : 2358 bytes
!
version RGOS 10.4(2) Release(75955)(Mon Jan 25 19:33:15 CST 2010 -ngcf31)
hostname s3760
nfpp
vlan 1
vlan 10
vlan 20
no service password-encryption
ip access-list standard vlan10
20 permit host 192.168.1.0
ip access-list standard vlan20
20 permit host 192.168.2.0
class-map vlan10
match access-group vlan10
class-map vlan20
match access-group vlan20
policy-map xiansu
class vlan10
police 64 64 exceed-action drop
class vlan20
interface FastEthernet 0/1
switchport access vlan 10
interface FastEthernet 0/2
interface FastEthernet 0/3
interface FastEthernet 0/4
interface FastEthernet 0/5
interface FastEthernet 0/6
service-policy input xiansu
interface FastEthernet 0/7
interface FastEthernet 0/8
interface FastEthernet 0/9
interface FastEthernet 0/10
interface FastEthernet 0/11
switchport access vlan 20
interface FastEthernet 0/12
interface FastEthernet 0/13
interface FastEthernet 0/14
interface FastEthernet 0/15
interface FastEthernet 0/16
interface FastEthernet 0/17
interface FastEthernet 0/18
interface FastEthernet 0/19
interface FastEthernet 0/20
interface FastEthernet 0/21
interface FastEthernet 0/22
interface FastEthernet 0/23
interface FastEthernet 0/24
interface GigabitEthernet 0/25
interface GigabitEthernet 0/26
interface VLAN 10
no ip proxy-arp
ip address 192.168.1.1 255.255.255.0
interface VLAN 20
ip address 192.168.2.1 255.255.255.0
line con 0
line vty 0 4
login