Cisco 路由器 NAT负载过高分析

登陆路由后,用 神码的为show cpu (思科命令show prccess cpu)可查看CPU负载情况.

  负载过高一般是由于某些电脑使用了BT、电驴等P2P软件或网络中有病毒向外大量发包造成的.

  此处以手边的神码2661为例:

  使用show ip nat stat 查看NAT的总条数.了解一下情况.

  使用show ip nat tran 查看当前NAT的详细情况.要注意此时哪些IP的条目过多.记下来.以便于下面对它们处理.

  如:ip nat translation max-links 172.16.0.250 25 将该IP的最大连接限制为25条,当然也可根据实际情况来设.呵呵.扼其要害呀.

  也可以对所有IP限制连接如: ip nat translation max-links all 80 限制为80条.

  还有限制路由器NAT条目的最大数如:ip nat translation max-entries 5000

  这几条命令特管用!!

  还有就是: 调整NAT表项超时时间,设置过短可能会影响应用,如在线游戏等等.一般在线游戏如《传奇》等,都使用UDP报文,将UDP报文超时设置大一点.具体设置需要向用户了解应用,分析应用特点,如是用TCP还是UDP还是ICMP?是大量小数据包还是大量数据传输类型?是否频繁有数据交互?这些问题涉及到路由器工作时的状态,如NAT表项占用太多内存,CPU占用率是否太高等等,表现出来就是:是否经常有用户不能上线?是否在线游戏老是掉线?这些问题需要和用户很好地协商才能解决.

  用户一般都是直接关闭应用程序,导致TCP连接未能友好关闭,网络上存在大量未 FIN/RST 的TCP半开连接.按照默认,Cisco 24 小时才会将这种 TCP nat 表项删除,BD 为 1 个小时,神州数码为 10分钟.

  消除这种无用表项利于路由器内存使用量.

  一般一个TCP连接3-5分钟没有传送任何数据,那么很可能就是这种半开的“死”连接,我们将ip nat transaction tcp-timeout设置为180-300即可,具体数据通过在用户处多测试几次,等到效果用户可接受为止.

  ip nat translation dns-timeout 20

  ip nat translation finrst-timeout 5

  ip nat translation syn-timeout 10

  ip nat translation tcp-timeout 180

  ip nat translation timeout 45

  ip nat translation udp-timeout 20

  配置如下:

  show run

  Building configuration...

  Current configuration:

  !

  !version 1.3.2D

  service timestamps log date

  service timestamps debug date

  service password-encryption

  !

enable password 7 101D433D384F6745783B level 15

  !

  interface FastEthernet1/0

  ip address 10.9.*.2 255.255.255.252

  no ip directed-broadcast

  ip access-group protect in

  ip access-group protect out

  ip nat outside

  !

  interface FastEthernet1/1

  ip address 172.16.0.1 255.255.0.0

  no ip directed-broadcast

  ip nat inside

  !

  interface Async0/0

  no ip address

  no ip directed-broadcast

  !

  ip route default 10.9.*.1

  !

  gateway-cfg

  Gateway keepAlive 60

  shutdown

  !

  !

  ip access-list standard one

  permit 172.16.0.0 255.255.0.0

  !

  ip access-list extended protect

  deny tcp any any eq 135

  deny udp any any eq 139

  deny tcp any any eq 139

  deny udp any any eq 135

  deny tcp any any eq 445

  deny udp any any eq 445

  deny tcp any any eq 593

  deny udp any any eq 593

  deny udp any any eq 1434

  deny udp any any eq tftp

  deny tcp any any eq 4444

  permit ip any any

  !

  ivr-cfg

  !

  ip nat translation max-entries 5000

  ip nat translation max-links all 80

  ip nat translation max-links 172.16.0.250 25

  ip nat inside source static tcp 172.16.0.252 80 10.9.*.2 80

  ip nat inside source list one interface FastEthernet1/0

  !

  对了,NAT的具体命令与IOS的版本有关系. 还有命令可能多少有些差别.可以用ip nat trans ? 查看具体情况.

  好了.希望在所收获..呵呵....

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值