Do your users often complain about network slowness? Whether the complaints are legit or not, network engineers need evidence on the actual bandwidth available to the users. For this purpose there are two free tools: iperf and speedtest-cli. Both tools send as much traffic as the client is capable of transmitting and then reports the average data rate.
When running bandwidth tests, the results are dependent on three values:
- the connection speed of the client’s network interface card
- bandwidth available between the source and destination,
- connection speed of the server’s network interface card.
While Iperf and speedtest-cli sound like they perform the same function, the use cases are different.
Iperf use cases
Iperf supports two types of transport protocols: TCP and UDP. The major differences between the TCP and the UDP test are bandwidth and results returned.
In TCP mode the sender generates as much data as supported by the network, while in UDP mode the user has to define the rate of transmission.
In TCP mode iperf returns the maximum bandwidth available between two hosts, while in UDP mode iperf returns the jitter, packet loss, and bandwidth.
Below are the most common iperf use cases:
- Measure WAN capacity. To estimate how much bandwidth is available to a remote user, you can run an iperf test using two clients. The clients can be connected at two different offices (spoke to spoke), or one at an office (spoke site) and one at the data center (hub site). Keep in mind that, generally, this measurement gives the WAN bandwidth estimate for an average user and not to the total bandwidth available for two reasons:
- the NIC of the sender and receiver have lower speed than the actual WAN link and,
- there may be other active traffic consuming the WAN link.
- Measure wireless speed rate. You can run a TCP iperf test between a wireless client and a wired server (or vice versa) in the same VLAN. You can watch this video to see how this is implemented in NetBeez where the output is the same as in the iperf command:
- Estimate voice quality. iperf in UDP mode returns the packet loss and jitter values. These two values affect the quality of VoIP calls and the mean opinion score (MOS).
- Test firewall rules. Let’s suppose that you have a secure LAN that is protected by a TCP/IP firewall (e.g. PCI). In this case, you may want to verify that the firewall rules that you have pushed are blocking denied connections or, in the opposite case, that your firewall is not blocking allows connections. The best way to test this is to place the iperf client on the unsecure zone, before the firewall, and the iperf server in the secure zone behind the firewall.
- Test multicast. With iperf, you can generate multicast traffic and verify that your network is capable of delivering multicast stream from source to destination.
Speedtest CLI Use Case
Run a speedtest when you need to verify download, upload, and latency to the “internet” or, better, to any generic Internet host. A generic host is needed because it’s the only way to have a benchmark that can be used for troubleshooting. Not surprisingly, this service is utilized nowadays from almost any user to assess their internet bandwidth and also Internet Service Providers will ask you to run this test when you complain about download/upload speeds.
When you run a speedtest test, the client probes different servers and then selects the one with better performance (lowest latency). Since the speedtest servers are public, they could be easily overloaded, so your measurement may not fully reflect the bandwidth available. Alternatively, you can also tell the client to use a specific server of your preference.
The speedtest-cli command is the network engineer’s best friend. You can run this command remotely, from the command line, on any Linux host without having to gain access to the browser of a remote workstation.
To conclude, use iperf for internal and advanced bandwidth measurements and speedtest for getting an estimate of download and upload speeds. I hope this article provided some useful insights. Share your thoughts, questions, or comments here below. Cheers!