Introduction§
Use the iperf3 tool to measure effective bandwidth, or throughput, on a 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 Cloudlab. 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.
Advice§
Lab 0 and the Cloudlab manual will be good references for this experiment. You may need to refer back to them 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 (on Piazza for the fastest response) if you get stuck.
Lab Report§
Definitely 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;
- results obtained for your experiments; and
- your answers to the discussion questions.
And as usual, do not include excessive output transcripts. Think about what information is important for conveying what you did and helping someone potentially reproduce your work. It requires some careful critical thinking about what your audience might need or find valuable.
Assignment§
Part A: Experimental Setup§
Start a new experiment on Cloudlab:
- Select the "CS330-F25-Lab2" profile, listed under the "CS330-F25" project. This profile specifies a set of nodes and the link(s) between them for your experiment. Create your experiment on the "Emulab" cluster. Selecting the correct cluster is important, because not all of them support the network configuration used in this lab.
- 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 the "native" physical network of the cluster in which your experiment runs.
- Nodes A and C are connected by a "shaped" link: 10 Mbps link with 0 latency. (Cloudlab's "emulated" network allows us to control link properties like this. Setting the latency to "0" doesn't violate the speed of light, though; the actual latency of the link will just be the underlying network's latency with no added delay.)
- Nodes A and D are connected by a shaped 10 Mbps link with 100 ms of latency. (This is typical for a connection across a continent or ocean.)
- Nodes A and E are connected by a shaped 10 Mbps link with 0 latency and 5% packet loss.
Part B: Running iPerf§
We're going to use the iperf3 tool to test the bandwidth over these links. That's the program we practiced transferring to a node in Lab 0. But I've simplified things for this lab to save time.
I've compiled and installed iperf3 at the path /proj/CS330-F25/iperf3. Change to the /proj/CS330-F25/ directory and verify the file is there with ls. You will run this command repeatedly in the lab. This means that you should either:
- Always run it as
/proj/CS330-F25/iperf3, specifying an absolute path to the program's location.
Or:
- Link the executable to your home directory by running
ln -s /proj/CS330-F25/iperf3 ~/. You will need to run the linking command once on each node, as each has its own filesystem and home directory. Then you can run./iperf3as long as your current directory is your home directory.
If you're curious, here is how you could download and build iperf3 yourself:
Click to expand
Follow these instructions to build the iperf3 program we will use. These instructions will need to be performed on each of the nodes individually.
- Connect to the node using SSH.
- Download the latest version of iPerf 3 (but not the "under development" one):
- Copy the URL for the link to the source code for that version from this page. The filename in the URL should end with -source.tar.gz. Version 3.14 is the latest as I'm writing this, but check if there is anything newer.
- Download that file to the node by running
wget URLon the node, where URL is the URL you copied. (wget is a super handy tool!)- Verify the file was downloaded by checking that it exists and has the correct size in the output of
ls -l.- Extract the contents of the tar archive:
tar xzvf iperf-xxxxx.tar.gz
[a bunch of files' names are printed out as they are created]
(Tip: Tab completion is a great way to save typing and avoid typos on the command line.)- Change into the directory that should have just been created:
cd iperf-xxxxx- Configure the build environment:
./configure
[lots of "checking for..." messages should scroll by]- And now build it!
make
[a whole lot of "make" and "CC" 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.
- Link the executable to your home directory by running
ln -s ~/iperf-xxxxx/src/iperf3 ~/.- Now you should always be able to go to your home directory on this node (cd ~ if you're not already there) and run iperf from there:
./iperf3 --help
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 native and shaped 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 "native" 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 native and shaped 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?
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 link versus the native network 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?