---
# System prepended metadata

title: KN II Bonus Exercise 1
tags: [KN II Bonus Exercise 1]

---

###### tags: `KN II Bonus Exercise 1`
# KN II Bonus Exercise 1

## Group: AC 


* Laura Imler - 2568540 - iy81enah 
* Sebastian Düringer - 2051730 - bk80jiwe

# Problem 1

**Name one of the main advantages of UDP and TCP each.**

* TCP: 
    * Transmission of the correct data is ensured
    * Sequence is ensured

* UDP:
    * Less overhead -> more bandwidth for data
    * Easier to implement
    
# Problem 2

**Assume you want to determine the maximal available bandwidth of your mobile connection. Which of TCP and UDP is suitable for this use case. Explain why?**

UDP is more suitable, because there is less overhead like doing a handshake first, ACK every packet etc. Therefore more user data can be transmitted, which allows a better estimation of the real maximum bandwidth.

# Problem 3

**How does a TCP sender limit the rate at which it sends traffic into its connection? Describe your answer.**

TCP uses congestion control. The sender has an additional variable called the congestion window. The initial size is equal to the MSS. The congestion window regulates the times at which the segments are sent to the network layer. If a packet is acknowledged before it times out, the congestion window size is increased by one for every ack'ed packet. This leads to an exponential growth. To limit this, there is also a threshold. If the congestion window exceeds this threshold, the growth will be linear. Either way, the growth will be stopped, when there are timed out packets.

# Problem 4

**What is the average throughput of a TCP connection in steady state? (Assume no slow start is happening and the path capacity is constant. Hint: the send rate depends on the roundtrip time RTT and the congestion window size w**


average throughput = cwnd/RTT

# Problem 5

**In slow start phase, what is the initial value of the congestion window? What is the increment rate for this window and when is it updated?**

Initial value of the congestion window in slow start phase: cwnd = 1 MSS (= maximum segment size).

Each time a segment is acknowledged the value of the congestion window is increased by 1. 

# Problem 6

**In slow start phase, when should the exponential growth of cwnd end?**

1. When cwnd >= ss_thresh (slow start threshold)
2. Packet loss

# Problem 7
**In congestion avoidance phase, when should the congestion avoidance’s linear increase (of 1 MSS per RTT) end?**

If congestion is detected the congestion avoidance’s linear increase should end (timeout = congestion).


# Problem 8

**What are the three states of TCP congestion control and which transitions between those states exist? Plot the finite state machine with a computer !! NO hand drawings !!.**

![](https://i.imgur.com/GXemCtI.png)


# Problem 9

**Host A is transferring an image with a size of 15MByte to Host B using a TCP connection. The roundtrip time RTT = 25ms and the link speed is LS = 1Gbit/s. The maximum segment size is equal to 2000 bytes, ss th = ∞. The senders cwnd has a size of cwnd = ∞. How long does the transmission of the image take?**

* 25ms + 120Mbit/1000Mbit/s = 25ms + 120ms = **145ms**

# Problem 10

**Host A is transferring an image with a size of 15MByte to Host B using a TCP connection. The roundtrip time RTT = 100ms and the link speed is LS = 2Gbit/s. The maximum segment size is equal to 500 bytes and ss_th = ∞. The senders cwnd has a size of 1MSS. How long takes the transmission of the image?**

* Number of segments (s): 15MByte/500byte = **30000**
* Number of rounds (n): log2(30000+1) = **14.8**
  So we will need 15 rounds
  
  => 15 * 100ms + 120Mbit/2000Mbit/s = 1500ms + 60ms = **1560ms**
# Problem 11

**In the last two tasks, you calculated the ideal transmission time as well as real transmission time for two different scenarios. Compare and interpret the results for both ideal and real transmission time using the parameters of Problem 10. Which conclusion would you draw for when designing applications? (Hint: Think of the transmission time, the performance, and the throughput)**

* RTT should be minimized
* TCP congestion control is too slow for high bandwidth networks

# Problem 12

* **a) Open a new capture session and record the whole traffic of your machine. Name five protocols you’ll find in the trace and describe their purpose.** 
    * 1. **Wireguard:** VPN Protocol 
    ![](https://i.imgur.com/r8RoS51.png)
    
    * 2. **ARP:** Address Resolution Protocol, used for discovering the link layer address
    ![](https://i.imgur.com/9dLAe4F.png)
    
    * 3. **MDNS:** Multicast DNS, resolve hostname to IP addresses
    ![](https://i.imgur.com/XRWGltk.png)
    
    * 4. **DNS:** Domain Name System, resolve hostname to IP address
    ![](https://i.imgur.com/OmRgUt5.png)
    
    * 5. **TLS:** Cryptographic protocol to provide secure communication
    ![](https://i.imgur.com/nK7G0hy.png)



* **b) Which values have the connection parameters: Source Port, Destination Port, Source IP, Destination IP, Initial Window Size, Initial Sequence Number, Maximum Segment Size?** 

    * **Source Port:** 51538
    * **Destination Port:** 443
    * **Source IP:** 10.0.0.3
    * **Destination IP:** 130.83.198.178
    * **Initial Window Size:** 64860
    * **Initial Sequence Number:** 1254023289
    * **Maximum Segment Size:** 1380
    
    ![](https://i.imgur.com/XbH8BhP.png)

* **c) Which RTT could you observe? Compare the RTT over two network links. (E.g. Ethernet vs WiFi, LTE vs WiFi)**

* Ethernet: 2ms
    ![](https://i.imgur.com/DgCfxs0.png)


* Wireless: 2ms
  ![](https://i.imgur.com/54EaalM.png)


* **d) Plot the bandwidth of the file download over time. Select an adequate time resolution. What is the maximum achieved bandwidth and how much time did it take to download the file?**

![](https://i.imgur.com/OS3U3on.png)

Max bandwidth: 66 packets/s