[SOLVED] Network switch diagnostics

I recently had an issue with an openwrt router that I returned to production. It took me two days to discover that I had attached the switch cables backwards. Now this is clearly a silly mistake on my part, but it got me wondering about error, collission, crc, etc. packets. This situation should have created a ton of those.

I realized that I have never seen any port or interface statistics beyond total rx/tx traffic. It seems to me that this is rather basic diagnostics. Perhaps not for consumer grade routers, but I have always thought of openwrt as elevating equipment above basic consumer grade equipment.

So my question is: Does the firmware have a mechanism for detecting and collecting and counting these errors?

Do you mean that you made the ethernet cable yourself and from one side you had 1-2, 3-6, 4-5, 7-8 and on the other side they were 7-8, 4-5, 3-6 , 1-2 ? Was that even coming up?

Sure, have a look at ip -s link and ifconfig

The cables themselves were fine. Rather, it is a 4 port switch with vlans. So for example, the cable going to port 4 should have been in port 1. The was that port 4 is untagged and port 1 is tagged. Ports 1 and 2 serve as trunks while 3 and 4 are direct connections to end devices. I would think this would throw packet errors because I believe this all happens at level 2.

Thanks for the snippet to query the stats. I also subsequently found some collectd modules that appear to support those stats. Its a bit challenging finding the right mods because descriptions are short and some mods seem to do the same or similar things. Working through that.

TBH, I have never checked a switch to see if errors are thrown in this scenario, but my assumption is that there would be no errors. The switch is performing as designed/configured/expected -- ignoring the tagged packets on the untagged interface and vice versa. I would also expect the same to be true if you had tagged packets (on ingress) for which the port was not a member of a given VLAN, as well as the opposite situation where the downstream device isn't configured for a VLAN that the switch port does have included.

1 Like

Errors do manifest in logread in this situation (do not remember the exact wording, something along the lines of not a member), not sure as to any module in the stats packages displaying info though.

1 Like

Cool... Maybe my above assumptions are wrong. Do you mind elaborating a bit (so that I can learn + correct the above post)?

From this, I'm guessing that the inbound packets that contain tags for which the port is not a member would generate this error, right? Would it happen if ingress packets were untagged and the port wasn't an untagged member of any networks? And what about egress packets -- if the port is has a tagged VLAN but the downstream device doesn't match have that same VLAN configured, would errors be thrown?

Don't recall all the specifics, not seen it in action since DSA first landed in the mvebu target and I was reworking infrastructure with some managed switches, but certainly

1 Like

I haven't tested it in OpenWrt, but in Cisco you can get errors like vlan mismatch. Apart from that these would not be counted as packets with errors, as in CRC errors.

Ya, IIRC is was designated as warning not error.

Thanks all. To be clear, I was mostly looking to understand what errors statistics are available for switch ports. I’d just never thought of it before because I hadn’t had a problem with hardware nor done anything this stupid previously.

I’ll tag this as resolved, but still interested in any other nuggets of wisdom you folks would like to throw into the topic. I’m mainly a software guy, so I’m always on the prowl for ways to get smarter about hardware.

BTW, collisions don't occur on switches.

Are you sure?? What if you forget to tighten the bolts on your rack mount server and it falls onto your switch? That loud clunk seems to me to be a collision :rofl:


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.