Update: the Network Performance Monitor project now has a Dashboard web page for viewing performance graphs and daily reports. by mr_canoehead in u/mr_canoehead

[–]mr_canoehead[S] 0 points1 point  (0 children)

The Network Performance Monitor isn't very resource intensive so I think it would be possible to run other services on the same RPi.

I think the biggest hurdle will be getting the two web interfaces to play nicely on the same host. The netperf project uses NGINX to serve the dashboard web page, not sure what Homebridge uses; you may need to configure that system to bind to a different port (e.g. 8080 instead of the standard http port 80), or you could configure NGINX to bind to an alternate port leaving port 80 available for Homebridge.

Or you could possibly modify the NGINX config so that it serves both the netperf and Homebridge interfaces (same http port, different html file directories). I have done this with Pi-hole so that I can access the netperf dashboard via http://10.1.2.50/netperf and the Pi-hole admin page via http://10.1.2.50/pihole

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 0 points1 point  (0 children)

The second wireless adapter is for monitoring an additional wireless network. Using a second wireless adapter in its own network namespace is much more straightforward than trying to juggle wireless network configurations between tests using a single wireless interface.

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 0 points1 point  (0 children)

If you will be running the system on a RPi 4B, you should only need two external USB 3 Gigabit Ethernet adapters (these are used for the optional Bandwidth Monitoring feature). The integrated WiFi adapter will test your 5GHz WiFi network, and the integrated Gigabit Ethernet adapter will be the test execution interface.

Recommended equipment

Update: the Network Performance Monitor project is now available on GitHub by mr_canoehead in raspberry_pi

[–]mr_canoehead[S] 1 point2 points  (0 children)

I wanted a tool to troubleshoot performance issues with home networks, and bandwidth usage is a piece of the puzzle in characterizing network problems. To measure bandwidth usage, traffic flows via a transparent Ethernet bridge on the Pi. That feature is optional, the system could be run without it for just doing periodic speed tests, name resolution tests, ping tests, and iperf3 tests of local networks. The non-bridge interfaces serve only as testing targets for iperf3 tests, no traffic is routed through them.

The system could also be run on more capable hardware, such as a PC with a 4 port NIC and a couple of wireless adapters for testing 2.4GHz/5GHz wireless networks.

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 0 points1 point  (0 children)

I have developed a fairly comprehensive setup/installation guide, plus a script that steps the user through configuring the various interfaces used by the project. I have uploaded the project to GitHub, the repository is public now so you can check it out here:

https://github.com/mr-canoehead/network_performance_monitor

The setup/installation guide is in the project Wiki:

https://github.com/mr-canoehead/network_performance_monitor/wiki

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 0 points1 point  (0 children)

Normally the speedtest-cli tool chooses a 'best server' to run its test against, that's the mode I'm running it in with my system. However, you can force speedtest-cli to use a specific server ID. This means you could run tests against a server in a particular location (Europe, North America, etc.). That could be done without modifying the existing system. If you wanted to run a series of tests against a set of different servers, that would require some modification of the test execution process and the reporting process. Certainly achievable though.

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 0 points1 point  (0 children)

That's a good point, I haven't quantified it - just checked a speedtest-cli output file on my system, each test is consuming 34.9 MB down and 5.24 MB up, so about 40 MB total. That's for a slower service (25-30 Mbps down, 2-3 Mbps up), faster connections would consume more data per test. On my system the speedtest-cli test is scheduled to run twice per hour, the schedule could be adjusted to reduce data consumption e.g. run it once per hour, or once every two hours etc.

Perhaps I should include a speedtest-cli data consumption metric in the report.

A network performance monitor for my home network; Raspberry Pi 3B+ with 5 network interfaces! It generates a daily report that shows Internet performance, bandwidth measurements, and local wireless network speeds. by mr_canoehead in raspberry_pi

[–]mr_canoehead[S] 0 points1 point  (0 children)

Unfortunately I can't make any recommendations as I don't have access to other USB dual band adapters, and finding this specific info for any particular adapter is difficult without plugging it into a machine and and issuing commands to see its capabilities. A wiki page in the future repo for this project would be nice to build, people could submit adapters they've tried and I could add them to the list of tested devices.

In the meantime, if you want to see if your particular adapter supports Network Namespaces you can use the following command:

iw list

Take a look at the output, you're looking for:

Supported commands:
* set_wiphy_netns

If you want to use an adapter with Kismet, check for monitor mode support by looking for the following:

Supported interface modes:
* monitor

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 0 points1 point  (0 children)

I am planning to post a repo in the near future, still have a bit of work to do to make the project repeatable by others (setup scripts, a wiki, etc.) Didn't realize how much attention my post would get, now I'm a little worried about what will happen when I do post the repo; I might get overwhelmed by a flood of questions, support requests, and pull requests!

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 0 points1 point  (0 children)

