terça-feira, 17 de maio de 2016

IPERF - Testando performance

Output of iperf -c

Testing Network Throughput with an Iperf Server

Every now and again I need to test throughput on a local segment of our LAN. Other times I want to test the throughput of an offsite VPN connection. I am able to accomplish this with Iperf, Iperf2 specifically.  This post will focus on setting up iperf2 in server mode on an Ubuntu 14.04 machine and then using iperf2 from a Macbook.

Note: Iperf3 is available with a few added features. However, I occasionally want to use jperf so that I can pass along graphs to the management team. 

Building the Server

We are going to assume that you already have Ubuntu 14.04 up and running on a VM somewhere. If you need help doing that, check out this article from Frank Hinek.
Launch a SSH session or open terminal and type:
sudo apt-get install iperf
Once installed, you can run:
sudo iperf -s
The -s switch starts iperf in server mode. However, I was interested in automating this a bit more. I wanted to be able to have iperf startup when the server did, with no interaction necessary. This allows for any of our engineers to use iperf without worrying if it has been started up. To do this, run the following commands:
sudo touch /etc/init.d/iperf
sudo chmod +x /etc/init.d/iperf
These two commands create a script called iperf and make it executable. Next, we’ll load the script in nano:
sudo nano /etc/init.d/iperf
and add the following lines:
!#/bin/bash
/usr/bin/iperf -s &
then save the file. You can add any switch you would like. Run iperf –help to see a full list of switches. Finally, we need to tell Ubuntu when we want iperf to run during the boot sequence:
sudo update-rc.d iperf defaults
Ok, our server should be setup. To recap, we installed iperf from the default Ubuntu repos and automated its startup. The service should be running after a reboot, so lets move on to the client setup.

Client Setup – Mac OS X

Setting up a Mac with iperf2 is a simple task thanks to rudix. You can grab the package from this link and install it like any other application. Depending on how your security settings are configured, you may see the following message:
Security Setting on Mac
Go ahead and open the Security settings for your Mac and click ‘Open Anyway.’ Go through the standard install process and things should be ready to go in just a few minutes. Once installed, launch terminal and type:
iperf -c *serverIpAddress*
Where *serverIpAddress* is your iperf server. This will launch a single 10 second test, the results should be similar to this screenshot.
Output of iperf -cGreat! So now we have setup our iperf server and verified that we can test. From this point on, you should be able to connect to any LAN segment that has access back to your iperf server and run a throughput test. Please remember this is just a basic overview of what iperf is capable of, and with a little tuning you can hit even better speeds. Have a look at the manual for iperf here or by using the –help switch in terminal.
Note: Windows users can grab a client .exe from iperf.fr as well.

Wrap-Up

There you have it, a quick guide to setting up an Ubuntu 14.04 server with iperf2 and a Mac (or Windows) client setup guide. Overall this is quick and easy setup, and iperf is a great tool to have in your arsenal. It is a nice utility that helps troubleshoot LAN to datacenter connections and with an add-on like jperf you can even report you findings with a visual graph.
In the next week or so I will have another post detailing some of the more advanced features of iperf. If you use iperf and have any good tips or tricks, leave a comment below!


fonte: https://vlan50.com/2015/04/07/testing-network-throughput-with-an-iperf-server/#more-75

0 comentários: