Network throughput got you down? Start your troubleshooting with the iperf command.
As a network administrator, one of your jobs is to always make sure your network and the connected servers are working as efficiently and reliably as possible. When things go wrong, such as a network slow-down, you have to have the tools at the ready for troubleshooting. With so many tools available, where do you turn? One tool you can use on your Linux servers is iperf.
Iperf is a command line-only tool that is used to diagnose network speed issues. Iperf measures the maximum network throughput a server can handle and reports the results back to you. If you find a server's maximum throughput is lower than it should be, it might well be possible that particular server is the cause of your network slowdown.
SEE: Choosing your Windows 7 exit strategy: Four options (TechRepublic Premium)
What you'll need
Iperf can be installed on nearly any Linux distribution. In order to make use of it, you need two Linux machines. The machines used can be either server or desktop, but chances are at least one of them will be a server--unless you have a desktop machine causing the network slowdown.
I'll be demonstrating with a Ubuntu Server and Ubuntu Desktop instance.
How to install iperf
The first thing you must do is install iperf on both Linux machines. As iperf can be found in the standard repositories of most distributions, you can install using the package manager shipped with your version of Linux. For instance, on Ubuntu (or other Debian derivatives), the installation command is:
sudo apt-get install iperf -y
And that's it. You're ready to make use of the tool.
How to use iperf
The first thing you need to do is run iperf in listening mode on the offending server. To do that, log in to the server and issue the command:
You should see that iperf is now listening on TCP port 5001 (Figure A).
Now go to the other Linux machine and test the iperf-listening server. This is done with the command:
iperf -c SERVER_IP
Where SERVER_IP is the IP address of the iperf-listening server.
You should see two things. The first is on the iperf-listening server, where you'll see the connection has been received, the interval in which it was received, the total amount of transfer, and the bandwidth used (Figure B).
The second thing you should see is on the testing machine, where you'll see the same results, only you'll get your prompt returned to you (Figure C).
If the throughput is considerably less than it should be, you might start your troubleshooting with that machine.
If that basic test doesn't give you enough data, you can always customize the command. Say, for instance, you want:
- Test on port 80
- The test to run for thirty seconds
- To display transfer data every two seconds
Such a command would look like:
iperf -c SERVER_IP -p 80 -t 30 -i 2
This command should give you significantly more information (Figure D).
You can customize that command to test any port you might suspect is causing problems on your server/network.
For more information on how iperf can help you troubleshoot your network throughput issues, make sure to read the man page with the command man iperf.
- How to become a software engineer: A cheat sheet (TechRepublic)
- 10 free alternatives to Microsoft Word and Excel (TechRepublic download)
- How to use port forwarding in VirtualBox (TechRepublic)
- How to prevent unsigned Docker images from being pulled (TechRepublic)
- How to configure Back in Time to back up over SSH (TechRepublic)
- How to use multiplexing to speed up the SSH (TechRepublic)
- BT will use Ubuntu and OpenStack to power 5G transformation (ZDNet)
- The 10 most important iPhone apps of all time (Download.com)
- It takes work to keep your data private online. These apps can help (CNET)
- Must-read coverage: Programming languages and developer career resources (TechRepublic on Flipboard)