rate-limit詳解

  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

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等。

配置指定的訪問速率和分佈式訪問速率策略,你可以使用rate-limit 端口配置命令.
移除rate limit配置,在原命令上加上no移除.
指令:
rate-limit {input | output} [access-group [rate-limit] acl-index] bps burst-
normal burst-max conform-action conform-action exceed-action exceed-action
no rate-limit {input | output} [access-group [rate-limit] acl-index] bps burst-
normal burst-max conform-action conform-action exceed-action conform-action
參數描述: input?? ??在入口上對接受的packets應用一個訪問速率策略
output ?? 在出口上對發送的packets應用一個訪問速率策略
access-group 可選項,在指定的訪問控制列表上應用訪問速率策略 --通常在對指定的ip和應用程序
限速的情況下使用
rate-limit 可選項,這個是rate-limit訪問控制策略
acl-index 可選項,Access list number.
bps 平均速率(bits/每秒),爲8kbp的倍數
burst-normal 普通的最大速率,The minimum value is bps divided by 2000.
burst-max 非正常時的最大速率(單位字節)
conform-action 相應的行爲動作
1.continue --Evaluates the next rate-limit command.
2.drop 丟棄該包
3.set-dscp-continue -----Sets the differentiated services code point (DSCP) (0
to 63) and evaluate the next rate-limit command.
4.set-dscp-transmit―------Sends the DSCP and transmit the packet.
5.set-mpls-exp-transmit―--Sets the MPLS experimental bits (0 to 7) and sends
the packet.
6.set-prec-continue―---Sets the IP precedence (0 to 7) and evaluates the next
rate-limit command.
7.set-qos-continue―---Sets the QoS group ID (1 to 99) and evaluates the next
rate-limit command.
8.transmit―---Sends the packet.
exceed-action--------Action to take on packets that exceed the specified rate
limit. Specify one of the following keywords:
1.continue―--Evaluates the next rate-limit command.
2.drop―--Drops the packet.
3.set-dscp-continue―--Sets the DSCP (0 to 63) and evaluates the next rate-
limit command.
4.set-dscp-transmit―--Sends the DSCP and sends the packet.
5.set-mpls-exp-continue―--Sets the MPLS experimental bits (0 to 7) and
evaluates the next rate-limit command.
6.set-mpls-exp-transmit―--Sets the MPLS experimental bits (0 to 7) and sends
the packet.
7.set-prec-continue―--Sets the IP precedence (0 to 7) and evaluates the next
rate-limit command.
8.set-prec-transmit―--Sets the IP precedence (0 to 7) and sends the packet.
9.set-qos-continue―--Sets the QoS group ID (1 to 99) and evaluates the next
rate-limit command.
10.set-qos-transmit―--Sets the QoS group ID (1 to 99) and sends the packet.
11.transmit―--Sends the packet.
默認情況下: 訪問速率和分佈式訪問速率策略are disabled.
命令模式:
Interface configuration
Command History
Release Modification
11.1 CC This command was introduced.
12.1(5)T The conform and exceed actions were added for the MPLS experimental
field.
Usage Guidelines
使用多個訪問速率策略, 在不同的interface下輸入
分佈式訪問速率策略只在 Cisco 7000 series routers with an RSP7000 或者Cisco 7500
series routers with VIP2-40 or greater interface processor下能夠使用. A VIP2-50
interface processor is strongly recommended when the aggregate line rate of
the port adapters on the VIP is greater than DS3. A VIP2-50 interface
processor is required for OC-3 rates.
訪問速率和分佈式訪問速率策略只能對ip傳輸可用. 訪問速率和分佈式訪問速率策略不支持Fast
EtherChannel, tunnel, 或者 PRI interfaces, 也不支持任何不支持Cisco快速轉發(CEF)上的
接口.
Cisco快速轉發必須在配置訪問速率和分佈式訪問速率策略前先enabled.
Examples
In the following example, the rate is limited by application:
All World Wide Web traffic is sent. However, the MPLS experimental field for
web traffic that conforms to the first rate policy is set to 5. For
nonconforming traffic, the IP precedence is set to 0 (best effort). See the
following commands in the example:
rate-limit input rate-limit access-group 101 20000000 24000 32000 conform-
action
set-mpls-exp-transmit 5 exceed-action set-mpls-exp-transmit 0
access-list 101 permit tcp any any eq www
FTP traffic is sent with an MPLS experimental field of 5 if it conforms to the
second rate policy. If the FTP traffic exceeds the rate policy, it is dropped.
See the following commands in the example:
rate-limit input access-group 102 10000000 24000 32000
conform-action set-mpls-exp-transmit 5 exceed-action drop
access-list 102 permit tcp any any eq ftp
Any remaining traffic is limited to 8 Mbps, with a normal burst size of 16,000
bytes and an excess burst size of 24000 bytes. Traffic that conforms is sent
with an MPLS experimental field of 5. Traffic that does not conform is
dropped. See the following command in the example:
rate-limit input 8000000 16000 24000 conform-action set-mpls-exp-transmit 5
exceed-action drop
Notice that two access lists are created to classify the web and FTP traffic
so that they can be handled separately by the CAR feature:
interface Hssi0/0/0
description 45Mbps to R2
rate-limit input rate-limit access-group 101 20000000 24000 32000
conform-action set-mpls-exp-transmit 5 exceed-action set-mpls-exp-transmit 0
rate-limit input access-group 102 10000000 24000 32000
conform-action set-mpls-exp-transmit 5 exceed-action drop
rate-limit input 8000000 16000 24000 conform-action
set-mpls-exp-transmit 5 exceed-action drop
ip address 200.200.14.250 255.255.255.252
!
access-list 101 permit tcp any any eq www
access-list 102 permit tcp any any eq ftp
In the following example, the MPLS experimental field is set and the packet is
sent:
interface FastEtheret1/1/0
rate-limit input 8000 1000 1000 access-group conform-action
set mpls-exp-transmit 5 exceed-action set-mpls-exp-transmit 5 
posted @ 2009-08-21 09:11 yitongtianxia 閱讀(32) | 評論 (0) |
2009年8月20日
端口帶寬限制
端口帶寬限制

