Troubleshooting Ethernet Networks With The ESP32

While there are cheap handheld testers that can tell you if an Ethernet jack is wired improperly or if the cable itself has a broken conductor, figuring out if there’s a live TCP/IP network over it is a little more difficult. There are commercial testers that can detect those sorts of issues as well, but they’re considerably more expensive. So when trying to diagnose a flaky network connection, it’s often necessary to lug a laptop around so you can plug it in at various points to try and isolate the problem.

Mobile view of the web UI.

If this is a situation you occasionally find yourself in, the Syndetis project by [theo79] may be of interest. This firmware for the WT32-ETH01 turns the ESP32 development board into a handy network tester that can determine Ethernet link status, ping IP addresses, detect other devices using Link Layer Discovery Protocol (LLDP), and even and sniff out active services such as DHCP. Add an 128×64 OLED display, a few buttons, and a USB power bank, and you’ve got a self-contained diagnostic tool that can fit in your pocket.

Anyone who’s had to squeeze into a wiring closet will appreciate the stand-alone nature of this device. But if you’ve got the room to bring your phone along and a free hand to operate it, the firmware also offers up a web interface that can be accessed over WiFi.

This will present you with a slightly more polished UI than can be offered up by the OLED and buttons, offering up a more complete view of what’s happening on the network. It’s also possible to generate diagnostic reports that are saved as JSON files for later analysis.

If you don’t need all these fancy features and just want a quick way to tell if an Ethernet cable is good, we’ve covered a DIY tester that uses the venerable 555 timer. If you’ve got a multimeter handy, you can get away with little more than a bare PCB.

I Heard There Was A Secret Port…

TCP specifies 2^16 ports, 65536, much more than are typically used. In fact, the port zero is almost never used, or, as [Acid Vegas] found out, about 0.25% of hosts globally (give or take) to be precise. The reason is not technical, in fact TCP supports it quite well, but rather social. If one were to request the Linux kernel provide you with port 0, it would actually provide you with a randomly allocated even port between 32768 and 61000. But, there are, of course, ways around this. Raw sockets or, the route [Acid] takes, IPTables/NFTables port mapping. By this, plain text IRC is bound to irc.supernets.org on port 0, and TLS on port 1.

But, should you go try to connect to this IRC server, you will find most userland programs simply refuse to accept a port of 0. BSD NC and Telnet will simply tell you the port is too small. Chromium and Firefox derived browsers will warn you its unsafe. And Python SSL will give you an IO error. However, Python AsyncIO and socat work just fine. Once again, this is not technical limitation of the port, but rather a reflection of the fact that there really isn’t a reason to use it.

Should you go looking on the internet for hosts using port zero, you will find they mostly appear accidental. Mostly likely a network device defaulted to a strange configuration that no one noticed. Regardless the reasons, some strange services are using the port. SSH, mostly DropBear, suggesting IoT or networking devices like routers. Likewise, Telnet appeared on a number of embedded devices. HTTP router admin pages also appear on the port. But, if you remember, browsers don’t let you use port 0, so you need to set up a local port forwarding rule if you want to connect.

While a handful of other services including RustDesk are on port 0, the most interesting is Station Message Detail Recording. SMDR is a simple TCP protocol which logs the outputs of phone calls in plain text.

If you like Linux networking, make sure to check out this VPN hack next!

Thanks [adistuder] for the tip!

Monitors That Throttle Downloads

Displays in general are a lot more complicated now than they used to be, but even still, you’d be forgiven for not expecting a monitor to slow down your internet connection. Yet that’s exactly what [Oscar] ran into recently, and fortunately for us, he was good enough to document how he figured out what was going on.

This bug might not have been discovered at all except for the fact that [Oscar] enjoys a 2.5 Gbps symmetric internet connection. When running a speed test he found he was getting the advertised speed for upload, but download was somehow limited to 600 Mbps. This was only with the USB-C to 2.5G Ethernet adapter he uses plugged into the monitor, which is acting as a hub. When it was plugged directly into the computer there were no dropped packets and he was able to get full speed. But the curious thing was the operating system was not noticing the dropped packets, so something was going on before the monitor was getting involved.

A driver update brought the speed to around 1.1 Gbps which was an improvement, but there was still a problem. Then [Oscar] tried using Ethernet flow control, which asks the sender of the packets to pause briefly if the receiver is dropping frames, rather than losing those frames completely. This also improved things, but still not completely. And it had the feeling of a workaround as well. What he’s settled on having been the problem in a nutshell is that the buffer on the 2.5 Gbps card would fill before the data would transfer through the hub to the computer, and if it overflows it will drop packets.

The solution was to upgrade to a 5 Gbps card with a larger buffer, and after that there were no more dropped frames. We might consider upgrading to fiber for faster speeds though.

