thinkhk 发表于 2018-7-19 13:00:37

Cisco 端口策略检测

  CISCO交换机默认是起用错误检测的,检测到任何错误时,关闭端口。默认的检测类型是全部都检测,具体可以检测的类型有下面的几种:
  RT4(config)#errdisable detect cause
  all Enable error detection on all cases
  arp-inspection Enable error detection for arp inspection
  dhcp-rate-limit Enable error detection on dhcp-rate-limit
  dtp-flap Enable error detection on dtp-flapping
  gbic-invalid Enable error detection on gbic-invalid
  l2ptguard Enable error detection on l2protocol-tunnel
  link-flap Enable error detection on linkstate-flapping
  loopback Enable error detection on loopback
  pagp-flap Enable error detection on pagp-flapping
  自动检测非常烦,遇到错误就会自动把端口关闭。如果不想启动错误检测,可以用命令no errdisable detect cause all来关闭。
  如果想检测一部分内容,不想检测另一部分,可以用下面的命令来关闭其中的检测项目
  RT4(config)#no errdisable detect cause ?
  all Enable error detection on all cases
  arp-inspection Enable error detection for arp inspection
  dhcp-rate-limit Enable error detection on dhcp-rate-limit
  dtp-flap Enable error detection on dtp-flapping
  gbic-invalid Enable error detection on gbic-invalid
  l2ptguard Enable error detection on l2protocol-tunnel
  link-flap Enable error detection on linkstate-flapping
  loopback Enable error detection on loopback
  pagp-flap Enable error detection on pagp-flapping
  CISCO还提供了自动恢复机制。默认自动恢复机制不启动,即关闭了端口不会打开。如果想让交换机关闭了端口一段时间后自动打开,可以用下面的命令来设置各具体项。all参数表示所有的类型都可以关闭一段时间后,自动打开。
  RT4(config)#errdisable recovery cause ?
  all Enable timer to recover from all causes
  arp-inspection Enable timer to recover from arp inspection error disable
  state
  bpduguard Enable timer to recover from BPDU Guard error disable
  state
  channel-misconfig Enable timer to recover from channel misconfig disable
  state
  dhcp-rate-limit Enable timer to recover from dhcp-rate-limit error
  disable state
  dtp-flap Enable timer to recover from dtp-flap error disable state
  gbic-invalid Enable timer to recover from invalid GBIC error disable
  state
  l2ptguard Enable timer to recover from l2protocol-tunnel error
  disable state
  link-flap Enable timer to recover from link-flap error disable
  state
  loopback Enable timer to recover from loopback disable state
  pagp-flap Enable timer to recover from pagp-flap error disable
  state
  psecure-violation Enable timer to recover from psecure violation disable
  state
  security-violation Enable timer to recover from 802.1x violation disable
  state
  storm-control Enable timer to recover from storm-control error disable
  state
  udld Enable timer to recover from udld error disable state
  unicast-flood Enable timer to recover from unicast flood disable state
  vmps Enable timer to recover from vmps shutdown error disable
  state
  默认的关闭时间是30秒,时间过后自动打开。可以通过命令RT4(config)#errdisable recovery interval<30-86400> timer-interval(sec)
  来调整这个时间。
  大家在调试中注意,判断时,可以通过命令sh interface 看,会有“err-disable”的字样。
  导致交换机接口出现err-disable的几个常见原因:
  引用
  1.EtherChannelmisconfiguration
  2.Duplexmismatch
  3.BPDUportguard
  4.UDLD
  5.Link-flaperror
  6.Loopbackerror
  7.Portsecurityviolation
  第一个当FEC两端配置不匹配的时候就会出现err-disable。
  假设SwitchA把FEC模式配置为on,这时SwitchA是不会发送PAgP包和相连的SwitchB去协商FEC的,它假设SwitchB已经配置好FEC了。但实事上Swtich B并没有配置FEC,当Switch B的这个状态超过1分钟后,SwitchA的STP就认为有环路出现,因此也就出现了err-disable。解决办法就是把FEC的模式配置为channel-group 1 modedesirable non-silent这个意思是只有当双方的FEC协商成功后才建立channel,否则接口还处于正常状态。
  第二个原因就是双工不匹配。一端配置为half-duplex后,他会检测对端是否在传输数据,只有对端停止传输数据,他才会发送类似于ack的包 来让链路up,但对端却配置成了full-duplex,他才不管链路是否是空闲的,他只会不停的发送让链路up的请求,这样下去,链路状态就变成err-disable了。
  三、第三个原因BPDU,也就是和portfast和BPDUguard有关。如果一个接口配置了portfast,那也就是说这个接口应该和一个 pc连接,pc是不会发送spanning-tree的BPDU帧的,因此这个口也接收BPDU来生成spanning-tree,管理员也是出于好心在同一接口上配置了BPDUguard来防止未知的BPDU帧以增强安全性,但他恰恰不小心把一个交换机接到这个同时配置了portfast和BPDUguard 接口上,于是这个接口接到了BPDU帧,因为配置了BPDUguard,这个接口自然要进入到err-disable状态。解决办法:no spanning-tree portfast bpduguarddefault,或者直接把portfast关了。
  第四个原因是UDLD。UDLD是cisco的私有2层协议,用于检测链路的单向问题。有的时候物理层是up的,但链路层就是down,这时候就需 要UDLD去检测链路是否是真的up的。当AB两端都配置好UDLD后,A给B发送一个包含自己portid的UDLD帧,B收到后会返回一个UDLD帧, 并在其中包含了收到的A的portid,当A接收到这个帧并发现自己的portid也在其中后,认为这链路是好的。反之就变成err-disable状态 了。假设A配置了UDLD,而B没有配置UDLD:A给B发送一个包含自己portid的帧,B收到后并不知道这个帧是什么,也就不会返回一个包含A的portid的UDLD帧,那么这时候A就认为这条链路是一个单向链路,自然也就变成err-disable状态了。
  第五个原因就是链路的抖动,当链路在10秒内反复up、down五次,那么就进入err-disable状态。
  第六个原因就是keepaliveloopback。在12.1EA之前,默认情况下交换机会在所有接口都发送keepalive信息,由于一些不 通交换机协商spanning-tree可能会有问题,一个接口又收到了自己发出的keepalive,那么这个接口就会变成err-disable了。 解决办法就是把keepalive关了。或者把ios升到12.2SE。
  最后一个原因,相对简单,就是由于配置了port-securityviolationshutdown。这个太简单,就不解释啦。
页: [1]
查看完整版本: Cisco 端口策略检测