0% found this document useful (0 votes)
9 views6 pages

Projet RX Fairness - 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

Projet RX Fairness - 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

TCP and UDP Fairness

In the second part of your project, you will explore in a virtual environment the impact of the
congestion on TCP and UDP. You will see how competing flows behave in case of congestion.

1. Mininet Virtual Machine


In the following, you will use the virtual machine where the main software components of Mininet and
the appropriate tools are already installed.

• Start by importing the virtual machine qos-lab into VirtualBox.

• Run the machine (login: user, password: user).

2 Lab Preparation
During this lab, you will study various aspects of congestion control in several network topologies
constructed by Python scripts in Mininet.

On the Virtual Machine (VM), the folder 2-Congestion-Control-lab contains three folders. The folder
scripts/ contains the python scripts that will be used to build the topologies of this lab. The folders
tcp/ and udp/ contain TCP and UDP clients and servers respectively that we will use to measure the
goodput of each flow.

Start the VM and go in the directory 2-Congestion-Control-lab (by typing cd 2-Congestion-Control-


lab). Make the programs executable by typing:

chmod +x tcp/tcpclient tcp/tcpserver udp/udpclient udp/udpserver

Last, we need to check and/or modify the congestion control mechanism. On a Linux machine, you
can test which congestion control mechanism is used by typing in a terminal:

cat /proc/sys/net/ipv4/tcp congestion control

In this lab, we will force TCP to use the RENO congestion control algorithm. If the congestion
control algorithm is not RENO, you can change it until the next reboot by typing in a terminal:

echo reno >/proc/sys/net/ipv4/tcp congestion control

Note that all folders contain binary programs as well as the source code. Though, the binaries should
work in your VM and you should not need to recompile the source codes. If you want to (or need to)
recompile them, you can type make in its own directory.
QoS ESIB S5

h1

sw1 r1
Switch Router h3
1
eth0 eth1
2
3
h2

10.10.0.0/24 10.10.1.0/24

Figure 1: Initial configuration with three PCs and one router


Figure 1: Initial configuration with three PCs and one router
3 TCP vs UDP Flows
3 TCP vs UDP Flows
TheThe
python script
python scripts/lab21_network.py
script scripts/lab21 network.pybuilds the topology
builds shown
the topology in Fig.1.
shown In the
in Fig.1. Interminal of
the termi-
your VM run the script lab21_network.py by typing sudo python lab21_network.py.
nal of your VM run the script lab21 network.py by typing sudo python lab21 network.py.

• You can test your configuration after running the topology with the pingall command.
• You can test your configuration after running the topology with the pingall command.
• If you• want towant
If you shutdown the simulation,
to shutdown you can use
the simulation, youthe
canexit
usecommand
the exiton the mininet
command command
on the mininet
line. command line.

3.1 Testing the Connectivity with Basic UDP and TCP Clients and Servers
The3.1
directory udp/ contains
Testing two programs:
the Connectivity udpserver
with and udpclient.
Basic UDP and TCP Their usage is:and Servers
Clients

./udpserver PORT ./udpclient IP_SERVER PORT RATE


The directory udp/ contains two programs: udpserver and udpclient. Their usage is:
For the server, PORT is the port number on which the server listens. For the client IP SERVER and
PORT are the IP address
./udpserver PORT and port of the machine to which the packets are sent and RATE is the rate
at which the clientIP_SERVER
./udpclient sends data (in
PORTkilobits
RATEper seconds). The client sends packets of size 125 bytes if the
rate is lower than 50 kbps and of size 1000 bytes otherwise. The output of the UDP client has the
following format:
For the server, PORT is the port number on which the server listens. For the client IP SERVER
4.0s - sent:
and PORT 503 pkts,
are the 1000.0 and
IP address kbits/s
port of the machine to which the packets are sent and RATE is
the rate at which the client sends data (in kilobits per seconds). The client sends packets of size
5.0s
125- sent:
bytes 629
if thepkts,
rate 1000.6 kbits/s
is lower than 50 kbps and of size 1000 bytes otherwise. The output of the
UDP client has the following format:
5.0 is the number of seconds since the launching time of the client, 629 is the total number of packets
sent by the client and 1000.6 is sending rate during the last second (in kilobits per second).
4.0s - sent: 503 pkts, 1000.0 kbits/s
The5.0s - sent:
output 629 server
of the UDP pkts,has
1000.6 kbits/sformat:
the following

