交换机端口错包排查方法

.一、重要性: 从网维排查的用户反响网速慢的故障中,相当一局部是由于交换机和交换机端口、交换机端口和用户路由器端口、交换机端口和光电转换器端口、交换机端口和用户网卡匹配不当,产生错包引起的该问题虽然比拟常见,但只要按交换机开局来配置,通常能降低故障发生率,即使还存在端口错包问题,也能通过改端口速度和双工状态来彻底解决 二、交换机端口错包说明: 以华为交换机端口为例进展说明: [NJ-A-GJXC-S3026C-1]dis int eth 0/1 Ethernet0/1 current state : UP IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 000f-e21d-bedc Description: to gujiao_33-192.168.86.161 The Maximum Transmit Unit is 1500 Media type is twisted pair, loopback not set Port hardware type is 100_BASE_TX 100Mbps-speed mode, full-duplex mode Link speed type is force link, link duplex type is force link Flow-control is not enabled Port-flow-constrain has not been configured pletely The Maximum Frame Length is 1536 Broadcast MAX-ratio: 100% PVID: 10 Mdi type: auto Port link-type: hybrid Tagged VLAN ID : , 99 Untagged VLAN ID : , 10, 458 Last 300 seconds input: 0 packets/sec 11 bytes/sec Last 300 seconds output: 7 packets/sec 520 bytes/sec Input(total): 11864483 packets, 6684922188 bytes 66707 broadcasts, 9522 multicasts Input(normal): - packets, - bytes - broadcasts, - multicasts Input: 0 input errors, 0 runts, 0 giants, - throttles, 0 CRC 0 frame, - overruns, 0 aborts, 0 ignored, - parity errors Output(total): 12021069 packets, 5178275457 bytes 3638352 broadcasts, 288120 multicasts, 0 pauses Output(normal): - packets, - bytes - broadcasts, - multicasts, - pauses Output: 0 output errors, - underruns, - buffer failures 0 aborts, 0 deferred, 0 collisions, 0 late collisions 0 lost carrier, - no carrier 如上红字所示: 输入错误数,input errors等于各种重要错误信息的总和。
不同的产品可以根据具体情况增加其它参数,或减少不能实现的参数 1.Runts: discarded packets that are smaller than the medium's minimum packet size. ( Receive Byte Count < 64 and NOT CRC Error or Receive Byte Count < 64 and Tag Packet and NOT CRC Error, 无论是否有vlan tag,数据段小于64字节,而且没有CRC校验错误的帧) 2.Giants: discarded packets that are larger than the medium's maximum packet size. ( Receive Byte Count > 1518 and NOT CRC Error or Receive Byte Count > 1522 and Tag Packet and NOT CRC Error, 没有vlan tag,数据段大于1518字节,小于最大帧长度,而且没有CRC校验错误的帧,和有vlan tag,数据段大于1522字节,小于最大帧长度,而且没有CRC校验错误的帧。
) 3.Throttles: discarded packets that are inplete frames. ( 交换机发觉缓存或CPU过载,关闭接口接收器的情形称为 throttle,是cisco路由器上的一个概念,我们的交换机目前不具备这个功能,一般应该显示为不支持) 4.CRC: discarded packets with checksum error. ( Receive Packet CRC error,帧长度在正常X围〔不带tag,长度在64到1518之间,或带tag,长度在64到1522之间〕,而且CRC校验错,如果支持此项,那么不支持奇偶校验错误项) 5.Frame: discarded packets with frame pad/sequence/alignment error, out of frame etc. 〔 不是整数字节,而是多1~7bit,因此不对齐,或乱序或空帧,而且CRC校验错误,但是不计入CRC错误〕 6.Overrun: the receiver hardware is unable to hand receiveddata to a hardware buffer because the input rate exceeds the receiver'sability to handle the data. 〔 由于接口输入速率超过承受方处理能力,导致丢包,由于我们的交换机一般是线速转发,这项一般应该为0,只有局部交换机对上传CPU或三层线速转发的帧有接口带宽限制,或是通过ACL实现的带宽限制,因此被丢弃的帧,计入此项。
〕 7.Aborts: Input abnormal frames that are discarded. ( 除其他错误之外,产品认为有必要统计的错误,例如前导码异常的帧,计入此项) 8.Ignored: packets that are discarded because the interface hardware does not have enough internal buffers. ( Packetignored,由于接口内部buffer满,丢弃的帧,与由于主系统缓存空间缺乏,导致的丢弃帧不同线速转发的帧,在多接口满带宽输入,单接口输出等情况下,由于输出接口的带宽缺乏,数据帧将内部缓存占满,导致从接口输入的帧在进入内部缓存之前被丢弃,以及进入内部缓存的帧超时无法输出,计入此项,上传到CPU的帧,由于CPU处理能力限制,toCPU的缓存满,导致被丢弃,也计入此项) 9.Parity: Frames with parity error. ( Receive Packet parity error,如果支持此项,那么不支持 CRC 错误项) 输入丢弃数/输入错误数,output errors等于各种重要错误信息的总和。
不同的产品可以根据具体情况增加其它参数,或减少不能实现的参数 1.Underruns: There are no data in the output queue. ( Transmit under run,与 Overrun相反,输出接口的缓存从输出队列中取以太网帧时,没有帧,是一种非常少见的硬件异常有的交换机就没有单独的接口输出缓存,与接口输出队列是同一块缓存) 2.Buffer failures: Hardware does not have enough internal buffers. ( 内部缓存满,如果输出队列满,输出的以太网帧将在内部缓存中暂时存储,由于内部缓存满,导致帧丢弃由于交换机对线速转发的数据帧发生的这种异常,认为只是到达内部缓存而没有到达出接口,是个输入帧,因此计入 Input IgnoredError,只有从CPU发出的帧,由于内部缓存满,导致帧丢弃,计入此项) 3.Aborts: Output abnormal frames that are discarded. 〔 在半双工模式下,由于冲突检测,延迟发送超过15次的帧,被丢弃,计入此项除其他错误之外,产品认为有必要统计的错误,例如添加前导码异常的帧,也计入此项〕 4.Deferred: The packets could not be sent out for collision under half-duplex mode. ( 半双工模式下,由于检测到载波正在被声明,当时没有发出的包,延时一次,计数加一。
) 5.Collisions: Statistic of collision detection under half-duplex mode. ( 半双工模式下,在以太网帧数据局部的前64字节进入线路前,由于检测到冲突,当时没有发出的包) 6.Late collisions: Statistic of collision with GE port sendingpackets less than 512 bytes and 10/100M port less than 64 bytes. ( 半双工模式下,在以太网帧数据局部的前64字节进入线路后,由于检测到冲突,当时没有发出的包) 7.Lost carrier: Statistic of losing the carrier. 〔 载波丧失,一般适用于串行WAN接口,发送过程中,每丧失一个载波,此计数加一,对于交换机,通常是由于线路中断造成〕 8.No carrier: Statistic of no carrier. 〔 无载波,一般适用于串行WAN接口,当试图发送帧时,如果没有载波出现 ,此计数加一,对于交换机,通常是由于线路中断造成。
〕 如果“input errors〞和“output errors〞非“0〞并且数字在增长,通常情况下可能存在端口匹配问题,必须进展端口状态调整 其它厂商,cisco和中兴的二层交换机错包类型相似,可以类推 三、错包问题排查方法 下面分别说下中兴、华为和CISCO二层交换机排查常用命令 1.中兴交换机端口排查方法,以Z2826S为例进展说明; ①交换机端口原来配置,show run set port 1 description To_702 set port 1 auto disable set port 1 speed 10 set port 1 pvid 541 set port 1 macaddress on 1 set port 1 unit-statistics enable ②交换机端口原来数据包统计 NJ-A-CFDS-Z2826S_2(1#7F)(cfg)#sh port 1 statistics PortId: 1 PortName: ReceivedFrames : 128998658 ReceivedBroadcastFrames: 1815 ReceivedBytes : 741746864 ReceivedMulticastFrames: 0 CrcError : 4934296 InPause : 0 InMACRcvErr : 0 Jabber : 2 Fragments : 6447228 UndersizeFrames : 0 Frames64Bytes : 1232457 Frames65_127Bytes : 84450478 Frames128_255Bytes : 7180773 Frames256_511Bytes : 2203985 Frames512_1023Bytes : 4738336 Frames1024_UpBytes : 29192629 OversizeFrames : 0 SendUnicastFrames : 127249246 SendBytes : 4270894316 SendNoneUnicastFrames: 1892514 SendFrames : 129141760 SendBroadcastFrames : 1035165 SendMulticastFrames : 857349 SendSingleCollision : 0 SendMultiCollision : 0 SendLateCollision : 0 SendExcessCollision : 0 SendCollision : 0 SendDefferTrans : 0 OutPause : 0 可以看到端口有大量“CrcError〞错包,并且屡次查看端口信息,可以看到错包在增长,该用户当前的上网速度肯定会慢,需要整改 ③更改端口匹配模式,改成端口自适应,主动宣告10M set port 1 auto enable set port 1 speedadvertise speed10 fullDuplex 更改后端口配置 set port 1 description To_702 set port 1 pvid 541 set port 1 speedadvertise speed10 FullDuplex set port 1 macaddress on 1 set port 1 unit-statistics enable ④去除原端口1数据包统计,NJ-A-CFDS-Z2826S_2(1#7F)(cfg)#clear port 1 statistics ,再屡次查看端口状态 NJ-A-CFDS-Z2826S_2(1#7F)(cfg)#sh port 1 statistics PortId: 1 PortName: ReceivedFrames : 2377 ReceivedBroadcastFrames: 0 ReceivedBytes : 174972 ReceivedMulticastFrames: 0 CrcError : 0 InPause : 0 InMACRcvErr : 0 Jabber : 0 Fragments : 0 UndersizeFrames : 0 Frames64Bytes : 4 Frames65_127Bytes : 2371 Frames128_255Bytes : 2 Frames256_511Bytes : 0 Frames512_1023Bytes : 0 Frames1024_UpBytes : 0 OversizeFrames : 0 SendUnicastFrames : 4293 SendBytes : 6461573 SendNoneUnicastFrames: 6 SendFrames : 4299 SendBroadcastFrames : 4 SendMulticastFrames : 2 SendSingleCollision : 0 SendMultiCollision : 0 SendLateCollision : 0 SendExcessCollision : 0 SendCollision : 0 SendDefferTrans : 0 OutPause : 0 可以发现用户端口“CrcError〞一直为“0〞,此时用户上网才是正常的。
总结,只要2826端口有“CrcError〞错误,一定要进展排查,直到“CrcError〞错误为“0〞 2.华为二层交换机端口错包排查方法,以S2403H-EI为例进展说明 ①交换机端口原来配置 [S2403EI]dis cu int eth 0/1 interface Ethernet0/1 description to_101 speed 10 duplex full broadcast-suppression 5 mac-address max-mac-count 1 port access vlan 456 ②交换机端口原来数据包统计 [S2403EI-2]dis int eth 0/1 Ethernet0/1 current state : UP IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 000f-e22a-45fc Description: to_101 The Maximum Transmit Unit is 1500 Media type is twisted pair, loopback not set Port hardware type is 100_BASE_TX 10Mbps-speed mode, full-duplex mode Link speed type is force link, link duplex type is autonegotiation Flow-control is not enabled Port-flow-constrain has not been configured pletely The Maximum Frame Length is 1518 Broadcast MAX-ratio: 5% PVID: 456 Mdi type: normal MAX mac-address learning count: 1 Port link-type: access Tagged VLAN ID : none Untagged VLAN ID : 456 Last 300 seconds input: 29 packets/sec 5729 bytes/sec Last 300 seconds output: 22 packets/sec 3705 bytes/sec Input(total): 33659824 packets, 8999990068 bytes 16038 broadcasts, 175 multicasts Input(normal): 33659823 packets, - bytes 16038 broadcasts, 175 multicasts Input: 1102 input errors, 0 runts, 0 giants, - throttles, 112 CRC 0 frame, - overruns, 0 aborts, 2637 ignored, - parity errors Output(total): 36569492 packets, bytes 1404710 broadcasts, 5025215 multicasts, 0 pauses Output(normal): 36569492 packets, - bytes 1404710 broadcasts, 5025215 multicasts, - pauses Output: 0 output errors, - underruns, - buffer failures 19947 aborts, 0 deferred, 0 collisions, 0 late collisions - lost carrier, - no carrier 端口有1102个“input errors〞,说明端口匹配有问题,需要进展排查。
③更改端口匹配模式,改成端口指定10M,duplex自适应 duplex auto 更改后端口配置 interface Ethernet0/1 description to_101 speed 10 broadcast-suppression 5 mac-address max-mac-count 1 port access vlan 456 ④去除原端口1数据包统计,再屡次查看端口状态,需要从“#〞模式退到“>〞模式 [S2403EI]quit
3.CISCO二层交换机端口错包排查方法,以C2950为例进展说明 ①交换机端口原来配置 2950#sh ru int fa0/3 interface FastEthernet0/3 description test switchport access vlan 100 no ip address duplex full speed 100 end ②交换机端口原来数据包统计, 2950#sh int fa0/3 FastEthernet0/3 is up, line protocol is up (connected) Hardware is Fast Ethernet, address is 000d.bd98.1c43 (bia 000d.bd98.1c43) Description: test MTU 1500 bytes, BW 100000 Kbit, DLY 1000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) Full-duplex, 100Mb/s input flow-control is off, output flow-control is off ARP type: ARPA, ARP Timeout 04:00:00 Last input never, output 00:00:01, output hang never Last clearing of "show interface" counters 21w6d Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifo Output queue :0/40 (size/max) 5 minute input rate 0 bits/sec, 0 packets/sec 5 minute ouxtput rate 0 bits/sec, 0 packets/sec 330574221 packets input, 78353246 bytes, 0 no buffer Received 372 broadcasts, 0 runts, 0 giants, 0 throttles 3540 input errors, 3540 CRC, 0 frame, 0 overrun, 0 ignored 0 watchdog, 0 multicast, 0 pause input 0 input packets with dribble condition detected 307917156 packets output, 176359999 bytes, 0 underruns 0 output errors, 0 collisions, 0 interface resets 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier, 0 PAUSE output 0 output buffer failures, 0 output buffers swapped out 端口有3540个“input errors〞,说明端口匹配有问题,需要进展排查。
③更改端口匹配模式,改成端口双工状态duplex自适应 duplex auto 更改后端口配置 2950#sh ru int fa0/3 interface FastEthernet0/3 description test switchport access vlan 100 no ip address speed 100 end ④去除原端口1数据包统计,再屡次查看端口状态 2950#clear counters fa0/3 Clear "show interface" counters on this interface [confirm] [回车确认] sw4-idc#sh int fa0/3 FastEthernet0/3 is up, line protocol is up (connected) Hardware is Fast Ethernet, address is 000d.bd98.1c43 (bia 000d.bd98.1c43) Description: HeHai-SyslogServer-218.104.84.114_5#B03 MTU 1500 bytes, BW 100000 Kbit, DLY 1000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) Full-duplex, 100Mb/s input flow-control is off, output flow-control is off ARP type: ARPA, ARP Timeout 04:00:00 Last input never, output 00:00:01, output hang never Last clearing of "show interface" counters 00:01:40 Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifo Output queue :0/40 (size/max) 5 minute input rate 0 bits/sec, 0 packets/sec 5 minute output rate 105000 bits/sec, 1 packets/sec 4278 packets input, 3722881 bytes, 0 no buffer Received 0 broadcasts, 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored 0 watchdog, 0 multicast, 0 pause input 0 input packets with dribble condition detected 5454 packets output, 4793504 bytes, 0 underruns 0 output errors, 0 collisions, 0 interface resets 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier, 0 PAUSE output 0 output buffer failures, 0 output buffers swapped out 屡次查看端口状态,看到“input errors〞为“0〞,此时用户上网速度才正常。
四、端口错包排查常用命令 1.中兴交换机常用命令 2826(cfg)#show run ####查看设备配置文件### 2826(cfg)#sh port 1 statistics ###查看端口数据统计信息### 2826(cfg)#set port 1 auto enable ###改成端口自适应### 2826(cfg)#set port 1 speedadvertise speed10 fullDuplex ###改端口主动宣告10M全双工### 2826(cfg)#clear port 1 statistics ###去除原端口1数据包统计### 2.华为二层交换机常用命令 [S2403EI]dis cu int eth 0/1 ####查看端口配置### [S2403EI]dis int eth 0/1 ###查看端口数据统计信息### [S2403EI]int eth 0/1 ###进入0/1口### Speed 10 ###端口速度指定为强制10M### duplex auto ###双工自适应### [S2403EI]quit
定期主动远程登入到交换机,查下端口统计信息,如果发现端口有错包,尽快解决,直到端口没有错包产生 . .word..。