網絡傳輸速率變慢的主要原因,往往是某些用戶對網絡的濫用。當使用MRTG等流量監控軟件檢測到流量來源於某個端口時,可以在覈心交換機、匯聚交換機,甚至接入交換機上,對相應的端口作必要的處理,限制其傳輸帶寬,從而限制每個用戶所允許的最大流量,以便使其他網絡用戶能夠恢復正常的網絡應用服務。

第一步:進入全配置模式。

Switch# config terminal
第二步:指定欲配置的接口。

Switch(config)# interface interface-id
第三步:配置端口帶寬控制。其中,input/output表明在輸入和輸出方向應用該帶寬限制,通常情況下,應當進行雙向限制。access-group acl-index用於定義使用該帶寬限制的訪問列表。bps用於定義限制帶寬,以bps爲單位,並採用8 kbps的增量。burst-normal用於定義所允許的普通突發速率,burst-max用於定義所允許的最大突發速率。conform-action conform-action用於指定在規定最大帶寬時所執行的操作,通常爲transmit,即允許發送。exceed-action exceed-action則用於指定在規定最大帶寬時所執行的操作,通常爲drop,即丟棄。

Switch(config-if)# rate-limit {input | output} [access-group acl-index] bps burst-normal burst-max conform-action conform-action exceed-action exceed-action
第四步:返回特權配置模式。

Switch(config-if)# end
第五步:顯示並校驗該接口當前的配置。

Switch# show interface interface-id
第六步:保存帶寬限制配置。

Switch# copy running-config startup-config

例如,若欲限制GigabitEthernet4/4帶寬爲128 kbps,當連接的普通突發速率、最大突發在8 kBytes(即64 kbps)9 kBytes(即72 kbps)範圍內時,所執行的操作是transmit(傳輸即發送);當超出該範圍時,則相應的操作就是drop。其中,128 000用於限制最大帶寬,8 000和9 000則用於限制突發連接,保證不因個別用戶的大量傳輸而使整個鏈路性能大幅度下降。限制輸入和輸出速率後,該端口配置如下:

interface GigabitEthernet4/4
no switchport
description tushuguan
ip address 211.82.220.9 255.255.255.248
ip access-group 120 in
ip access-group 120 out
rate-limit output access-group 102 128000 8000 9000 conform-action transmit exceed-action drop
rate-limit input access-group 102 128000 8000 9000 conform-action transmit exceed-action drop!

 

IP訪問列表只需設置應用帶寬限制的IP地址範圍(192.168.0.0 ~ 192.168.255.255)即可,內容如下:

access-list 102 permit ip 192.168.0.0 0.0.255.255 any

【注意】 在啓用寬帶限制之前,必須先在全局模式下執行“ip cef”命令,啓用交換機的快速轉發技術。


posted @ 2009-08-20 11:33 yitongtianxia 閱讀(32) | 評論 (0) |
保護端口說明及配置步驟
保護端口
保護端口可以確保同一交換機上的端口之間不進行通信。保護端口不向其他保護端口轉發任何傳輸,包括單播、多播和廣播包。傳輸不能在第二層保護端口間進行,所有保護端口間的傳輸都必須通過第三層設備轉發。保護端口與非保護端口間的傳輸不受任何影響。
第一步:進入全局配置模式。

Switch# config terminal

第二步:指定欲配置的接口。

Switch(config)# interface interface-id
第三步:將接口配置爲保護端口。

Switch(config-if)# switchport protected
第四步:返回特權配置模式。

Switch(config-if)# end
第五步:顯示並校驗該接口當前的配置。

Switch# show interfaces interface-id switchport
第六步:保存配置。

Switch# copy running-config startup-config

若欲禁用保護端口,可以使用“no switchport protected”接口配置命令。


posted @ 2009-08-20 09:06 yitongtianxia 閱讀(7) | 評論 (0) |
端口阻塞的說明及配置步驟
端口阻塞
默認狀態下,未知目的MAC地址的泛洪包被允許從端口向外傳輸。如果未知的單播和多播通信被轉發到保護端口,將導致安全問題。可以採用阻塞端口的方式,防止未知的單播和多播通信被轉在端口間轉發。
第一步:進入全局配置模式。

