You could stick a managed switch on the ethermet side. They usually have a way to get traffic stats for a port, and you can usually get that data via SNMP if you want to integrate it into something else.
post
OpnSense basically does this by default.

Sweet! OpenWRT, which I'm running on my routers (or, are my routers running on it?🤣), also has it. But my layout - having two routers - makes it difficult to view their combined RX/TX volume and speed. I guess I could setup yet another SBC with OpenWRT after the switch that combines my two routers, but I'd rather not add another hop to the traffic.
Instead, what I'm considering now, is to try to mirror the relevant ports on the switch A really nifty capability of this TP switch. I did this once a few years ago when I was learning how to analyze packets with tcpdump and WireShark. I don't see why I couldn't do the same here: hook up some Linux system to the port that mirrors the ports in use and find some program that measures traffic volume and speed using the Linux kernel's capabilities alone. Still looking for such a program. I also want to check whether the basic ip tool can do this.
try to mirror the relevant ports on the switch
Still looking for such a program.
I do functionally the same thing on my router, and I mirror it to a system running Clear NDR which is like a network intrusion detection software. So it will also generate events and stuff, as well as simple flow analysis:

I don't think it has a good way to see the speed though, and I use SNMP + Telegraf + Influx + Grafana for that, but there's probably an easier way.
I guess for more details, I use MikroTik's packet sniffer firewall rule, to encapsulate the first 1024 bytes of a connection with a TZSP header addressed to Clear NDR, but I've done a lot of extra stuff to get that to work, and it's much more designed around basic port mirroring so that'll work great for you.
Sweet setup! I actually found a really simple CLI/TUI program called bmon that does all I need.
Now I just need to find the courage to
- shut all my systems down
- connect the switch on the LAN side of a router
- finally be able to
arp-scanthe freakin' thing to find its IP, which I can't now that it's on the WAN side/outer edge of things, so that I can access its web UI - setup the mirroring
- call Bob and tell him he's my uncle
bmon
Oh cool, I haven't seen that before! If it matters, I think all your traffic would appear as RX, since everything would be received by the NIC.
finally be able to
arp-scanthe freakin' thing to find its IP
I'd set a static IP on the switch, so it doesn't try DHCP or something and confuse your ISP's BNG, but if it's already working then I guess it's fine (and idk your ISP's setup).
I think all your traffic would appear as RX, since everything would be received by the NIC.
Damn, that's right... Oh well, I'll see what it does soon enough.
In the meantime, I reached out to my ISP and they gave me the IP of the switch so that I don't have to decouple my whole network. They even allowed me to set that IP as the switch's static address, which is otherwise in the range of their rotating dynamic ones. And they adjusted my subscription prices (I have more than one) to the new, slightly cheaper ones. This is a good day, haha.
Thanks for the help! 😊
Oh wow, that sounds like a cool ISP! The switch might also support SNMP, so you could get the byte count (to calculate the speed) and other stats off it directly too.
Here's a joke to conclude the matter.
I connect to one of the switch's ports with my smartphone using a USB-Ethernet dongle. I enter the switch's web UI using the address I got from my ISP. I disable DHCP and set the IP manually to static. I setup the port mirroring and fire up bmon on my terminal emulator (Termux). It turns out either bmon or Android or the USB dongle doesn't have the capabilities to read real-time bandwidth of mirrored traffic. That's not even the joke. Hold on.
Suddenly, the web UI freezes. I've seen this before... I do a sudo ip a to check my phone's IP address and THEY JUST ROTATED THE DAMN THING. 😂 Threw my phone out of the switch's range. (Was in 176.x.x.x, ended up in 155.x.x.x) I try setting the phone's address manually to a static one within the same range as the switch is set to, to no avail... (The Android prompt required both a default gateway and a DNS server, and I don't know either. Tried the traditional 176.x.0.1 and the likes...) My switch is just out of reach 🤣😭
At least I managed to setup the port mirroring before the lease renewal/new address handout. I won't be able to actually use it until I move the switch into my LAN to change the address again though, but I'm done with this for the moment. 😅😮💨
It turns out either
bmonor Android or the USB dongle doesn't have the capabilities to read real-time bandwidth of mirrored traffic.
Yeah you need promiscuous mode, I highly doubt that's possible on Android without root, and no idea how to do it with root.
THEY JUST ROTATED THE DAMN THING
Haha that sucks. If a device is on the same subnet, you won't need a gateway and DNS server. Like if your switch is 176.1.2.3/24 and your phone is 176.1.2.4/24, then that won't require a gateway. Although they could be doing some L3 switching or something which could break that.
all 11 comments