对cisco网络设备的端口限速
在
Cisco
设备中,只有支持思科快速转发(
CEF
,
Cisco
Express
Forward
)的路
由器或交换机才能使用
rate-limit
来限制流量,具体设置分三步
rate-limit input 2048000 8000 16000 conform-action transmit
exceed-action drop
rate-limit output 2048000 8000 16000 conform-action transmit
exceed-action drop
1.
在全局模式下开启
cef
:
configure terminal
Router(config)#ip cef
2.
定义标准或者扩展访问列表(定义一个方向就可以了):
Router(config)#access-list 111 permit ip 192.168.1.0 0.0.0.255 any
3.
在希望限制的端口上进行
rate-limit
:
Router(config)#interface FastEthernet 0/1
Rounter(config-if)#rate-limit
input
access-group
111
2000000
40000
60000
conform-action transmit
exceed-action drop
这样我们就对
192.168.1.0
网段进行了限速,速率为
2Mbps
。注意,是对整个网
段,因为你定义的
ACL
就
是针对整个网段的。
rate-limit
命令格式:
#rate-limit {input|output} 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
等
另外,阻止非法地址的命令是
Router(config)# interface <interface>
Router(if-config)# no ip unreachables
如果此命令不能禁止,可参考下面这个命令
Elab(config)# ip icmp rate-limit unreachable <millisecond
限速:
1
、指定需限速范围:
access-list 110 permit ip 192.168.1.0 0.0.0.255 any
access-list 110 permit ip any 192.168.1.0 0.0.0.255
2
、在
wan
口指定速率:
rate-limit input access-group 110 1024000 128000 128000 conform-action
transmit exceed-action drop
rate-limit
output
access-group
110
1024000
128000
128000
conform-action
transmit exceed-action drop
3
、
ok
。
限恶意端口:
1
、定义扩展访问控制列表:
ip access-list extended BLOCK
deny tcp any any range 135 139
deny tcp any range 135 139 any
deny udp any any range 135 netbios-ss
deny udp any range 135 netbios-ss any
deny tcp any any eq 445
deny udp any eq 445 any
deny tcp any any eq 1433
deny tcp any eq 1433 any
deny udp any any eq 1434
deny udp any eq 1434 any
permit ip any any
2
、把它放在各各端口
in
方向:
#int f0/0
#ip access-group block in
#int f0/1
#ip access-group block in
3
、
ok
前段时间一直有客户问我路由器可不可以做到限制内部某些机子的下行速率,我很自
然的答了句:可以做限速的。其实限速肯定是可以的,但是需要考虑一个具体的问题
一般接入路由器都作了地址转换,但是了解到路由器的操作步骤会发现如下的执行步
骤:
check input rate limits ------->nat outside to inside------->check output rate limits
所以针对内部部分主机做限速策略,由于必须在
ACL
里面指定
inside local
地址,所
以应该在内网接口上应用
service-policy output xxx
,而不是在外网接口上的
service-policy
input xxx
!
下面是一个具体的例子:
Router#sh run
Building configuration...
Current configuration : 1026 bytes
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Router
!
!
ip subnet-zero
!
!
no ip domain lookup
!
!
class-map match-all test-class
match access-group 100
!
!
policy-map speed
class test-class
police cir 80000 bc 32000
conform-action transmit
exceed-action drop
!
!
!
!
!
interface FastEthernet0/0
ip address 192.168.1.111 255.255.255.0
ip nat outside
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 172.16.1.1 255.255.255.0
ip nat inside
duplex auto
speed auto
service-policy output speed
!
ip nat inside source list 1 interface
FastEthernet0/0 overload
!
ip classless
ip route 0.0.0.0 0.0.0.0 192.168.1.1
no ip http server
!
!
access-list 1 permit any
access-list 100 deny ip any host 172.16.1.100
access-list 100 permit ip any any
!
line con 0
line aux 0
line vty 0 4
!
!
end
{:6_267:}{:6_267:}{:6_267:} wowowwo {:6_290:} 有IOS XRv最新版本吗??XRv 5.3?? 多谢。
页:
[1]