Skip to main content

思科路由器对指定IP限流

show process cpu sorted | ex 0.00

发现CPU负载接近100%


sh ip nat statistics
show ip cache flow  查看ip是否有异常流量
发现192.168.0.21有大量异常流量
全局限制连接数
ip nat translation max-entri all-host 1000  限制单一IP连接数为1000
NAT 会话长时间不释放会导致 NAT 表膨胀,增加 CPU 负担。降低超时时间可以缓解:
ip nat translation timeout 120
ip nat translation tcp-timeout 300
ip nat translation udp-timeout 60
ip nat translation finrst-timeout 30
120 秒:全局 NAT 连接超时。
300 秒:TCP 连接超时(默认 86400 秒)。
60 秒:UDP 连接超时。
30 秒:TCP FIN/RST 连接超时,加速 NAT 连接回收。

禁用0.21上网后,cpu负载降下来,然后取消禁用

禁用上网命令,已取消
access-list 121 deny ip host 192.168.0.21 any
access-list 121 permit ip any any
interface GigabitEthernet0/1
ip access-group 121 in

对0.21进行QOS限流,限速1024kbps



access-list 21 permit ip host 192.168.0.21 any


class-map match-any LIMIT_021
match access-group 21

policy-map POLICE_021
class LIMIT_021
  police 1024000 conform-action transmit exceed-action drop

interface GigabitEthernet0/1
service-policy input POLICE_021