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§
- Set up a real experiment in Emulab. Further consider the uses of network emulation.
- Learn about and experiment with a tool for measuring effective bandwidth.
- Learn about the TCP and UDP protocols via experimentation.
Background§
Gain some familiarity with the basics of and differences between TCP and UDP from this comparison article on Diffen. You can supplement that with relevant sections from any of the course textbooks, if you like, but the level of detail in that article is sufficient.
Assignment§
Part A: Experimental Setup§
Start a new experiment on Emulab:
- Select the "CS330-F21-Lab2" profile, listed under the "CS330-F21" project. This profile specifies a set of nodes and the link(s) between them for your experiment.
- All of the other options can be left at their defaults.
The experiment profile creates a network with five nodes, named 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.)
[Note: Emulab creates this as a gigabit link in my recent testing, despite the link being specified as 100 Mbps. If you see results that suggest it is a gigabit link for you as well, note that discrepancy in your report.]
-
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.
Part B: Compiling Iperf§
We're going to use the iperf tool to test the bandwidth over these links. There is a version of iperf installed on the nodes, but it is old. We will install a new version and use that instead. 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. (If you don't have a copy of iperf-3.10.1.tar.gz in your home directory on Emulab, then you'll need to repeat the steps in Lab 0 that transfer it there.)
Follow these instructions to build the program we will use:
- Connect to node A using SSH.
- First, we need to extract the contents of the tar archive:
tar xzvf iperf-3.10.1.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-3.10.1 - Configure the build environment:
./configure
[lots of "checking for..." messages should scroll by] - And now build it!
make
[a whole lot of "make" and "libtool" messages...] - Now you should have a binary ready to run. Make sure it's there by running ./src/iperf3 --help, and verify that you get instructions on how to run iperf.
- Let's make a link to the program in your home directory so it's easy to access:
- cd ~ to change directory back to your home directory.
- ln -s iperf-3.10.1/src/iperf3 to make a link to the iperf3 program from your home directory.
- Now you should always be able to go to your home directory (cd ~ if you're not already there) and run iperf from there:
./iperf3 --help
If everything goes well, you should have the iperf3 program linked from your home directory, ready to be run from any node in your experiment (because all of your nodes share the same home directory, mounted over the network).
Part C: Starting the iperf3 Server§
-
Connect to nodea using SSH (if you're not still logged in from above).
-
Read the help documentation for the iperf3 program by running iperf3 --help.
-
On nodea, start up an iperf3 server to which you will connect for all of the tests. To do this, use the -s option.
For example,
liffiton@nodea:~$ ./iperf3 -s ----------------------------------------------------------- Server listening on 5201 -----------------------------------------------------------The iperf3 server is now running on nodea. You can stop it at any time by typing
Ctrl+C.
Part D: Loopback throughput§
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. This connection goes over a "virtual" network interface entirely within the operating system software.
-
Connect to nodea via SSH (in another terminal, because the earlier terminal should still be running iperf3 in server mode).
-
Connect to the server by running iperf3 in client mode. You can use the -t option to tell iperf3 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: ./iperf3 -c localhost
You will have to wait while the data is transferred — be patient! Note that iperf3 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 receiver's throughput in Mbps, converting from Gbps if needed. In this and all later steps, specifically record the "receiver" throughput, as that measures how much was actually transmitted successfully. (The "sender" values may be different if data was lost.)
Part E: TCP throughput on 10 and 100 Mbps networks§
Now we'll measure the throughput across real links between machines using the other four nodes to connect back to nodea.
-
Connect to node B using SSH.
-
Measure TCP throughput on the 100 Mbps link as follows. (Remember you want the receiver throughput.)
With the iperf3 server still running on node A, run iperf3 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.
-
Compute and report the average link utilization: the percentage of the underlying network's bandwidth that was used in the transfer.
-
Repeat your experiment with the 10 Mbps link by logging in to node C and connecting to node A with iperf3. Compare the results to those for Node B.
-
Repeat your experiment with the 10 Mbps, high latency link. Compare the results to those for Node C (10 Mbps, low latency, 0 packet loss).
-
Repeat your experiment with the 10 Mbps, 5% packet loss link. Compare the results to those for Node C (10 Mbps, low latency, 0 packet loss).
Part F: UDP throughput on 10 and 100 Mbps networks§
Repeat parts D and E using UDP rather than TCP. All client commands should be given the options -u (to enable UDP) and -b 0 (to instruct iperf to use as much bandwidth as it can for the test; this argument is required for UDP clients only).
For example, for the loopback test, your client command would be: ./iperf3 -c localhost -u -b 0
The iperf3 client will now report the number and percentage of "Lost Datagrams." Record and report this value for each link. Why is this value reported for UDP connections but not for TCP?
For some links, UDP may report shockingly high packet loss. Always pay attention to the received throughput, though, which is the actual amount of data successfully transmitted. If you see a very high packet loss value, note it in your report and consider the other reported statistics carefully to explain what caused it.
By how much does the throughput change in each case when switching from TCP to UDP?
Part G (10% extra credit): Throughput across "real" networks§
If you have further time and interest, use iperf3 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 iperf3. This is probably the most difficult part.
- Locate, download, compile, and/or install iperf3 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 E 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, on Piazza for the fastest response) if you get stuck.
Lab Report§
Include:
- a picture and description of the network topology you used (note that the picture alone does not provide all relevant details in this case);
- 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 above;
- 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?