I recently purchased a power line network adapter and wanted to see how it performed relative to the stated specs on the packaging. After playing around with wget and sftp to copy files from my desktop to my laptop I wondered if there was a better way to test network speed without involving the hard drive of my server or my client machines. What I found was that it's possible to use a few simple commands on the Linux command line to test local network speed without copying actual files.
Since I'm using this to test the speed of my home network, I need two machines up and running Linux on my LAN. I'll call the first machine Desktop and the second machine Laptop.
Start Netcat to Listen
I'm going to use a utility called netcat, or nc to listen on a particular network port on the Desktop machine. Enter the following command into a terminal on Desktop:
This tells the Desktop machine to listen for network traffic on port 2112 and to keep listening. Any output is sent to /dev/null.
Linux network speed test: dd and netcat
Now that the first machine, Desktop, is set up to listen, I'll use the second machine, Laptop, to send and receive data to test the network. The command below assumes that the IP address for Desktop is 192.168.2.2. Adjust the address accordingly for your network. From a terminal on Laptop, enter the following:
The first part of the command tells the machine to copy 10 megabytes of data from /dev/zero in 16 kilobyte blocks. The part after the pipe tells it to send that to the Desktop machine over port 2112.
You should see output similar to the screen shot below. In my case it showed that my wireless network is performing at 8.9 megabytes per second, or 71.2 megabits per second.
Once you're done testing, go to the terminal on Desktop and use [Ctrl]+C to stop netcat.
So there you have it. A simple way to perform a Linux network speed test from the command line. You can adjust the count parameter to send smaller or larger amounts of data if you like.
Look for my review of the TRENDnet TPL-406E power line adapter in a future post.
This content originally appeared on Tux Tweaks at https://tuxtweaks.com/2014/11/linux-network-speed-test/. Copyright 2014
Hey, can you please recommend some good opensource network traffic management tool that can also control the bandwidth of Internet in my office.
I had to make a couple of adjustments to your commands to get it to work: first, add "-p" before "2112" in the first command, and "-n" before the ip address in the second.
Josh's suggestion also works very well.
For both, make sure of course that there's no firewall blocking the incoming ports on the host acting as the server.
You can also try http://dl.getipaddr.net
They use curl (which is a well known command line utility) to run a speed test.
The code is published on GitHub as well. In short,
wget https://raw.github.com/blackdotsh/curl-speedtest/master/speedtest.sh && chmod u+x speedtest.sh && bash speedtest.sh
Yeah, I've seen similar tools. The purpose of this post is to test the local network speed. The are many tools available to test internet connection speed.
There is a handly scrit to check the speed from the terminal using Speedtest.net:
That's the wrong tool. The best way to test network performance is iperf.
Set up the server on machine 1
The run it from the other machine.
For a unidirectional tcp test do
iperf -c serverIP
For a bidreictional tcp test do
iperf -c serverIP -d