Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 46

Chapter 3

Exercises
Ion Turcanu: ion.turcanu@uni.lu

Mahdi Fotouhi: mahdi.fotouhi@uni.lu

Note: the slides used in this course are adapted from the original slides
Computer Networking: A
created by Jim Kurose and Keith Rose:
https://gaia.cs.umass.edu/kurose_ross/ppt.htm
Top-Down Approach
7th edition
All material copyright 1996-2020 Jim Kurose, Keith Ross
J.F Kurose and K.W. Ross, All Rights Reserved Pearson/Addison Wesley, 2016
Introduction: 1-1
Exercise 1 – Internet Checksum (1/4)
Compute the Internet checksum value for these two 16-bit words:
10010101 11110111
10111001 01100000

1. What is the sum of these two 16 bit numbers?


The sum of 10010101 11110111 and 10111001 01100000 = 01001111 01011000 m of 11101000 01101010
and 11011011 00100100 = 11000011 10001111

The internet checksum is the one's complement of the sum: 11000011 10001111 = 00111100 01110000

Introduction: 1-2
Exercise 1 – Internet Checksum (2/4)
Compute the Internet checksum value for these two 16-bit words:
10010101 11110111
10111001 01100000

what is the checksum?


The internet checksum is the one's complement of the sum: 01001111 01011000 = 10110000
10100111 The internet checksum is the one's complement of the sum: 11000011 10001111 = 00111100 01110000

Introduction: 1-3
Exercise 1 – Internet Checksum (3/4)
Compute the Internet checksum value for these two 16-bit words:
01110100 01011111
01100101 10001110

1. What is the sum of these two 16 bit numbers?


The sum of 01110100 01011111 and 01100101 10001110 = 11011001 11101101 10001111
The internet checksum is the one's complement of the sum: 11000011 10001111 = 00111100 01110000

Introduction: 1-4
Exercise 1 – Internet Checksum (4/4)
Compute the Internet checksum value for these two 16-bit words:
01110100 01011111
01100101 10001110

2. Using the sum from question 1, what is the checksum?


The internet checksum is the one's complement of the sum: 11011001 11101101
= 00100110 00010010
Introduction: 1-5
Exercise 2 – UDP Mux and Demux (1/4)
In the scenario below, the left and right clients communicate with a server using UDP sockets. The same
socket at the server is used to communicate with both clients. The Python code used to create the sockets
is shown in the figure. Consider the four transport-layer packets – A, B, C and D – shown in the figure
below.

1. What is the source port # for packet D?


The source port for packet D is port 5684.

Introduction: 1-6
Exercise 2 – UDP Mux and Demux (2/4)
In the scenario below, the left and right clients communicate with a server using UDP sockets. The same
socket at the server is used to communicate with both clients. The Python code used to create the sockets
is shown in the figure. Consider the four transport-layer packets – A, B, C and D – shown in the figure
below.

2. What is the destination port # for packet D?


The destination port for packet D is port 6285.

Introduction: 1-7
Exercise 2 – UDP Mux and Demux (3/4)
In the scenario below, the left and right clients communicate with a server using UDP sockets. The same
socket at the server is used to communicate with both clients. The Python code used to create the sockets
is shown in the figure. Consider the four transport-layer packets – A, B, C and D – shown in the figure
below.

3. What is the source port # for packet A?


The source port for packet A is port 6285.

Introduction: 1-8
Exercise 2 – UDP Mux and Demux (4/4)
In the scenario below, the left and right clients communicate with a server using UDP sockets. The same
socket at the server is used to communicate with both clients. The Python code used to create the sockets
is shown in the figure. Consider the four transport-layer packets – A, B, C and D – shown in the figure
below.

4. What is the destination port # for packet A?


The destination port for packet A is port 5684.

Introduction: 1-9
Exercise 3 – TCP Mux and Demux (1/4)
In the scenario on the left, the left and right TCP
clients communicate with a TCP server using TCP
sockets. The Python code used to create a single
welcoming socket in the server is shown in the figure
(the welcoming socket itself is not shown graphically);
code is also shown for the client sockets as well. The
three sockets shown in server were created as a result
of the server accepting connection requests on this
welcoming socket from the two clients (one
connection from the client on the left, and two
connections from the client on the right).

1. What is the source port # for packet C?


The source port for packet C is port 6206.

Introduction: 1-10
Exercise 3 – TCP Mux and Demux (2/4)
In the scenario on the left, the left and right TCP
clients communicate with a TCP server using TCP
sockets. The Python code used to create a single
welcoming socket in the server is shown in the figure
(the welcoming socket itself is not shown graphically);
code is also shown for the client sockets as well. The
three sockets shown in server were created as a result
of the server accepting connection requests on this
welcoming socket from the two clients (one
connection from the client on the left, and two
connections from the client on the right).

2. What is the destination port # for packet C?


