Saturday, August 8, 2009

Test Speed Connection Between Two Linux Machine

As a quick diagnostic tool, sometimes it’s nice to know exactly how fast two machines can (theoretically) be connected. I was having some slow downs on my NAS and using these command line tools, was able to determine that it was my NIC (and not my hard drives) that was causing the slow down. I learned this from a thread at slashdot.

Installing pv and nc

$ sudo apt-get install pv

Once you have nc and pv installed, it’s really simple. On one machine, run the following command:

$ nc -ulp 5000 > /dev/null

On the second machine run the following command (you need the IP address of the first machine):

$ pv < /dev/zero | nc -u ip.addy.of.other.machine 5000 And you should get some output with a little <=> sign moving across the screen that resembles this (static):

1.15GB 0:00:19 [ 218MB/s] [ <=> ]

This will show you the number of MB/s the connection is averaging; if you watch if for a bit, you can get an idea of where things stand. Here are some of the results I got between my RedHat, Fedora and Ubuntu Machines:

localhost: 218MB/s
gigabit Ethernet: 143MB/s
100MB ethernet: 11.5MB/s
wireless (poor connection): 141kB/s

1 comment: