Introduction§
Use the iperf tool to measure effective bandwidth, or throughput, on an emulated network.
Acknowledgments§
This lab is based on experiments 11.1 and 11.2 from Hands-On Networking with Internet Technologies by Douglas Comer (2nd edition, 2005).
Goals§
- Learn about and experiment with a tool for measuring effective bandwidth.
- Set up a real experiment in Emulab. Further consider the uses of network emulation.
Assignment§
Part A: Experimental Setup§
Create an Emulab experiment with a network configured as follows. The Emulab tutorial links to a Java applet that lets you create the needed .ns file in a GUI, or you can write it yourself following the examples in the tutorial.
- Setup five nodes, all running the default OS (i.e., don't set the OS option for any of them). Name these nodeA, nodeB, nodeC, nodeD, and nodeE.
- Nodes A and B are connected by a 100 Mbps link with 0 latency. (A latency of less than 1 ms is typical for a local area network. With a latency of 0 ms on Emulab, you should get the true latency of the underlying physical network.)
- Nodes A and C are connected by a 10 Mbps link with 0 latency.
- Nodes A and D are connected by a 10 Mbps link with 100 ms of latency. (This is typical for a connection across the U.S.)
- Nodes A and E are connected by a 10 Mbps link with 0 latency and 5% packet loss (i.e., set the loss to 0.05).
Start your experiment. Note that if you are having difficulty acquiring enough nodes, you can create a smaller network with only two nodes and one link; in that case, you will need to reconfigure the network several times in parts C and D to create the needed links.
Part B: Compiling Iperf§
We're going to use the iperf tool to test our bandwidth, but it isn't installed on the nodes by default. That's why we transferred the source code to our nodes in Lab 0. The nodes all share a filesystem, so your file should still be where you left it in your home directory. Follow these instructions to build the program we will use:
If you don't have the correct file, iperf-2.0.5.tar.gz, you can download it directly to your node by running wget http://iweb.dl.sourceforge.net/project/iperf/iperf-2.0.5.tar.gz when logged in to a node via SSH. This file is a tar file (aka "tarball"), and we'll follow instructions similar to these to build it into the program we need.
- First, we need to extract the contents of the tar archive:
tar xzvf iperf-2.0.5.tar.gz
[a bunch of files are printed out as they are created] - Change into the directory that should have just been created:
cd iperf-2.0.5 - Configure the build environment:
./configure
[lots of "checking for..." messages should scroll by] - And now build it!
make
[a whole lot of "make" and "gcc" or "g++" messages...] - Now you should have a binary ready to run. Make sure it's there by running ./src/iperf --help, and verify that you get instructions on how to run iperf.
- Let's copy the program to your home directory so it's easy to find:
cp ./src/iperf ~/ - Now you should be able to go to your home directory (cd ~) and run iperf from there:
./iperf --help
If everything goes well, you should have the iperf binary in your home directory, ready to be run from any node in your experiment.
Part C: Loopback throughput§
-
Connect to node A using SSH.
-
Read documentation for the iperf program by running iperf --help.
-
On your node (node A), start up an iperf server to which you will connect for all of the tests. To do this, use the -s and -D options.
For example,
liffiton@node0:~$ ./iperf -sD Running Iperf Server as a daemon The Iperf daemon process ID : 3898 liffiton@node0:~$(The -D option tells iperf to run as a "daemon" in the background. Iperf is still running even when you get your next prompt, and it tells you the process ID (PID), 3898 in this example, so you can still control the backgrounded program. Later, to end the program running in the background, you can use the kill program, giving it the PID of your backgrounded process. See kill's manpage for details.)
-
Our first test will be a loopback test; that is, we'll connect and measure the bandwidth from the same computer on which the server is running. Connect to the server with iperf in client mode. You can use the -t option to tell iperf how many seconds to transmit data, but by default it will transfer and measure for 10 seconds. This will be good for our experiments. The easiest way to connect to the local computer is to refer to it as localhost, so the command will be: ./iperf -c localhost
You will have to wait while the data is transferred — be patient! Note that iperf transfers data using TCP by default.
-
In your lab report, record the size of data sent (in bytes) and the time taken (in seconds). Record the throughput in Mbps.
Part D: TCP throughput on 10 and 100 Mbps networks§
-
Connect to node B using SSH.
-
Measure TCP throughput on the 100 Mpbs link as follows.
With the iperf server still running on node A, run iperf in client mode on node B. Now, instead of a target of localhost, give the short name of the other machine (e.g., nodeA).
Run the default 10 second measurement.
-
Repeat the measurement 10 times. Record the throughput each time.
-
Compute and record three values:
- the mean throughput in bits per second (Mbps);
- the standard deviation;
- the average link utilization: the percentage of the underlying network's bandwidth that was used in the transfers
-
Repeat your experiment with the 10 Mbps link by logging in to node C and connecting to node A with iperf. Compare the results to the 100Mbps connection.
-
Repeat your experiment with the 10 Mbps, high latency link. Compare the results to the previous.
-
Repeat your experiment with the 10 Mbps, 5% packet loss link. Compare the results to the previous.
Part E: UDP throughput on 10 and 100 Mbps networks§
Repeat parts C and D using UDP rather than TCP. You will need to restart your server process in UDP mode, and all client commands should be given the options -u (to enable UDP) and -b 10000M (to instruct iperf to use up to 10000Mbps for the test; this is required for UDP clients only).
For example, for the loopback test, your client command would be: ./iperf -c localhost -u -b 10000M
By how much does the throughput change in each case when switching from TCP to UDP?
Part F (10% extra credit): Reading source§
Obtain the C language source code for iperf, read/skim it, and write a paragraph or two giving a high-level explanation of how it works.
(Tips: Start with main(); look up functions you don't recognize using man or the internet; use a text editor with syntax highlighting (TextWrangler on the Macs is good, and Notepad++ works well for Windows); and don't dig too deep.)
(Note: The code is not hugely long, but neither is it well-documented. Do your best, but don't obsess!)
Part F (10% extra credit): Throughput across "real" networks§
If you have further time and interest, use iperf to measure TCP throughput across one or more "real" networks. To do this, try the following steps.
- Identify two or more machines where you have login access and can install/run iperf. This is probably the most difficult part.
- Locate, download, compile, and/or install iperf on at least two machines.
- Record the hostname, IP address, and geographic location (if known) of each machine.
- Use the ping program to determine the RTT between each pair of machines.
- Conduct the experiment in part D, exercises 2-4, for one or more pairs of machines. You may want to try doing the same pair twice, reversing the role of sender and receiver. What do you learn?
Advice§
Lab 0 and the Emulab tutorial will be good preparation for this experiment. You may need to refer back to the tutorial to remind you how to do some things.
There are many tutorials for iperf online. If you find one useful, please cite it in your lab report and share it with others.
Feel free to ask for help (from me or your classmates) if you get stuck.
Lab Report§
Include:
- your ns configuration file;
- a picture of the network topology you used;
- the procedures followed (describe briefly, including commands as needed, what you did for each part (A, B, C, etc.));
- discussion of the questions asked in the lab description;
- results obtained for your experiments; and
- your answers to the discussion questions below.
Discussion Questions§
Answer the following questions to the best of your understanding.
- Why is throughput not infinite for the loopback configuration? What is limiting it?
- Why might the use of a different transport protocol (UDP vs TCP) affect throughput? (We'll discuss this in detail later in the course, but just a bit of research should give you some idea now.)
- How does link utilization compare for a 10 Mbps versus a 100 Mbps link? Form a hypothesis as to why this relationship exists.
- Why would latency affect throughput?
- How could the effect of packet loss on throughput be more than the percent packet loss? Why doesn't the loss of 5% of the packets simply reduce bandwidth by 5%?
- What did you find most surprising or interesting about this assignment?
- How long did you spend on this assignment? What problems, if any, did you run into?