The destination port for packet C is port 5559.

Introduction: 1-11
Exercise 3 – TCP Mux and Demux (3/4)
In the scenario on the left, the left and right TCP
clients communicate with a TCP server using TCP
sockets. The Python code used to create a single
welcoming socket in the server is shown in the figure
(the welcoming socket itself is not shown graphically);
code is also shown for the client sockets as well. The
three sockets shown in server were created as a result
of the server accepting connection requests on this
welcoming socket from the two clients (one
connection from the client on the left, and two
connections from the client on the right).

3. What is the source port # for packet B?


The source port for packet B is port 5559.

Introduction: 1-12
Exercise 3 – TCP Mux and Demux (4/4)
In the scenario on the left, the left and right TCP
clients communicate with a TCP server using TCP
sockets. The Python code used to create a single
welcoming socket in the server is shown in the figure
(the welcoming socket itself is not shown graphically);
code is also shown for the client sockets as well. The
three sockets shown in server were created as a result
of the server accepting connection requests on this
welcoming socket from the two clients (one
connection from the client on the left, and two
connections from the client on the right).

4. What is the destination port # for packet B?


The destination port for packet B is port 5396.

Introduction: 1-13
Exercise 4 – Reliable Data Transfer: rdt2.2
(1/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

1. At time t=0, what is the sender state?


Wait for ACK 0

Introduction: 1-14
Exercise 4 – Reliable Data Transfer: rdt2.2
(2/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

2. At time t=0, what is the receiver state?


Wait for 0 from below

Introduction: 1-15
Exercise 4 – Reliable Data Transfer: rdt2.2
(3/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

3. At time t=0, what is the sequence/ack # of the


packet?
At time t=0, the sequence # is: 0
Introduction: 1-16
Exercise 4 – Reliable Data Transfer: rdt2.2
(4/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

4. At time t=1, what is the sender state?


At time t=1, the sender state is: Wait for ACK 0

Introduction: 1-17
Exercise 4 – Reliable Data Transfer: rdt2.2
(5/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

5. At time t=1, what is the receiver state?


At time t=1, the receiver state is: Wait for 1 from below

Introduction: 1-18
Exercise 4 – Reliable Data Transfer: rdt2.2
(6/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

6. At time t=1, what is the sequence/ack # of the


packet?
At time t=1, the ACK # is: 0
Introduction: 1-19
Exercise 4 – Reliable Data Transfer: rdt2.2
(7/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

7. At time t=2, what is the sender state?


At time t=2, the sender state is: Wait for ACK 1

Introduction: 1-20
Exercise 4 – Reliable Data Transfer: rdt2.2
(8/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

8. At time t=2, what is the receiver state?


At time t=2, the receiver state is: Wait for 1 from below

Introduction: 1-21
Exercise 4 – Reliable Data Transfer: rdt2.2
(9/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

9. At time t=2, what is the sequence/ack # of the


packet?
At time t=2, the sequence # is: 1
Introduction: 1-22
Exercise 4 – Reliable Data Transfer: rdt2.2
(10/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

10. At time t=3, what is the sender state?


At time t=3, the sender state is: Wait for ACK 1

Introduction: 1-23
Exercise 4 – Reliable Data Transfer: rdt2.2
(11/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

11. At time t=3, what is the receiver state?


At time t=3, the receiver state is: Wait for 1 from below

Introduction: 1-24
Exercise 4 – Reliable Data Transfer: rdt2.2
(12/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

12. At time t=3, what is the sequence/ack # of the


packet?
At time t=3, the ACK # is: 0
Introduction: 1-25
Exercise 4 – Reliable Data Transfer: rdt2.2
(13/13)
Consider the figures on the right.
Suppose that the channel
connecting the sender and
receiver can corrupt but not lose
or reorder packets.

13. How many times is the payload of the received


packet passed up to the higher layer?
2 packets
Introduction: 1-26
Exercise 5 – Reliable Data Transfer: rdt3.0
Consider the RDT 3.0 protocol, for reliably communicating data from a sender
to receiver over a channel that can lose or corrupt packets in either direction,
and when the maximum delay from sender to receiver and back is not known.
The FSMs for the sender and receiver are shown on the right, with their
transitions labeled as SX and RY, respectively.
Now let’s consider the sequence of sender and receiver transitions that would
happen when one or more of the following complications occur: a packet (data
or ACK) is lost, a timer times out (prematurely or not), or a message is
corrupted. One or more of these events has occurred to produce the sequence
of transitions below. In the sequence below, one transition has been omitted
and replaced with a "*".
Transition Sequence: S0, R0, S1, S2, *, S3, S5, R2, S6, S7, R3, S6, S7, R3, S8

1. What is the missing transition?


The missing transition is: R1

Introduction: 1-27
Exercise 6 – TCP Sequence and ACK Numbers
(1/2)
Consider the figure on the right in which a TCP sender and
receiver communicate over a connection in which the sender-
>receiver segments may be lost. The TCP sender sends an initial
window of 3 segments.
Suppose the initial value of the sender->receiver sequence
number is 191 and the first 3 segments each contain 471 bytes.
The delay between the sender and receiver is 7 time units, and
so the first segment arrives at the receiver at t=8. As shown in
the figure below, 1 of the 3 segment(s) are lost between the
segment and receiver.

1. Give the sequence numbers associated with each of


the 3 segments sent by the sender.
The sender's sequence numbers are: 191,662,1133
Introduction: 1-28
Exercise 6 – TCP Sequence and ACK Numbers
(2/2)
Consider the figure on the right in which a TCP sender and
receiver communicate over a connection in which the sender-
>receiver segments may be lost. The TCP sender sends an initial
window of 3 segments.
Suppose the initial value of the sender->receiver sequence
number is 191 and the first 3 segments each contain 471 bytes.
The delay between the sender and receiver is 7 time units, and
so the first segment arrives at the receiver at t=8. As shown in
the figure below, 1 of the 3 segment(s) are lost between the
segment and receiver.

2. Give the ACK numbers the receiver sends in


response to each of the segments.
The receiver's ACKs are: x,191,191
Introduction: 1-29
Exercise 7 – TCP Sequence and ACK Numbers
(1/2)
Consider the figure below in which a TCP sender and receiver
communicate over a connection in which the sender->receiver
segments may be lost. The TCP sender sends an initial window of
5 segments. Suppose the initial value of the sender->receiver
sequence number is 278 and the first 5 segments each contain
330 bytes. The delay between the sender and receiver is 7 time
units, and so the first segment arrives at the receiver at t=8. As
shown in the figure below, 2 of the 5 segment(s) are lost
between the segment and receiver.

Give the sequence numbers associated with each of the


5 segments sent by the sender.
Seqs: 278,608,938,1268,1598
Introduction: 1-30
Exercise 7 – TCP Sequence and ACK Numbers
(2/2)
Consider the figure below in which a TCP sender and receiver
communicate over a connection in which the sender->receiver
segments may be lost. The TCP sender sends an initial window of
5 segments. Suppose the initial value of the sender->receiver
sequence number is 278 and the first 5 segments each contain
330 bytes. The delay between the sender and receiver is 7 time
units, and so the first segment arrives at the receiver at t=8. As
shown in the figure below, 2 of the 5 segment(s) are lost
between the segment and receiver.

Give the ACK numbers the receiver sends in response to each of


the segments. If a segment never arrives use 'x' to denote it
ACKs are: 608,938,x,x,938

Introduction: 1-31
Exercise 8 – TCP congestion
Consider the figure below, which
plots the evolution of TCP's
congestion window at the beginning
of each time unit (where the unit of
time is equal to the RTT); see Figure
3.53 in the text. In the abstract
model for this problem, TCP sends a
"flight" of packets of size cwnd at
the beginning of each time unit. The
result of sending that flight of
packets is that either (i) all packets
are ACKed at the end of the time
unit, (ii) there is a timeout for the
first packet, or (iii) there is a triple
duplicate ACK for the first packet. In
this problem, you are asked to
reconstruct the sequence of events
(ACKs, losses) that resulted in the
evolution of TCP's cwnd shown
below.

The times where TCP is in slow start are?


1,2,3,8,9,10,13,14,15,36,37,38,39
Introduction: 1-32
Exercise 8 – TCP congestion
Consider the figure below, which
plots the evolution of TCP's
congestion window at the beginning
of each time unit (where the unit of
time is equal to the RTT); see Figure
3.53 in the text. In the abstract
model for this problem, TCP sends a
"flight" of packets of size cwnd at
the beginning of each time unit. The
result of sending that flight of
packets is that either (i) all packets
are ACKed at the end of the time
unit, (ii) there is a timeout for the
first packet, or (iii) there is a triple
duplicate ACK for the first packet. In
this problem, you are asked to
reconstruct the sequence of events
(ACKs, losses) that resulted in the
evolution of TCP's cwnd shown
below.

The times where TCP is in congestion avoidance?


4,5,6,7,11,12,16,17,18,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,40
Introduction: 1-33
Exercise 8 – TCP congestion
Consider the figure below, which
plots the evolution of TCP's
congestion window at the beginning
of each time unit (where the unit of
time is equal to the RTT); see Figure
3.53 in the text. In the abstract
model for this problem, TCP sends a
"flight" of packets of size cwnd at
the beginning of each time unit. The
result of sending that flight of
packets is that either (i) all packets
are ACKed at the end of the time
unit, (ii) there is a timeout for the
first packet, or (iii) there is a triple
duplicate ACK for the first packet. In
this problem, you are asked to
reconstruct the sequence of events
(ACKs, losses) that resulted in the
evolution of TCP's cwnd shown
below.

The times where TCP is in fast recovery?


20
Introduction: 1-34
Exercise 8 – TCP congestion
Consider the figure below, which
plots the evolution of TCP's
congestion window at the beginning
of each time unit (where the unit of
time is equal to the RTT); see Figure
3.53 in the text. In the abstract
model for this problem, TCP sends a
"flight" of packets of size cwnd at
the beginning of each time unit. The
result of sending that flight of
packets is that either (i) all packets
are ACKed at the end of the time
unit, (ii) there is a timeout for the
first packet, or (iii) there is a triple
duplicate ACK for the first packet. In
this problem, you are asked to
reconstruct the sequence of events
(ACKs, losses) that resulted in the
evolution of TCP's cwnd shown
below.

The times where TCP has a loss by timeout ?


7,12,35,38
Introduction: 1-35
Exercise 8 – TCP congestion
Consider the figure below, which
plots the evolution of TCP's
congestion window at the beginning
of each time unit (where the unit of
time is equal to the RTT); see Figure
3.53 in the text. In the abstract
model for this problem, TCP sends a
"flight" of packets of size cwnd at
the beginning of each time unit. The
result of sending that flight of
packets is that either (i) all packets
are ACKed at the end of the time
unit, (ii) there is a timeout for the
first packet, or (iii) there is a triple
duplicate ACK for the first packet. In
this problem, you are asked to
reconstruct the sequence of events
(ACKs, losses) that resulted in the
evolution of TCP's cwnd shown
below.

The times where TCP has a loss by triple duplicate ACK?


19
Introduction: 1-36
Exercise 8 – TCP congestion
Consider the figure below, which
plots the evolution of TCP's
congestion window at the beginning
of each time unit (where the unit of
time is equal to the RTT); see Figure
3.53 in the text. In the abstract
model for this problem, TCP sends a
"flight" of packets of size cwnd at
the beginning of each time unit. The
result of sending that flight of
packets is that either (i) all packets
are ACKed at the end of the time
unit, (ii) there is a timeout for the
first packet, or (iii) there is a triple
duplicate ACK for the first packet. In
this problem, you are asked to
reconstruct the sequence of events
(ACKs, losses) that resulted in the
evolution of TCP's cwnd shown
below.

The times where the ssthresh changes?


8,13,20,36,39
Introduction: 1-37
Exercise 9 – TCP's RTT and timeout

1. The estimatedRTT for RTT1?

estimatedRTT = (1-alpha)*estimatedRTT + alpha*sampleRTT


= (1 - 0.125)*390 + 0.125*270
= 375
Introduction: 1-38
Exercise 9 – TCP's RTT and timeout

2. The DevRTT for RTT1 ?

DevRTT = (1-beta)*DevRTT + beta * |estimatedRTT - sampleRTT|


= (1 - 0.25)*20 + 0.25 * |390 - 270|
= 45
Introduction: 1-39
Exercise 9 – TCP's RTT and timeout

3. The timeout for RTT1 ?

TCP timeout = estimatedRTT + (4*DevRTT)


= 375 + (4*45)
=555
Introduction: 1-40
Exercise 9 – TCP's RTT and timeout

4. The estimatedRTT for RTT2 ?

estimatedRTT = (1-alpha)*estimatedRTT + alpha*sampleRTT


= (1 - 0.125)*375 + 0.125*370
=374.38
Introduction: 1-41
Exercise 9 – TCP's RTT and timeout

5. The DevRTT for RTT2 ?

DevRTT = (1-beta)*DevRTT + beta * |estimatedRTT - sampleRTT|


= (1 - 0.25)*45 + 0.25 * |375 - 370|
=35
Introduction: 1-42
Exercise 9 – TCP's RTT and timeout

6. The timeout for RTT2 ?

TCP timeout = estimatedRTT + (4*DevRTT)


= 374.38 + (4*35)
=514.38
Introduction: 1-43
Exercise 9 – TCP's RTT and timeout

7. The estimatedRTT for RTT3 ?

estimatedRTT = (1-alpha)*estimatedRTT + alpha*sampleRTT


= (1 - 0.125)* 374.38 + 0.125*200
=352.58
Introduction: 1-44
Exercise 9 – TCP's RTT and timeout

8. The DevRTT for RTT3 ?

DevRTT = (1-beta)*DevRTT + beta * |estimatedRTT - sampleRTT|


= (1 - 0.25)*35 + 0.25 * | 374.38 - 200|
=69.84
Introduction: 1-45
Exercise 9 – TCP's RTT and timeout

9. The timeout for RTT3 ?

TCP timeout = estimatedRTT + (4*DevRTT)


= 352.58 + (4* 69.84 )
= 631.95
Introduction: 1-46

You might also like