1 Distributed Systems 11. Transport LayerSimon Razniewski Faculty of Computer Science Free University of Bozen-Bolzano A.Y. 2016/2017
2 Notes Youtube Pakete? UDP, RTPhttps://ask.wireshark.org/questions/5597/how-to- capture-traffic-from-youtube
3 Transport Layer Transport Service Elements of Transport ProtocolsInternet Protocols – UDP Internet Protocols – TCP
4 The Transport Layer Responsible for delivering data between applications across networks with the desired reliability or quality 2 differences to network layer? Physical Link Network Transport Application
5 Services Provided to the Upper Layers (1)Transport layer adds reliability to the network layer Offers connectionless (e.g., UDP) and connection- oriented (e.g, TCP) service to applications Adds multiplexing via ports Congestion-handling Flow-control
6 Elements of Transport ProtocolsTransport Service Elements of Transport Protocols Adressing Connection handling Flow control Congestion control Internet Protocols – UDP Internet Protocols – TCP
7 Addressing Transport layer adds portsMultiple clients and servers can run on a host with a single network (IP) address Analogy: Office numbers Connections are differentiated by quadruple of source and destination IPs and ports)
8 Network address translation (NAT)NAT (Network Address Translation) box maps one external IP address to many internal IP addresses Uses TCP/UDP port to tell connections apart How can two machines connect to the same webserver? How can we set up our own web/game server?
9 Connection Establishment (1)Key problem is to ensure reliability even though packets may be lost, corrupted and duplicated Don’t treat an old or duplicate packet as new (Use ACKs and checksums for loss/corruption) Approach: Don’t reuse sequence numbers within 2 minutes Three-way handshake for establishing connection
10 Connection Establishment (2)Three-way handshake used for initial packet Since no state from previous connection Both hosts contribute fresh seq. numbers CR = Connect Request
11 What if we used a simpler connection setup?Three-way handshake protects against odd cases: Duplicate CR. Spurious ACK does not connect Duplicate CR and DATA. Same plus DATA will be rejected (wrong ACK). a) X b) X X
12 Flow vs. congestion controlSender may need to slow down for different reasons: Flow control, when the receiver is not fast enough Congestion control, when the network is not fast enough
13 Flow Control (1) Foundation for flow control is a sliding window with checksums and retransmissions Flow control manages buffering at sender/receiver Issue is that data goes to/from the network and applications at different times Window tells sender available buffering at receiver Makes a variable-size sliding window
14 Flow Control (2) Flow control example: A’s data is limited by B’s buffer 1 2 3 4 5 6 7 8 9 10 B’s Buffer
15 Congestion Control Two layers are responsible for congestion control:Transport layer, controls the offered load [here] Network layer, experiences congestion [previous lecture]
16 Desirable Bandwidth AllocationEfficient use of bandwidth gives high goodput, low delay Goodput rises more slowly than load when congestion sets in Delay begins to rise sharply when congestion sets in
17 Regulating the Sending RateDifferent congestion signals the network may use to tell the transport endpoint to slow down (or speed up)
18 Regulating the Sending Rate (3)If two flows increase/decrease their bandwidth in the same way when the network signals free/busy they will not converge to a fair allocation + /– constant +/– percentage
19 Magic solution: Additive increase, multiplicative decreaseIncrease: +10 Decrease: -20% Let’s try it. Suppose A, B and C share a link. Sender A starts with 70% link utilization, Sender B with 20%, Sender C with 0%. All would like to use as much as possible bandwidth.
20 Regulating the Sending Rate (4)The AIMD (Additive Increase Multiplicative Decrease) control law does converge to a fair and efficient point! TCP uses AIMD for this reason User 1’s bandwidth User 2’s bandwidth
21 In Java
22 MIAD Does it work?
23 Wireshark and packet sniffing…
24 Internet Protocols – UDPTransport Service Elements of Transport Protocols Internet Protocols – UDP Internet Protocols – TCP
25 Introduction to UDP (1) UDP (User Datagram Protocol) is a minimal extension on top of IP Header has ports (TSAPs), length and checksum.
26 Wireshark…
27 Real-Time Transport (1)RTP (Real-time Transport Protocol) provides support for sending real-time media over UDP Often implemented as part of the application Application also takes care of buffering (jitter)
28 Real-Time Transport (2)RTP header contains fields to describe the type of media and synchronize it across multiple streams
29 Internet Protocols – TCPTransport Service Elements of Transport Protocols Internet Protocols – UDP Internet Protocols – TCP
30 The TCP Service Model (1)TCP provides applications with a reliable byte stream between processes; it is the workhorse of the Internet Popular servers run on well-known ports
31 The TCP Service Model (2)Applications using TCP see only the byte stream [right] and not the segments [left] sent as separate IP packets Four segments, each with 512 bytes of data and carried in an IP packet 2048 bytes of data delivered to application in a single READ call
32 Wireshark…
33 The TCP Segment Header TCP header includes addressing (ports), sliding window (seq. / ack. number), flow control (window), error control (checksum) and more.
34 TCP Connection EstablishmentTCP sets up connections with the three-way handshake Release is symmetric
35 TCP Sliding Window TCP adds flow control to the sliding window as before WIN is window size
36 TCP Timer Management TCP estimates retransmit timer from segment RTTsTracks both average and variance Timeout is set to average plus 4 x variance LAN case – small, regular RTT Internet case – large, varied RTT
37 TCP Congestion Control (1)TCP uses AIMD with loss signal to control congestion Implemented as a congestion window (cwnd) for the number of segments that may be in the network Congestion window controls the sending rate Rate is cwnd / RTT; window can stop sender quickly Cwnd typically much smaller than flow control window (WIN)
38 TCP Congestion Control (2)Slow start grows congestion window exponentially by sending increasing cwnd with every ACK Increment cwnd for each new ACK
39 TCP Congestion Control (3)Additive increase grows cwnd slowly Adds 1 every RTT ACK
40 TCP Congestion Control (4)Slow start followed by additive increase (TCP Tahoe) Threshold is half of previous loss cwnd Loss causes timeout; so slow-start again Is this AIMD?
41 TCP Congestion Control (7)SACK (Selective ACKs) extend ACKs with a vector to describe received segments and hence losses Allows for more accurate retransmissions / recovery No way for us to know that 2 and 5 were lost with only ACKs Negotiated at connection setup, whether both hosts support it
42 Learned today Adressing with ports TCP versus UDP TCP:3-way-handshake and why Sliding window for flow control Congestion control using AIMD I'd tell you a UDP joke, but you might not get it.