Tutorial 2 - IPv6 & TCP
Submission process:
- Submission deadline is November 18, 16:00 CET (before the lecture) .
- Commit and push your solution as separate notebook files per subtask via git as ./tutorial/tutorial2/tutorial2_2.ipynb. Please take care of the correct subfolder/filename since submission is denied otherwise.
- During the first lecture after the deadline we will discuss a sample solution in class.
- Afterwards, you have time until November 22, 23:59 CET to submit a corrected version of your submission:
- Rework your solution according to our discussion in class.
- Commit and push the corrected version as a separate file per subtask via git as ./tutorial/tutorial2/tutorial2_2.ipynb. Please take care of the correct filename since submission is denied otherwise.
Remarks:
- Grading is done based on both versions of your submission.
- If the first submission is missing your submission will not be graded.
- If the second submission contains major flaws after revision not more than half of the credits for this tutorial can be achieved.
- A sample solution is provided after November 22, 23:59 CET eventually.
- Do NOT duplicate cells or change the type of cells, otherwise you might receive zero points for your submission
- Please use acn@net.in.tum.de for questions regarding lecture, tutorial, and project of ACN.
Problem 2 TCP Round-trip-time Estimation (3 credits)
This problem is focused on the TCP Timestamps Option.
a) [1 credits] TCP can use the Timestamps Option to estimate the RTT of a connection. Have a look at RFC 7323 to understand how the TCP Timestamps Option work. The options contains two fields:
- TS Value (TSval)
- TS Echo Reply (TSecr).
Briefly explain (in your own words) how these values are used to estimate the RTT.
- TSval is set to the current (pseudo-) timstamp of the sender and sent to the communcation partner.
- TSecr is set to the most recent received TSval value and sent back whenever the ACK flag is set.
- On receiving a TSecr, one can compute the RTT by subtracting the echoed TSecr from the current time.
In the following you will write code which computes RTT estimations from the TCP Timestamps Option. Keep in mind that this time we are a passive observer of the connection and do not have any information about the internal TCP state of any of the endpoints. This means we cannot rely on the pseudo-timestamp values contained in the options.
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
# Download RTT CSV from ACN website
!wget -N https://acn.net.in.tum.de/exercise/tcp_timestamp.npz
# Load file into Python
data = np.load('tcp_timestamp.npz')
flow1_tsval, flow1_tsecr = data['flow1_tsval'], data['flow1_tsecr']
flow2_tsval, flow2_tsecr = data['flow2_tsval'], data['flow2_tsecr']
flow3_tsval, flow3_tsecr = data['flow3_tsval'], data['flow3_tsecr']
flow4_tsval, flow4_tsecr = data['flow4_tsval'], data['flow4_tsecr']
7[Files: 0 Bytes: 0 [0 B/s] Re]8
7[https://acn.net.in.tum.de/exer]87tcp_timestamp.npz 0% [<=> ] 0 B/s87HTTP response 304 [https://acn.net.in.tum.de/exercise/tcp_timestamp.npz] 87tcp_timestamp.npz 0% [ <=> ] 0 B/s87[Files: 0 Bytes: 0 [0 B/s] Re]8
# Helper function to plot data
def plot(*data, x_label=None, y_label=None, legends=[], y_min=None, y_max=None):
plt.figure(figsize=(18, 6))
plt.xlabel(x_label)
plt.ylabel(y_label)
for xs, ys in data:
plt.plot(xs, ys)
plt.legend(legends)
plt.gca().set_ylim(bottom=y_min, top=y_max)
b) [1 credits] Write a function compute_rtt() which receives as input two lists:
- tsval: contains tuples with (timestamp, tsval) which contains all tsval sent and the according timestamp.
- tsecr: contains tuples with (timestamp, tsecr) which contains all tsecr received and the according timestamp.
The function should return a list of tuples containing (timestamp, rtt).
def compute_rtt(ts_val, ts_ecr):
# begin insert code
out = []
# iterate over all received echo replies
for ts, ecr in ts_ecr:
# get index and timestamp of according ts_val
i, val = next(((i, x[0]) for i, x in enumerate(ts_val) if x[1] == ecr), None)
if val is not None:
out.append((ts, ts - val))
ts_val = ts_val[i:] # Remove past values to avoid O(n^2)
return out
# end insert code
return [(0, 0)]
plot(zip(*compute_rtt(flow1_tsval, flow1_tsecr)), x_label='Time in s', y_label='RTT in s', legends=['Flow1'], y_min=0)
c) [1 credits] The dataset contains four TCP flows using different congestion control algorithms. For each flow, try to find out which algorithm was used and explain your reasoning. You do not get any credits without an explanation.
plot(zip(*compute_rtt(flow1_tsval, flow1_tsecr)),
zip(*compute_rtt(flow2_tsval, flow2_tsecr)),
zip(*compute_rtt(flow3_tsval, flow3_tsecr)),
zip(*compute_rtt(flow4_tsval, flow4_tsecr)),
x_label='Time in s', y_label='RTT in s',
legends=['Flow1', 'Flow2', 'Flow3', 'Flow4'], y_min=0)
- Flow 1: CUBIC -> cubic curve, decrease by 70% on packet loss
- Flow 2: Vegas -> constant low delay, no probing for more bandwidth
- Flow 3: Reno -> AIMD (sawtooth pattern), decrease by 50% on packet loss
- Flow 4: BBR -> overall low delay, periodically spikes during probe bandwidth phase
Advanced Computer Networking by Prof. Dr.-Ing. Georg Carle
Teaching assistants: Christian Dietze, Sebastian Gallenmüller, Marcel Kempf, Lorenz Lehle, Nikolas Gauder, Patrick Dirks