I am often asked how one can perform simple network testing within, outside, and into XenServer. This is a great question as – by itself – it is simple enough to answer. However, depending on what one desires out of “network testing” the answer can quickly become more complex.
As such, this I have decided to answer this question using a long standing, free utility called IPERF (well, IPERF2). It is a rather simple, straight-forward, but powerful utility I have used over many, many years. Links to IPERF will be provided - along with documentation on its use - as it will serve in this guide as a way to:
- Test bandwidth between two or more points
- Determine bottlenecks
- Assists with black box testing or “what happens if” scenarios
- Use a tool that runs on both Linux and Windows
- And more…
IPERF: A Visual Breakdown
IPERF has to be installed on/at at least two separate end points. One point acts a server/receiver and the other point acts as a client/transmitter. This so network testing can be done on a simple subnet to a complex, routed network: end-to-end using TCP or UDP generated traffic:
The visual shows an IPERF client transmitting data over IPv4 to an IPERF receiver. Packets traverse the network - from wireless routers and through firewalls - from the client side to the server side to over port 5001.
IPERF and XenServer
The key to network testing is in remembering that any device which is connected to a network infrastructure – Virtual or Physical – is a node, host, target, end point, or just simply … a networked device.
With regards to virtual machines, XenServer obviously supports Windows and Linux operating systems. IPERF can be used to test virtual-to-virtual networking as well as virtual-to-physical networking. If we stack virtual machines in a box to our left and stack physical machines in a box to our right – despite a common subnet or routed network – we can quickly see the permutations of how "Virtual and Physical Network Testing" can be achieved with IPERF transmitting data from one point to another:
And if one wanted, they could just as easily test networking for this:
To illustrate a basic server/client model with IPERF, the following will be required:
- A Windows 7 VM that will act as an IPERF client
- A CentOS 5.x VM that will act as a receiver.
- IPERF2 (the latest version of IPERF, or "IPERF3" can be found at https://github.com/esnet/iperf or, more specifically, http://downloads.es.net/pub/iperf/)
The reason for using IPERF2 is quite simple: portability and compatibility on two of the most popular operating systems that I know are virtualized. In addition, the same steps to installing IPERF2 on these hosts can be carried out on physical systems running similar operating systems, as well.
The remainder of this article - regarding IPERF2 - will require use of the MS-DOS command-line as well as the Linux shell (of choice). I will carefully explain all commands as so if you are “strictly a GUI” person, you should fit right in.
When utilizing IPERF2, keep in mind that this is a traffic generator. While one can control the quantity and duration of traffic, it is still network traffic!
So, consider testing during non-peak hours or after hours as to not interfere with production-based network activity.
Windows and IPERF
The Windows port of IPERF 2.0.5 requires Windows XP (or greater) and can be downloaded from:
Within the .zip file you will find two directories. One is labeled DEBUG and the other is labeled RELEASE. Export the Iperf.exe program to a directory you will remember, such as C:\iperf\
Now, accessing the command line (cmd.exe), navigate to C:\iperf\ and execute:
The following output should appear:
Linux and IPERF
If you have additional repos already configured for CentOS, you can simply execute (as root):
yum install iperf
If that fails, one will need to download the Fedora/RedHat EPEL-Release RPM file for the version of CentOS being used. To do this (as root), execute:
rpm -Uvh epel-release-5-4.noarch.rpm
*** Note that the above EPEL-Release RPM file is just an example (a working one) ***
Once epel-release-5-4.noarch.rpm is installed, execute:
yum install iperf
And once complete, as root execute iperf and one should see the following output:
Notice that it is the same output as what is being displayed from Windows. IPERF2 is expecting a "-s" (server) or "-c" (client) command-line option with additional arguments.
IPERF Command-Line Arguments
On either Windows or Linux, a complete list of options for IPERF2 can be listed by executing:
A few good resources of examples to use IPERF2 options for the server or client can be referenced at:
For now, we will focus on the options needed for our server and client:
-f, –format [kmKM] format to report: Kbits, Mbits, KBytes, MBytes
-m, –print_mss print TCP maximum segment size (MTU – TCP/IP header)
-i, –interval # seconds between periodic bandwidth reports
-s, –server run in server mode
-c, –client <host> run in client mode, connecting to <host>
-t, –time # time in seconds to transmit for (default 10 secs)
Lastly, there is a TCP/IP Window setting. This goes beyond the scope of this document as it relates to the TCP frame/windowing of data. I highly recommend reading either of the two following links – especially for Linux – as there has always been some debate as what is “best to be used”:
Running An IPERF Test
So, we have IPERF2 installed on Windows 7 and on CentOS 5.10. Before one performs any testing, ensure any AV does not block iperf.exe from running as well as port 5001 being opened across the network network.
Again, another port can be specified, but the default port IPERF2 uses for both client and server is 5001.
The Server/Receiver side will be on the CentOS VM.
Following the commands above, we want to execute the following to run IPERF2 as a server/receiver from our Windows 7 client machine:
iperf -s -f M -m -i 10
The output should show:
Server listening on TCP port 5001
TCP window size: 0.08 MByte (default)
The TCP window size has been previously commented on and the server is now ready to accept connections (press Control+C or Control+Z to exit).
Let us now focus on the client side to start sending data from the Windows 7 VM to the CentOS VM.
From Windows 7, the command line to start transmitting data for 30 seconds to our CentOS host (x.x.x.48) is:
iperf -c x.x.x.48 -t 30 -f M
Pressing enter, the traffic flow begins and the output from the client side looks like this:
From the server side, the output looks something like this:
And there we have it – a first successful test from a Windows 7 VM (located on one XenServer) to a CentOS 5.10 VM (located on another XenServer).
Understanding the Results
From either the client side or server side, results are shown by time and average. The key item to look for from either side is:
0.0-30.0 sec 55828 MBytes 1861 MBytes/sec
Why? This shows the average over the course of 0.0 to 30.0 seconds in terms of total megabytes transmitted as well as average megabytes of data sent per second. In addition, since the "-f M" argument was passed as a command-line option, the output is calculated in megabytes accordingly.
In this particular case, we simply illustrated that from one VM to another VM, we transferred data at 1861 megabytes per second.
*** Note that this test was performed in a local lab with lower-end hardware than what you probably have! ***
--jkbs | @xenfomation