Switch# config terminal
第二步:指定欲配置的接口。

Switch(config)# interface interface-id
第三步:禁止未知多播從該端口向外傳輸。

Switch(config-if)# switchport block multicast
第四步:禁止未知單播從該端口向外傳輸。

Switch(config-if)# switchport block unicast
第五步:返回特權配置模式。

Switch(config-if)# end
第六步:顯示並校驗該接口當前的配置。

Switch# show interfaces interface-id switchport
第七步:保存配置。

Switch# copy running-config startup-config


posted @ 2009-08-20 08:57 yitongtianxia 閱讀(25) | 評論 (0) |
2009年8月19日
端口安全配置步驟及說明
       藉助安全端口,可以只允許指定的MAC地址或指定數量的MAC地址訪問某個端口,從而避免未經授權的計算機接入網絡,或限制某個端口所連接的計算機數量,從而確保網絡接入的安全。
當配置端口安全時,應當注意以下問題:
1、安全端口不能是Trunk端口。
2、安全端口不能是Switch Port Analyzer (SPAN)的目的端口。
3、安全端口不能是屬於EtherChannel的端口。
4、安全端口不能是private-VLAN端口。
一.配置安全端口
第一步:進入全局配置模式。
Switch# configure terminal
第二步:指定欲配置端口安全的接口。
Switch(config)# interface interface_id
第三步:將接口設置爲訪問模式。
Switch(config-if)# switchport mode access
第四步:在接口啓用端口安全。
Switch(config-if)# switchport port-security
第五步:(可選)在接口設置安全MAC地址的最大數量,以限制該端口所連接的計算機數量。取值範圍爲1~3 072,默認值是1。
Switch(config-if)# switchport port-security maximum value
第六步:(可選)設置違例發生後的處理模式。當安全違例事件發生時,將端口置於restrict或shutdown模式。選擇restrict模式時,當非法MAC地址或太多MAC連接至該接口時,將丟棄數據包,並向網管計算機發送SNMP陷阱通知。選擇shutdown模式時,發生安全錯誤的端口將被置於error-disable狀態,除非網絡管理員使用no shutdown命令手工激活,否則該端口失效。
Switch(config-if)# switchport port-security violation {restrict | shutdown}
第七步:設置壞包速率限制。
Switch(config-if)# switchport port-security limit rate invalid-source-mac
第八步:(可選)爲該接口指定安全MAC地址。也可以使用該命令指定最大安全MAC 地址數。如果指定的MAC地址數量少於安全地址的最大數量,動態學習的MAC地址將被保留。
Switch(config-if)# switchport port-security mac-address mac_address
第九步:在端口啓動sticky learning。
Switch(config-if)# switchport port-security mac-address sticky
第十步:返回特權EXEC模式。
Switch(config-if)# end
第十一步:查看並校驗配置。
Switch# show port-security address interface interface_id
Switch# show port-security address
第十二步:保存當前配置。
Switch# copy running-config startup-config

【注意】 使用no switchport port-security mac-address mac_address命令,可以從地址表中刪除MAC地址。

二、設置端口安全老化
       當爲端口指定最大MAC地址數時,爲了保障該端口能夠得以充分利用,可以採用設置端口安全老化時間和模式的方式,使系統能夠自動刪除長時間未連接的MAC地址,從而不必手動刪除,減少網絡維護的工作量。
第一步:進入全局配置模式。
Switch# configure terminal
第二步:指定欲配置端口安全老化的接口。
Switch(config)# interface interface_id
第三步:爲安全端口設置老化時間和老化類型。老化時間的取值範圍爲0 ~ 1440分鐘。採用absolute模式時,一旦到達指定的老化時間,那麼,即將從安全地址列表中移除。採用inactivity時,即使到達指定的老化時間,如果沒有其他數據通信,那麼,MAC地址仍然被保留在安全地址列表中。
Switch(config-if)# switchport port-security [ aging time aging_time | type {absolute | inactivity} ]
第四步:返回特權EXEC模式。
Switch(config-if)# end
第五步:查看並校驗配置。
Switch# show port security [interface interface_id] [address]
第六步:保存當前配置。
Switch# copy running-config startup-config

設置端口允許的最大安全MAC地址數量後,可採取如下方式將安全MAC地址加入到MAC地址表中:

手工配置所有的地址(switchport port-security mac-address 0008.eeee.eeee);
允許端口動態配置所有地址(switchport port-security mac-address sticky);
配置一定數量的MAC地址,並允許動態地配置餘下的地址。

可對接口啓用粘性學習(sticky learning),使其將動態MAC地址轉換爲粘性安全MAC地址並將其加入到運行配置中。要啓用粘性學習,可使用接口配置命令switchport port-security mac-address sticky。配置該命令後,接口將把所有的動態安全MAC地址(包括啓用粘性學習前動態獲悉的安全MAC地址)轉換爲粘性安全MAC地址。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章