Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have gigabit network setup in my house and few Ubuntu based boxes. Out of complete curiosity I would like to check the speed between the two boxes. I am not having any problems with speed or anything, it really is just the geek in me that is curious. Plus maybe the results will let me know if there is room for improvement, or that I have something configured wrong.

So how do you properly test the network speed between Ubuntu boexs?

share|improve this question
up vote 105 down vote accepted

I use iperf. It's a client server arrangement in that you run it in server mode at one end and connect to its from another computer on the other side of the network.

One both machines run:

sudo apt-get install iperf

We'll start an iperf server on one of the machines:

iperf -s

And then on the other computer, tell iperf to connect as a client:

iperf -c <address of other computer>

On the client machine, you'll see something like this:

oli@bert:~$ iperf -c tim
Client connecting to tim, TCP port 5001
TCP window size: 16.0 KByte (default)
[  3] local port 37248 connected with port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  1.04 GBytes    893 Mbits/sec

Of course, if you're running a firewall on the server machine, you'll need to allow connections on port 5001 or change the port with the -p flag.

You can do pretty much the same thing with plain old nc (netcat) if you're that way inclined. On the server machine:

nc -vvlnp 12345 >/dev/null

And the client can pipe a gigabyte of zeros through dd over the nc tunnel.

dd if=/dev/zero bs=1M count=1K | nc -vvn 12345

As demod:

$ dd if=/dev/zero bs=1M count=1K | nc -vvn 12345
Connection to 12345 port [tcp/*] succeeded!
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 9.11995 s, 118 MB/s

The timing there is given by dd but it should be accurate enough as it can only output as fast the pipe will take it. If you're unhappy with that you could wrap the whole thing up in a time call.

Remember that the result is in megabytes so multiply it by 8 to get a megabits-per-second speed. The demo above is running at 944mbps.

share|improve this answer
Man you have all the answers to my questions! My network apparently is not set up as well as yours only transfer at 714 MBytes and bandwith of 598 Mbits/sec. Dunno may look into that in the future. Thanks. – Jacob Schoen Oct 17 '10 at 17:24
In fairness the other box is only one switch (and 20meters of cat5e) away and there's no congestion. 600mbps is still pretty fast. – Oli Oct 17 '10 at 17:33
This is great, but I don't have root access to the server. – Geoff Dec 30 '13 at 20:59
Try -P 10. My result with single connection is similar to jschoens, but with 3+ parallel connections, it consistently pushes 920Mbps. – wujj123456 May 14 '14 at 7:38
What if you don't control the server? – CMCDragonkai Feb 5 at 14:04

Same as Oli's recommendation for iperf. Just want to add several points:

  1. There are also windows clients that enables testing across platforms.
  2. -t change test length. -P change number of simultaneous connections. e.g. "iperf -c [target IP] -P 10 -t 30" tests 10 connections together for 30 seconds and give aggregated results along with 10 separate connection speeds.
  3. You don't need sudo. You can simply download the binary here: It should work. wget, chmod, and you can directly run the binary. It works perfectly.

I found using default settings, the single connection speed fluctuates quite a bit. However, with 3+ parallel connections, the results are more consistent on my gigabyte switch. (consistently @ 910-920Mbps)

share|improve this answer

Good script. I like my results to be in mbps so I edited the last part of the script to do some simple division.

# print result
echo ""
#echo "Upload speed:   $up_speed kB/s"
#echo "Download speed: $down_speed kB/s"

up_mbps=$(echo "scale=0; $up_speed/125" |bc)
down_mbps=$(echo "scale=0; $down_speed/125" |bc)

echo ""
echo "Upload speed:    $up_mbps mbps"
echo "Download speed:  $down_mbps mbps"

So instead of the result looking like this:

Upload speed:   9124.93 kB/s
Download speed: 13631.51 kB/s

It now displays like this:

Upload speed:    114 mbps
Download speed:  88 mbps
share|improve this answer

Using this script you can easily test connection speed between your machine and some remote host. Example of using:

$ user@remote_host 80000
  • user@remote_host is your destination host (you must have ssh-access to this host)
  • 80000 is the approximate size of test file (in kbs), which will be received to the remote host. It is not mandatory argument.
share|improve this answer

If you want to test your Ethernet LAN at a lower level you can use Etherate which is a free Linux CLI Ethernet testing tool:

Throwing it in the mix as tools like iPerf (which are very good!) operate over IP and TCP or UDP. Etherate tests directly over Ethernet / OSI layer 2.

share|improve this answer

It's easy plug your computer on the first box, plug the other box to the first box. Then from your computer ping the first box save the result, ping the other box and do the substraction.

share|improve this answer
That shows network latency which is only one part of speed. For example my phone's 3G connection has huge latency (100-300ms) but it can still manage a throughput of 5mbps. – Oli Oct 17 '10 at 17:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.