My new place in Austin came with a huge perk for a tech geek like me – it came pre-wired for ethernet in every room. (Well, technically not every room is wired. The laundry room, bathrooms, and garage are not, an understandable oversight.)
After installing a new D-Link Gigabit Ethernet Switch, I wanted to check the throughput to see if I was actually getting gigabit speeds – particularly because the house is wired with CAT-5e cable (and not the recommended CAT-6).
There are many ways to measure network throughput. In the past I have usually copied a file across the network and used a stopwatch to get a relative sense of speed. However, due to file sharing protocol overhead I always got disappointing results and never knew maximum capability of my network.
This time, based on the advice of a more network-savvy friend, I decided to use a command-line tool called iperf.
iperf is a command-line tool to measure network performance. It is very powerful, but also easy to use for simple tests. For a more complete overview of what iperf is and what it can be used for, check out this tutorial or the iperf page on Wikipedia. iperf has a lot of options, and I won’t cover the majority of them here. For more usage information, consult the iperf manual.
If you run Debian or Ubuntu (Linux), iperf can be installed by executing
sudo apt-get install iperf
I did these tests with OS X on the Mac since both of my Macs have gigabit ethernet ports and my older PCs don’t. A package for iperf is conveniently available from Macports. It can be installed via the graphical package manager Porticus or opening a Terminal window and typing
sudo port install iperf
In my case, all I wanted was a quick test of TCP/IP network performance. This is easy to do, but it requires two computers, a client and a server, both connected to the network under test. Ideally, there should be no other network traffic during the test, as this will affect the results.
On the first computer, launch the iperf server by executing
iperf -s
You should see something like this:
------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 64.0 KByte (default) ------------------------------------------------------------
On the 2nd computer (the client), open a Terminal window and run
iperf -c <IP address or hostname of server> -i 1
Within a few seconds, you should start to see reports coming in on both the client and server terminal windows:
------------------------------------------------------------ Client connecting to mini.home, TCP port 5001 TCP window size: 129 KByte (default) ------------------------------------------------------------ [ 3] local 192.168.24.135 port 65142 connected with 192.168.24.77 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 1.0 sec 110 MBytes 924 Mbits/sec [ ID] Interval Transfer Bandwidth [ 3] 1.0- 2.0 sec 101 MBytes 850 Mbits/sec [ ID] Interval Transfer Bandwidth [ 3] 2.0- 3.0 sec 109 MBytes 914 Mbits/sec [ ID] Interval Transfer Bandwidth [ 3] 3.0- 4.0 sec 100 MBytes 841 Mbits/sec [ ID] Interval Transfer Bandwidth [ 3] 4.0- 5.0 sec 111 MBytes 927 Mbits/sec [ ID] Interval Transfer Bandwidth [ 3] 5.0- 6.0 sec 102 MBytes 853 Mbits/sec [ ID] Interval Transfer Bandwidth [ 3] 6.0- 7.0 sec 110 MBytes 923 Mbits/sec [ ID] Interval Transfer Bandwidth [ 3] 7.0- 8.0 sec 102 MBytes 858 Mbits/sec [ ID] Interval Transfer Bandwidth [ 3] 8.0- 9.0 sec 79.4 MBytes 666 Mbits/sec [ ID] Interval Transfer Bandwidth [ 3] 9.0-10.0 sec 93.6 MBytes 785 Mbits/sec [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 1018 MBytes 854 Mbits/sec
The last report (for the interval 0.0-10.0 sec) is the average throughput for the entire test. I’m more than happy with 854 Mbits (927 Mbits/sec peak!) given my fairly long runs of CAT-5e cable and other machines using the network. Contrast this with my results over 802.11g wireless:
[ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 24.9 MBytes 20.9 Mbits/sec