UDP Broadcasting Meets The More Focused Multicasting

After previously exploring the basics of UDP broadcasting, why IPv4 subnets are an exciting feature that you really want to dive into, as well as the contentious topic of IPv6, there are still plenty of elephants to admire and cans of sardines to crack open. One of them being the topic of broadcasting versus multicasting, which at first glance sounds rather similar and may even have some wondering why you’d even bother with multicasting if you can just send-and-forget with IPv4 broadcast address.

Of course, we already found out that IPv4 broadcast addresses come in a few flavors, and that’s before you start even considering the implications of subnets and routing limits. When we then consider that in IPv6 broadcast addresses were dropped completely in favor of link-local multicast addresses, and that IPv4 also supports multicast, then this raises the question whether using IPv4 multicast’s own take on ‘link-local’ doesn’t make more sense.

Or perhaps more succinctly put, is IPv4’s take on link-local broadcasting as straightforward as IPv6’s?

Continue reading “UDP Broadcasting Meets The More Focused Multicasting” →

Mesh Network Telephony Over Bluetooth On Android Phones

Telephony is a bit of a mixed bag. On the one hand, being able to talk to people in far off places is kind of neat, at least in theory. On the other hand, you’re usually reliant on a centralized network, which isn’t ideal to the mindset of most hackers.[Gautam]’s MeshLive project deals with that last one, offering a decentralized mesh network solution based on Bluetooth for Android phones that can handle both voice and video.

Rather than relying on dedicated hardware, this particular mesh piggybacks on your phone, and exists only as an Android application. Calls are end-to-end encrypted for both voice and video — though two-way video calling is still experimental. More testing has gone into video broadcasting, where a stream goes out one-way. The capability is available for voice, as well.

Each user has a unique identifier that can be scanned to create contacts, but it isn’t otherwise clearly identifiable to everybody. You’ll only appear with a random name that changes every 15 minutes to other users in range who aren’t your contacts. Range is of course the Achilles heel of this project, since it’s using the Bluetooth hardware of ordinary smartphones. It’s possible to extend the range of Bluetooth significantly with the right hardware, but we imagine most folks aren’t carrying directional antennas around with them. While every phone does forward the signal to as many others as it can, it can only do so for about 20 meters.

Of course LoRa remains the protocol of choice for mesh networking, though it’s normally used for text messages only. We have seen voice packets over LoRa, but anything LoRa requires dedicated hardware while this only requires an app.

Continue reading “Mesh Network Telephony Over Bluetooth On Android Phones” →

UDP Broadcasting And The Brave New World Of IPv6

After recently working our way through UDP broadcasting and network subnetting all in the comfort zone of IPv4, it’s time to address the elephant in the room, the one wearing a bright neon ‘IPv6’ sign. Although it’s still very much a rumor at this point, supposedly IPv6 is slated to replace the venerable IPv4 protocol. Rather than just being IPv4-but-with-more-addresses, its designers took the opportunity to basically completely redesign the protocol for the futuristic world of the late 90s and the early 2000s.

Joking aside, IPv6 having been introduced in 1995 and still struggling to meaningfully displace IPv4 does invite some worries about just how easy it is to switch between these two fundamental internet protocols. Say if we wanted to join the future of the 2000s and adapt our software to speak IPv6 instead of IPv4, what would change about the aforementioned aspects of IPv4 UDP broadcasting and IPv4 subnetting?

Speaking as an ignorant developer who mostly knows IPv6 from those weird and hard to remember network addresses, as well as many broken router implementations, I’m not entirely convinced that I’m going to like what I’ll see.

Continue reading “UDP Broadcasting And The Brave New World Of IPv6” →

DIY Router On X86 E-Waste: OpenWrt And OPNsense

In previous installments of this series we looked at how creating a DIY router using an e-waste-level PC has changed over the years, before attempting to boot OpenWrt for x86 on it. After an initial SD card booting failure on one system, another system with a newer mainboard – an Intel Board D2500CC – was used which happily booted OpenWrt from an SD card inserted into a USB card reader.

Unfortunately, OpenWrt didn’t see any usable Ethernet interfaces despite having no less than four Intel Ethernet controllers and two hooked up to active networks. After recently getting back to the project, I found out why both onboard Intel 82574L Ethernet controllers didn’t show up in OpenWrt: the drivers for the Intel 82574L controllers are in the e1000e driver package, while only the e1000 package is present in the provided x86 image. This issue persists in the ‘generic’ image profile to this day.

Yet rather than diving head-first into building my own image that includes the kmod-e1000e package, I decided to give OPNsense a shake first.

Continue reading “DIY Router On X86 E-Waste: OpenWrt And OPNsense” →