How to Test the Speed of Your Home Network with Iperf

Question:

Paul asks: John and Dave frequently discuss home networking and wireless speeds. How do you measure the bandwidth, or speed, of a wireless router?

Answer:

In order to measure the performance of a network, you need at least two devices: one to send data and the other to receive it. When you’re connected to the Internet, this kind of transmission occurs constantly as your Mac, iPad, or iPhone communicates with the Web servers that host your favorite websites.

Online speed tests like SpeedTest.net work well for testing your Internet connection's speed, but very few users have an Internet connection that can max out an internal home wired or wireless network. If you’re interested in determining the full speed of your home network and, by extension, your router, you’ll need a server that can transmit and receive data faster than your Internet connection. For most users, this means using a PC or Mac on your home network as a server, and then testing the bandwidth between that server and another device also on your home network.

A great utility to test bandwidth between two devices is Iperf, a free tool that you install on at least two computers, designating one of them as the server and the second as the client. Iperf then sends data directly between the two computers, revealing the maximum speed of the wired or wireless network connecting them.

Start with Homebrew
 

Iperf natively runs as a command line utility in Terminal, and the best way to get it is via Homebrew, the open source packet management system. If you don’t already have Homebrew, open Terminal and run the following command:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

os x terminal homebrew install

The Homebrew install script will go step-by-step, explaining what it’s doing and prompting you to continue. Just follow the instructions as they’re presented. Once Homebrew installation is complete, all you need to do to get Iperf is use the following command:

brew install iperf3

The latest version of Iperf3 will be downloaded and installed automatically. This, of course, is just a small example of what Homebrew can do. If you’re interested in learning more, check out the project’s FAQ and Tips N’ Tricks pages.

You’ve just installed Iperf on one Mac, but you’ll need a second Mac to test your network. Go to (or otherwise obtain) a second Mac and repeat the steps above to install Homebrew and Iperf.

Next: Using Iperf

 
Using Iperf
 

Note: for these steps you’ll need Homebrew and Iperf installed, detailed in Part 1. Also, you'll need to move back and forth between your two Macs. You can either move between them physically (much easier if at least one of them is a laptop that you can bring with you to the other Mac) or access one of the Macs remotely via Secure Shell (SSH) or OS X Screen Sharing.

Head to your first Mac and designate it as a server by entering the following command in Terminal. When prompted by OS X, allow Iperf to accept incoming network connections.

iperf3 -s

This Mac is now listening for an incoming client with which to test. Now designate the second Mac a client by using this command in Terminal:

iperf3 -c [IP Address of first Mac]

Iperf will run for 10 seconds by default and generate output on the client reporting the bandwidth of your connection in megabits per second for each second of the test, with the average for the entire test at the bottom. Remember, megabits are different from megabytes; 1 megabyte (MB) is equal to 8 megabits (Mb).

iperf client network testing wireless-wireless

Our first test, illustrated in the screenshot above, was conducted via two Macs connected to the same 802.11ac wireless network. This gives us valuable data on the connection between these two Macs. If you’re trying to measure the performance of your wireless router, however, such as Apple’s AirPort Extreme, you’ll want to connect the Mac acting as your Iperf server to your router via wired gigabit Ethernet.

The reason for this change in configuration is to limit the variables during the test. If both Macs are connected wirelessly, and you’re only interested in the performance of your router or your client Mac, then the wireless connection between the server and your router introduces limitations in the overall bandwidth that make the evaluation of your client unreliable.

2013 mac pro wired ethernet

By connecting the Iperf server directly to the router via gigabit Ethernet, you ensure that the signal from your server to the router arrives at the best possible speed, producing test results that measure the performance of just that wireless hop from the router to the client. Note, however, that this only works because real-world 802.11ac speeds are still less than 1 gigabit per second. If future wireless technologies take real-world performance beyond the gigabit barrier, then the wired connection would act as the bottleneck, requiring another form of direct connection, such as 10 Gigabit Ethernet or Thunderbolt.

To illustrate the effect of a wired connection for your Iperf server, we ran the same test again, with gigabit Ethernet connecting our server Mac to the router.

iperf network test wired to wireless

With all components in the same locations, the performance jumps significantly in the second test. This gives us a true evaluation of the speed of our wireless network as it pertains to our specific router and the location of our Iperf client Mac.

When you’re done testing, just hit Control-C in the Terminal window of the Iperf server to terminate the utility. If desired, you can run further tests in the opposite direction by running the server command on your client Mac and the client command on your server.

While the default test is sufficient for basic testing of your home network, Iperf offers a number of advanced options, such as changing the testing time or running multiple streams at once. You can view the options and descriptions via Iperf’s manual, which can be accessed by typing man iperf3 in Terminal.

In addition to testing the performance of your home network, Iperf can also help reveal wireless dead spots in your home and guide you in finding the optimal location in which to place your router. Just run Iperf client on a MacBook and wander around your home, testing various speeds at different locations.

apple airport extreme signalImage Credit: Apple

Although Iperf’s command line interface is relatively easy to use, there’s also an OS X port with a GUI. Note, however, that this version is currently running Iperf 2, while the method described above uses Iperf 3. Both will provide basic network testing, but they can’t be used together (i.e., Iperf 2 GUI as a server and Iperf 3 command line as a client). Therefore, make sure you’re consistent with your Iperf version when installing it on your Macs.

Finally, this article focused on Macs and OS X (this is The Mac Observer, after all). But Iperf can also be run via Windows and Linux (and even on iOS or Android). As mentioned above, just make sure you’re using the same version on all computers if testing in a mixed-platform environment.

Teaser graphic via Shutterstock.