High-resolution network monitoring with ping
Cable Length
Different cable lengths can be revealed by run-time analysis. Data cables, whether made of copper or glass fibre, are always delay lines; signals cover around 20cm/ns. For the round trip time, the delay is about 10ns/m; the result is 0.5µs for a 50-meter cable. This latency is much less than you see through a gigabit switch and also occurs irrespective of packet size, but still within a measurable framework. Pinging every second can locate faults with an accuracy of about 50 meters based on daily averages. Figure 3 shows the network components in our lab at a glance.
![](/var/linux_magazin/storage/images/issues/2014/165/pinger/figure-3/619571-1-eng-US/Figure-3_large.png)
The values shown in Figure 4 clarify that the volatility of the daily average values is virtually the same as the additional latency caused by a 50-meter cable in place of a 0.5-meter cable. After two days, I replaced the 0.5-meter patch cable with a 50-meter cable that theoretically increases the RTT by 0.5µs.
The 49.5 extra meters of cable therefore evidently caused an RTT increase of 0.5µs. For the first two days with a 0.5-meter cable, the average RTT was 172.877µs; for the last two days with a 50-meter cable, RTT increased to 173.562µs – 685ns more.
Daily average values vary significantly because of inconsistent utilization of computers and dozens of programs, such as Tor, I2P, KTorrent, GNUnet, Squid 3, DHCP, NTP, Kaffeine, and Firefox. Detecting such small RTT changes requires averaging several daily mean values with only one ping a second.
Because an Ethernet segment (collision domain) must be less than 100 meters in length – and usually significantly shorter segments are used – at least 100-meter resolution is easily achievable in practice with 1,000-second averages.
In the Air
WiFi measurements are in principle just as feasible as measurements on a gigabit LAN. However, the majority of WiFi routers and devices automatically controls the data rate (bandwidth), so the RTT varies accordingly. Most routers cannot turn this off, and many do not even show you the data rate. On Linux, admins can set the data rate for WiFi with
iwcofig wlan4 rate 24M fixed
although it doesn't change the router rate. Curious admins have nothing left to do but make sure the rate displayed by the router remains constant during measuring.
A second difference from measuring LANs is the signal speed, which is 50 percent higher than on the wire, at around 30cm/ns. The value I measured for 1,000-second averages at 0.7 meters distance and with two 30dB attenuators was 0.985108ms; at a distance of 2.5km this was significantly higher at 1.023676µs, an increase of 38.6ms (Figure 5).
![](/var/linux_magazin/storage/images/issues/2014/165/pinger/figure-5/619577-1-eng-US/Figure-5_large.png)
Theoretically, the difference should be only 16.7µs (i.e., far less than the gigabit LAN). However, some other factors seem to be present, such as rate fluctuations not displayed by the router or temperature differences: -2°C (28°F) across the 2.5km distance and 20°C (68°F) across 0.7 meters distance.
I also tested whether I could take these measurements with a Linux PC instead of a WiFi router using ad hoc mode. I was able to set both transmission rates, but contrary to expectations, the fluctuations were four times greater than pinging the wireless router.
Faster Measurements
If you can or want only to perform short measurements, you can adjust the Pinger program to send many pings per second instead of just a single ping. To do this, you only need to set a smaller time grid in the source code (e.g., 1ms for an accuracy that is greater by a factor of 32), and you need to use more threads. Because the threads times have a resolution of 1µs, there is not much to change.
In addition to the approach of using pings to determine latency, it is also possible to evaluate timestamps. TSF timestamps are suitable for this purpose on WiFi networks because they have a resolution of 1µs and are even free of jitter. However, not every hardware platform is suitable [7] for this.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.