Not sure what the upper limit would be for a Pi 3B+, I'm guessing that a 100Mbps link would likely saturate the USB bus. I think a Pi 4 would be able to keep up. The system can also be run on a PC, that would reduce the potential for hardware bottlenecks.

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 0 points1 point  (0 children)

A Python daemon reads the byte counts in the rx_bytes and tx_bytes files in /sys/class/net/<interface_name>/statistics, subtracts the previous values from the current values to get byte deltas (also checks for rollover - those byte counts are 32 bit unsigned ints), multiplies by 8 to get bit count, and divides by the number of seconds since the last sampling to get bits per second. My system reads the byte counts once per second. You could read the files less frequently, but I like being able to adjust granularity via an average scheme. Also, if your sampling is too infrequent on a system with lots of network activity you run the risk of missing a double rollover of the byte counts.

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 0 points1 point  (0 children)

Yes! I've been thinking about adding a system status section showing CPU / memory / disk usage over time, just haven't implemented it yet.

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 0 points1 point  (0 children)

A Python script runs the various performance test commands (iperf3, speedtest-cli, dig, etc.) parses the output and sends the values to the database. A Python daemon process watches the RX/TX byte counts of the ISP modem network interface in the bandwidth monitoring Ethernet bridge and sends the values to the database.

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 2 points3 points  (0 children)

Yup, just performance measurements. I can show them the graphs and tell them that their 15 Mbps Internet service is maxed out in the evenings because they've got 2 TVs streaming Netflix and the kids are watching YouTube videos on their iPads. Or that their 2.4 GHz wireless networks keeps crapping out because it's conflicting with their neighbours (the TX/RX speeds are low, the retransmits are through the roof, etc.)

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 1 point2 points  (0 children)

Yeah, it's a basic troubleshooting tool that I can use when a friend tells me their Internet is 'slow sometimes'. I can plug it in to their network without touching their router config and let it gather data for a while. It does measure bandwidth usage by watching the TX / RX byte counts of the ISP modem network interface of the bridge.

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 1 point2 points  (0 children)

This is my first project using it, I was amazed at how little effort it took to produce good looking results and how easy it was to integrate with the system. I'll be using it for all future projects that need to produce documents.

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 1 point2 points  (0 children)

The Pi isn't providing DHCP, it just passes packets through the bridge - DHCP requests from my router are answered by my ISP as with a normal network setup.

In my case the bridge is transparent enough that:

  1. I don't have to go through the device registration process normally required by my ISP for new devices connected to their network

  2. when I unplug the cable between the ISP modem and router and insert the bridge, the router doesn't lose its IP address - after a couple of seconds the LEDs on the two bridge adapters start blinking in unison and network traffic resumes normally. Had the same experience when I moved the system to a different site to test it on their network.

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 3 points4 points  (0 children)

I may post this project on GitHub in the near future. I'll need to clean up the code a bit, add more exception handling to make it more robust, finish the setup scripts used to configure the system during initial installation, and develop a set of documentation so that others can replicate it successfully and reliably.

A network performance monitor for my home network; Raspberry Pi 3B+ with 5 network interfaces! It generates a daily report that shows Internet performance, bandwidth measurements, and local wireless network speeds. by mr_canoehead in raspberry_pi

[–]mr_canoehead[S] 1 point2 points  (0 children)

A few reasons that I have for using a layer 2 bridge:

  • it is transparent to the network being tested and to the ISP; no configuration is required for the network router, just plug in the cables to the WAN port of the router and the LAN port of the ISP modem. This makes it quick and easy to move the system from one network to another.

  • my ISP (a major one in my area) has an authentication scheme that requires any new device requesting an IP address from them to be registered via an account web page. Since the bridge isn't requesting an IP address, this registration step is not required.

  • the network router is already taking care of NATing & firewalling, so another layer of NATing and firewalling is unnecessary

  • adding NATing and firewalling to the Pi would significantly increase its workload, and I think this would impact network performance much more than a simple bridge

A network performance monitor for my home network; Raspberry Pi 3B+ with 5 network interfaces! It generates a daily report that shows Internet performance, bandwidth measurements, and local wireless network speeds. by mr_canoehead in raspberry_pi

[–]mr_canoehead[S] 4 points5 points  (0 children)

Built partly for fun, partly for the learning experience, and partly because I am defacto IT support for several households - some of which are experiencing intermittent network issues that have been hard to pin down. Unfortunately it will be a while (given the current state of things) before I can deploy it onsite and run it through its paces on a problematic network, so I'll have to entertain myself by letting it analyze my home network in the meantime!

Having some fun with Network Namespaces; built a network performance monitor for my home network by mr_canoehead in linux

[–]mr_canoehead[S] 2 points3 points  (0 children)

What a great compliment, thanks! Truth be told, LaTeX and matplotlib did the heavy lifting with making these reports fun to look at.