169.5s - received: 723/ sent: 741 pkts (loss 2.429%), 959.6 kbit/s
5.0 is the number of seconds since the launching time of the client, 629 is the total number
of packets sent by the client and 1000.6 is sending rate during the last second (in kilobits per
170.5s - received: 843/ sent: 867 pkts (loss 2.768%), 957.7 kbit/s
second).
TheThe
values of the
output of second
the UDPlineserver
are explained as: 170.5format:
has the following is the time since the launching of the server, 843
and 867 are the total number of packets sent by the client and received by the server, 2.768 is the
percentage of packets that were lost and 957.7 is the rate at which packets were received during the
last169.5s
second. -The latter value723/
received: is defined
sent:as 741
the goodput at the2.429%),
pkts (loss last second (see kbit/s
959.6 also the remarks in the
following
170.5ssection).
- received: 843/ sent: 867 pkts (loss 2.768%), 957.7 kbit/s

Start a UDP server on host h3 that listens on port 10000.


2
Note: If you run the experiment multiple times the results may vary since Mininet is a network
emulator. Thus, you need to run each experiment multiple times (e.g., 5 times) and provide the averaged
values as the answer.

1. Launch a UDP client on host h1 that sends data to this server at rate 100 kbps. What are the loss
probability and the goodput that you observe on h3?

2. Repeat the operation with 1 Mbps, 10 Mbps, 100 Mbps and 1 Gbps. What are the goodputs
and loss probabilities? At which rate the loss probability is greater than 1%? Explain the results via
also carefully observing the code in the script lab21_network.py.

The directory tcp/ contains two programs: tcpserver and tcpclient. Their usage is similar to
udpserver and udpclient, except that we do not specify a rate to the client: the client has an unlimited
amount of data to send and uses TCP congestion control algorithm to control at which rate it sends
the data to the server.

./tcpserver PORT

./tcpclient IP_SERVER PORT

The output of a TCP client looks like this:

6.3: 854.0kbps avg ( 944.5[inst], 926.5[mov.avg]) cwnd 9 rtt 83.9ms

7.3: 862.4kbps avg ( 914.6[inst], 925.3[mov.avg]) cwnd 9 rtt 86.8ms

The values of the second line are explained as: 7.3 is the time, 862.4 is the average rate of the client:
the total amount of data that was successfully transferred by the client divided by the total time (this is
defined as goodput - average value - for the TCP). 914.6 is the instantaneous rate (approximately over
the last second) and 925.3 is a moving average of this value. The value 9 is the congestion window of
the TCP connection and 86.8 is the RTT measured by the TCP congestion control algorithm.

Start a TCP server on host h3 that listens on port 10001.

3. Launch a TCP client on host h1 that sends data to this server. What is the goodput of the
connection?

3.1.1 Remarks on the TCP and UDP programs


• For each UDP flow, you need one UDP client and one UDP server. In fact, each packet sent by a
client contains its sequence number (the first packet contains the label 1, the second 2, etc). The loss
probability printed by the server is one minus the ratio between the number of packet received
divided by the largest sequence number received. Because of this implementation, the loss probability
printed by the server is wrong if two clients talk to the same server.

• For TCP, one server can handle multiple clients. The server creates one thread per accepted
connection.

• Before each experiment, kill all clients (TCP and UDP) (you can do that by pressing Control-C in the
terminal of the client). This will reset the average values printed by the clients. In theory, you can
keep the server running but killing them and relaunching them will not harm.

• The printed rates correspond to application data. They count the amount of data that was
transferred by the TCP/UDP client to the TCP/UDP server. They do not take into account headers.
• For all experiments, you have to wait until the printed values stabilize. This is particularly important
for TCP. The rate at which TCP sends packets depends on the losses that occur at random. Thus, to
obtain deterministic values, you should wait for the average rate to be stable (2 minutes is probably
OK for most scenarios). We also encourage you to run the experiments multiple times.

• Goodput. The goodput of a flow is the rate of application data (i.e., useful data) that is successfully
transmitted. For the theoretical questions, you should take into account that the packets also contain
headers except from the application data.

• Units. In all your answers, indicate in which unit your result is expressed (Mbps, kbps, %, etc).

• Queueing delay. It is defined as the time (in the appropriate unit) that a packet waits stored in the
queue of a router until it is forwarded.

3.2 Limitation of the Bandwidth of the Router


In order to reproduce experiments where the performance is limited by the network capacities, we will
further limit the bandwidth of some interfaces. To do so, in this section we will specify the appropriate
parameters for limiting the bandwidth in the topology through the possibilities offered by the TCLink
class. For more information you can refer to the Mininet documentation (http://mininet.org/api/
classmininet_1_1link_1_1TCLink.html).

In the script lab21_network.py that you run in the previous section, you can find the command:

link r1sw2.intf1.config(bw=10)

This command configures the bandwidth of the interface eth1 of the router to 10 Mbps.

Modify the above command so that the bandwidth of the interface eth1 of the router is bounded to 3
Mbps.

Note that you should exit Mininet, clean up the topology of the previous section with the command
sudo mn -c and run the script lab21_network.py with the new bandwidth configuration.

Note: The limit of 3 Mbps is both for the packets that come in and go out of the interface eth1 of
the router.

3.2.1 UDP Test


When the RATE at which the UDP client sends data is greater that 50 kbps, the client sends packets
that contain 1000 bytes of data each.

1. What is the size (in bytes) of Ethernet frames that you expect will be used to send the data of the
UDP client? Verify with Wireshark at the server side.

2. The router is the bottleneck and has a limit of 3 Mbps. What is the maximum theoretical
aggregate application data throughput (i.e., goodput) that can be achieved? Explain.

Start a UDP server on host h3 that listens on port 10000.

3. Start a UDP client on host h1 that sends data at rate 100 kbps. What are the loss probability and
the goodput observed on h3?

4. Repeat the operation with 3 Mbps and 10 Mbps. What are the goodputs and loss probabilities?
What do you observe (explain)? Compare to the theoretical goodput computed above.
3.2.2 TCP Test
Start a TCP server on host h3 that listens on port 10001.

1. Launch a TCP client on host h1 that sends data to this server. What is the goodput of the
connection?

3.3 Competing UDP Flows


We now want to explore what happens when two UDP flows are competing for the same bottleneck.
The router has a capacity of 3 Mbps and is the bottleneck. We consider the following scenarios:

• Host h1 is streaming real-time data at rate 1 Mbps to host h3 using UDP.

• Host h2 is streaming a video to host h3 using UDP. Depending on the quality, h2 sends at rate 1
Mbps,
QoS 2 Mbps or 4.5 Mbps. ESIB S5

Scenario h1 (UDP) h2 (UDP)


A1 1 Mbps 1 Mbps
A2 1 Mbps 2 Mbps
A3 1 Mbps 4.5 Mbps

h1
3
r1
Router h3
UDP

UDP
h2
4

Before doing measurement, we want to predict the amount of data that will be sent and received
in the
Before threemeasurement,
doing scenarios (denoted A1,
we want toA2 and A3).
predict the amount of data that will be sent and received in the
three scenarios (denoted A1, A2 and A3).
9. Based on a theoretical analysis, what should be the goodputs and loss probabilities of
1. Based on ah1theoretical
hosts and h2 inanalysis, what should
the scenarios A1, A2be theA3.
and goodput of your
Explain h1 andbelow
hostsmethod h2 in and
the fill
scenarios
in
A1, A2 and A3.
the table. Explain your method.

We now want to verify our analysis by emulation. As before, the bandwidth of the interface eth1 of the
router is limited toGoodput
3 Mbps. h1
For each
Lossscenario, starth1twoGoodput
probability UDP servers
h2 onLossh3probability h2 ports 10001
that listen on
and 10002. A1 Use the command xterm & at h3’s terminal to open a new terminal for h3. Please, watch
out the arrangement
A2 of the terminals so that you keep track of the host they correspond to, as the new
terminals willA3not obtain a name. Then, run a UDP client on h1 that sends data to h3 at 1 Mbps and a
UDP client on h2 that sends data to h3 at rate 1, 2 or 4.5 Mbps.

2. We
What are the measured goodputs and loss probabilities in scenarios A1, A2 and A3?
now want to verify our analysis by emulation. As before, the bandwidth of the interface
eth1 of the router is limited to 3 Mbps. For each scenario, start two UDP servers on h3 that
3. Do you see a difference between your theoretical analysis and the experiment? If yes, comment on
listen on ports 10001 and 10002. Use the command xterm & at h3’s terminal to open a new
the difference, and try to explain the possible sources.
terminal for h3. Please, watch out the arrangement of the terminals so that you keep track of
the host they correspond to, as the new terminals will not obtain a name. Then, run a UDP
client on h1 that sends data to h3 at 1 Mbps and a UDP client on h2 that sends data to h3 at
rate 1, 2 or 4.5 Mbps.

10. What are the measured goodputs and loss probabilities in scenarios A1, A2 and A3?
QoS ESIB S5

3.43.4
TCP TCP
FlowsFlows
Competing with UDP
Competing withFlows
UDP Flows
We consider a similar scenario as in the previous case. Host h1 streams data at rate 1 Mbps to host h3
h2 consider
and We streams video to h3 atasrate
datascenario
a similar 1 Mbps,
in the previous2 case.
MbpsHost
or 4.5 Mbps. In
h1 streams addition
data at rateto this traffic,
1 Mbps to
h2 ish3also
hosthost using a TCP connection to send a software update to h3.
and h2 streams video data to h3 at rate 1 Mbps, 2 Mbps or 4.5 Mbps. In addition to
this traffic, host h2 is also using a TCP connection to send a software update to h3.

Scenario h1 (UDP) h2 (UDP)


B1 1 Mbps 1 Mbps
B2 1 Mbps 2 Mbps
B3 1 Mbps 4.5 Mbps

h1

r1
Router h3
UDP

UDP
h2
TCP

12. Based on a theoretical analysis, what should be the goodputs of the UDP flow of h1, the
1. BasedTCPon aflow
theoretical analysis, what should be the goodputs of the UDP flow of h1, the TCP
of h2 and the UDP flow h2 in the scenarios B1, B2 and B3 (explain below and
fillh2
flow of in and the UDP flow h2 in the scenarios B1, B2 and B3?
the table)?
We now want to verify our analysis by emulation. As in the previous case, the bandwidth is limited to 3
Mbps and we start two UDPUDP flowonofh3.
servers h1 Start
UDP alsoflow
a TCP server
of h2 TCP h3. of h2
on flow
B1 goodputs of the three flows in scenarios B1, B2 and B3?
2. What are the measured
B2
3. Do you see a difference
B3 between your theoretical analysis and the experiment?

We now want to verify our analysis by emulation. As in the previous case, the bandwidth is
limited to 3 Mbps and we start two UDP servers on h3. Start also a TCP server on h3.

13. What are the measured goodputs of the three flows in scenarios B1, B2 and B3?

UDP flow of h1 UDP flow of h2 TCP flow of h2


B1
B2
B3

14. Do you see a di↵erence between your theoretical analysis and the experiment? If yes,
comment on the di↵erence, and try to explain the possible sources.

You might also like