How to measure network performance with iperf
Follow @ggarronNowadays we have a lot of bandwidth available right?, well maybe not, yes it is true that in some countries, it is easy to have a 10 Mbps connection to the Internet, but that is only the connection speed of your house/office to the HQ of your Internet service provider, and not to the Internet itself, it is good to have that kind of connection if you are getting Video on demand, Voice over ip (VoIP) from your service provider, but if you are planning to get services from beyond that point you will need good connection with the server that is providing you the service.
Let's see this situation, you work from your home for a company abroad, so you have a VoIP phone at your desk, you will need reliable connection speed to use that service, using iperf you will be able to test the connection between your HQ and your home.
Firts of all, you need two Linux machines, one on each side of the link, in this case one in your home and one at the company HQ, install iperf on both of them.
Debian/Ubuntu
sudo aptitude install iperf
Centos/Fedora
sudo yum install iperf
ArchLinux
sudo pacman -S iperf
Now start one of them in server mode
iperf -s
And on the client site enter this command
iperf -c x.y.z.w -i2
Where x.y.z.w is the ip of server
it will now show you the performance of the network
------------------------------------------------------------ Client connecting to x.y.z.w, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 3] local 200.87.61.83 port 54637 connected with 200.87.59.2 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 2.0 sec 8.00 KBytes 32.8 Kbits/sec [ ID] Interval Transfer Bandwidth [ 3] 2.0- 4.0 sec 24.0 KBytes 98.3 Kbits/sec [ ID] Interval Transfer Bandwidth [ 3] 4.0- 6.0 sec 56.0 KBytes 229 Kbits/sec [ ID] Interval Transfer Bandwidth [ 3] 6.0- 8.0 sec 48.0 KBytes 197 Kbits/sec [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 172 KBytes 141 Kbits/sec
As you can see in this connection the bandwidth is increasing, and that is because by the time of the test I was downloading a file from the Internet, and that download slowed down to give room to iperf.
Now, this is in only one way, as in our example we are testing for VoIP application and that is symetric traffic in both ways, try this command.
iperf -c x.y.z.w -d
Server listening on TCP port 5001 TCP window size: 85.3 KByte (default) ------------------------------------------------------------ ------------------------------------------------------------ Client connecting to x.y.z.w, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 4] local x'.y'.z'.w' port 54641 connected with x.y.z.w port 5001 [ 5] local x'.y'.z'.w' port 5001 connected with x.y.z.w port 48957 [ ID] Interval Transfer Bandwidth [ 4] 0.0-10.0 sec 146 KBytes 120 Kbits/sec [ ID] Interval Transfer Bandwidth [ 5] 0.0-30.0 sec 192 KBytes 52.4 Kbits/sec
You may see that in way there is a lot better performance, once again because I am downloading that file.