Computer Networks Lecture 04: Transport Layer PDF

Summary

This document presents lecture notes on the Transport Layer in computer networks for 2024. Topics covered include introduction, multiplexing, connectionless transport (UDP), principles of reliable data transfer (TCP), congestion control, and the evolution of transport-layer functionality. The notes are primarily from Alexandria University.

Full Transcript

Computer Networks Lecture 04: Transport Layer Prof. Dr. Sahar M. Ghanem Associate Professor Computer and Systems Engineering Department Faculty of Engineering, Alexandria University Outline Introduction and Transport-Layer Services Multiplexing and Demu...

Computer Networks Lecture 04: Transport Layer Prof. Dr. Sahar M. Ghanem Associate Professor Computer and Systems Engineering Department Faculty of Engineering, Alexandria University Outline Introduction and Transport-Layer Services Multiplexing and Demultiplexing Connectionless Transport: UDP Principles of Reliable Data Transfer Connection-Oriented Transport: TCP Principles of Congestion Control TCP Congestion Control Evolution of Transport-Layer Functionality Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 2 Introduction Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 3 Transport-Layer Services (1/4) Transport layer services extend the network layer’s delivery service between two end systems to a delivery service between two application-layer processes running on the end systems. Questions How two entities can communicate reliably over a medium that may lose and corrupt data? How to control the transmission rate of transport-layer entities in order to avoid, or recover from, congestion within the network? Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 4 Transport-Layer Services (2/4) Two transport-layer protocols are available to applications: TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). On the sending side, the transport layer converts the application- layer messages into transport-layer packets (segments) breaking the messages into smaller chunks adding a transport-layer header to each chunk to create the segment passes the segment to the network layer the segment is encapsulated within a network-layer packet (datagram) sent to the destination Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 5 Transport-Layer Services (3/4) On the receiving side the network layer extracts the transport-layer segment from the datagram passes the segment up to the transport layer the transport layer processes the segment, making the data available to the receiving application A transport protocol doesn’t have any say about how the messages are moved within the network core. Routers neither act on, nor recognize, any information that the transport layer may have added to the application messages. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 6 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 7 Transport-Layer Services (4/4) If the network-layer protocol cannot provide delay or bandwidth guarantees for transport layer segments sent between hosts, then the transport-layer protocol can NOT provide delay or bandwidth guarantees for application messages sent between processes. A transport protocol can offer reliable data transfer service to an application even when the underlying network protocol is unreliable. A transport protocol can use encryption even when the network layer cannot guarantee the confidentiality of transport-layer segments. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 8 Extending the Network Layer (1/2) The Internet’s network-layer protocol is IP (Internet Protocol). every host has at least one IP address The IP service model is a best-effort delivery service. it does not guarantee segment delivery, it does not guarantee orderly delivery of segments, and it does not guarantee the integrity of the data in the segments Extending host-to-host delivery to process-to-process delivery is called transport-layer multiplexing and demultiplexing. UDP and TCP provide integrity checking by including error detection fields in their headers. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 9 Extending the Network Layer (2/2) UDP provides the two minimal transport-layer services—process-to- process data delivery and error checking. TCP ensures that data is delivered correctly and in order. TCP provides reliable data transfer using flow control, sequence numbers, acknowledgments, and timers TCP also provides congestion control (a service for the general good of Internet as a whole) regulating the rate at which the sending sides of TCP connections can send traffic into the network Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 10 Multiplexing and Demultiplexing Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 11 Multiplexing and Demultiplexing When the transport layer in a computer receives data from the network layer below, it needs to direct the received data to one of the many running processes. a process (as part of a network application) can have one or more sockets the transport layer deliver data to a socket delivering the data in a transport-layer segment to the correct socket is called demultiplexing gathering data chunks at the source host from different sockets and passing the segments to the network layer is called multiplexing Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 12 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 13 Port Numbers (1/2) Each segment have the source port number field and the destination port number field fields that indicate the socket to which the segment is to be delivered Each port number is a 16-bit number, ranging from 0 to 65535. The port numbers ranging from 0 to 1023 are called well-known port numbers. (http://www.iana.org) Typically, a client side of the application lets the transport layer automatically (and transparently) assign the port number, whereas the server side of the application assigns a specific port number. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 14 Port Numbers (2/2) A TCP socket is identified by a four-tuple (source IP address, source port number, destination IP address, destination port number). In contrast with UDP, two arriving TCP segments with different source IP addresses or source port numbers will be directed to two different sockets. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 15 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 16 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 17 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 18 Connectionless Transport: UDP Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 19 UDP, RFC 768 (1/2) Add to IP multiplexing/demultiplexing function and some light error checking. Connectionless (no handshaking). Some applications are better suited for UDP for Finer application-level control over what data is sent, and when. No connection establishment. No connection state. Small packet header overhead. DNS is an example of an application-layer protocol that uses UDP. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 20 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 21 UDP, RFC 768 (2/2) It is possible for an application to have reliable data transfer when using UDP by having reliability is built into the application itself. The UDP header has only four fields, each consisting of two bytes: the port numbers the length field (including the header, in bytes) the checksum The checksum is calculated over a few of the fields in the IP header in addition to the UDP segment. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 22 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 23 UDP Checksum UDP at the sender side performs the 1s complement of the sum of all the 16-bit words in the segment, with any overflow encountered during the sum being wrapped around. At the receiver, all four 16-bit words are added, including the checksum. If no errors are introduced into the packet, then clearly the sum at the receiver will be 1111111111111111. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 24 Principles of Reliable Data Transfer Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 25 Outline Building a Stop-and-Wait Reliable Data Transfer Protocol Perfectly Reliable Channel Channel with Bit Errors Lossy Channel with Bit Errors Pipelined Reliable Data Transfer Protocols Pipelined with Go-Back-N (GBN) Pipelined with Selective Repeat (SR) Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 26 Principles of Reliable Data Transfer The theory applies to computer networks in general and not just to the Internet transport layer. Occurs not only at the transport layer, but also at the link layer and the application layer as well A reliable data transfer protocol provides to the upper-layer entities a reliable channel through which data can be transferred. With a reliable channel, no transferred data bits are corrupted or lost, and all are delivered in the order in which they were sent. The lower layer is an unreliable point-to-point channel. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 27 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 28 Incremental Protocols Considerations unidirectional data transfer (not bidirectional/full-duplex) underlying channel can corrupt bits or lose entire packets packets will be delivered in the order in which they were sent the sending and receiving sides also need to exchange control packets rdt1.0: Reliable Data Transfer over a Perfectly Reliable Channel rdt2.0: Reliable Data Transfer over a Channel with Bit Errors rdt3.0: Reliable Data Transfer over a Lossy Channel with Bit Errors Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 29 Finite State Machine (FSM) The arrows indicate the transition of the protocol from one state to another. The event causing the transition is shown above the horizontal line labeling the transition. The actions taken when the event occurs are shown below the horizontal line. 𝚲 denote the lack of an action or event. The initial state of the FSM is indicated by the dashed arrow. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 30 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 31 rdt2.0: Channel with Bit Errors A message-dictation protocol uses both positive acknowledgments (ACK) (“OK”) and negative acknowledgments (NAK) (“Please repeat that”) Reliable data transfer protocols based on such retransmission are known as ARQ (Automatic Repeat reQuest) protocols. Additional protocol capabilities are needed: error detection at the receiver receiver feedback (ACK and NAK) (one bit long message) Retransmission by the sender rdt2.0 is stop-and-wait: the sender will not send a new piece of data until it is sure that the receiver has correctly received the current packet. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 32 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 33 rdt2.1: 1-bit sequence number What if ACK/NAK packets are corrupted? Three possible solutions: 1. Introducing a new type of sender-to-receiver packet: “What did you say?”! 2. Add enough checksum bits to allow the sender not only to detect, but also to recover from, bit errors! 3. The sender resends the current data packet when it receives a garbled ACK or NAK packet. This solution results in duplicate packets. Duplicate packets can be resolved using a 1-bit sequence number to identify whether an arriving packet contains new data or is a retransmission. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 34 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 35 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 36 rdt2.2: NAK-free Instead of sending a NAK, we send an ACK for the last correctly received packet. If duplicate ACKs are received, the sender knows that the receiver did not correctly receive the packet following the packet that is being ACKed twice. The receiver must now include the sequence number of the packet being acknowledged by an ACK message. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 37 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 38 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 39 Rdt3.0: Lossy Channel with Bit Errors How to detect packet loss and what to do when packet loss occurs? The burden of detecting and recovering from lost packets on the sender. Solution: Wait long enough so that it is certain that a packet has been lost and simply retransmit it. The sender to judiciously choose a time value! The sender may retransmit the packet even though neither the data packet nor its ACK have been lost. Sequence numbers can handle the case of duplicate data packets. Requires a countdown timer that can interrupt the sender after a given amount of time has expired. the sender need to: start the timer; respond to a timer interrupt; stop the timer Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 40 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 41 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 42 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 43 Pipelined Reliable Data Transfer Protocols rdt3.0’s performance problem is the fact that it is a stop-and-wait protocol. e.g. The speed-of-light round-trip propagation delay between two end systems, 𝑹𝑻𝑻, is approximately 𝟑𝟎 𝐦𝐢𝐥𝐥𝐢𝐬𝐞𝐜𝐨𝐧𝐝𝐬. A channel transmission rate, 𝑹, of 𝟏 𝑮𝒃𝒑𝒔 (109 bits per second). A packet size, 𝑳, of 𝟏, 𝟎𝟎𝟎 𝒃𝒚𝒕𝒆𝒔 (𝟖, 𝟎𝟎𝟎 𝒃𝒊𝒕𝒔 per packet). 𝑑𝑡𝑟𝑎𝑛𝑠 = 𝐿/𝑅 = 8000/109 = 8 𝑚𝑖𝑐𝑟𝑜𝑠𝑒𝑐𝑜𝑛𝑑𝑠 𝐿 𝐿 Sender Utilization: 𝑈𝑠𝑒𝑛𝑑𝑒𝑟 = ( )/(𝑅𝑇𝑇 + ) = 0.008 / 30.008 = 0.00027 𝑅 𝑅 𝑒𝑓𝑓𝑒𝑐𝑡𝑖𝑣𝑒 𝑡ℎ𝑟𝑜𝑢𝑔ℎ𝑝𝑢𝑡 𝑖𝑠 𝑜𝑛𝑙𝑦 𝟐𝟔𝟕 𝒌𝒃𝒑𝒔 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 44 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 45 Pipelining Pipelining protocol: rather than operate in a stop-and-wait manner, the sender is allowed to send multiple packets without waiting for acknowledgments. Consequences: the range of sequence numbers must be increased the sender and the receiver have to buffer more than one packet pipelined error recovery can be solved using Go-Back-N or selective repeat Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 46 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 47 Pipelining with Go-Back-N (GBN) (1/3) The sender is allowed to transmit multiple packets without waiting for an acknowledgment. GBN is also called sliding window protocol. N (Window Size) is the maximum allowable number of unacknowledged packets. base is the sequence number of the oldest unacknowledged packet. nextseqnum is the smallest unused sequence number. A packet’s sequence number is carried in a fixed-length field in the packet header (k bits). Range of sequence numbers is [0, 2^k - 1]. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 48 Pipelining with Go-Back-N (GBN) (2/3) The interval [0, base-1] is for packets that have already been transmitted and acknowledged. The interval [base, nextseqnum-1] is for packets that have been sent but not yet acknowledged. The interval [nextseqnum, base+N-1] is for packets that can be sent immediately. The interval >= base + N cannot be used until an unacknowledged packet currently in the pipeline (base) has been acknowledged. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 49 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 50 Pipelining with Go-Back-N (GBN) (3/3) A GBN sender responds to three types of events Invocation from above: rdt_send() Receipt of an ACK: cumulative acknowledgment with sequence number n A timeout event: the sender resends all packets that have been previously sent but that have not yet been acknowledged The receiver discards out-of-order packets. The advantage of this approach is the simplicity of receiver buffering The only piece of information the receiver need to maintain is the sequence number of the next in-order packet (expectedseqnum). The disadvantage is throwing away a correctly received packet. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 51 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 52 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 53 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 54 Pipelining with Selective Repeat (SR) In GBN, a single packet error can cause GBN to retransmit a large number of packets, many unnecessarily. Selective-repeat protocols avoid unnecessary retransmissions by having the sender retransmit only those packets that it suspects were received in error at the receiver. Unlike GBN, the sender will have already received ACKs for some of the packets in the window. The sender and receiver windows will not always coincide. The window size must be less than or equal to half the size of the sequence number space for SR protocols. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 55 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 56 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 57 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 58 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 59 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 60 Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 61 Reordering Assumed that packets cannot be reordered. Old copies of a packet with a sequence or acknowledgment number of x can appear, even though neither the sender’s nor the receiver’s window contains x. The approach taken in practice is to ensure that a sequence number is not reused until the sender is “sure” that any previously sent packets with sequence number x are no longer in the network. A maximum packet lifetime of approximately three minutes is assumed in the TCP. Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 62 Summary Introduction and Transport-Layer Services Multiplexing and Demultiplexing Connectionless Transport: UDP Principles of Reliable Data Transfer Connection-Oriented Transport: TCP Principles of Congestion Control TCP Congestion Control Evolution of Transport-Layer Functionality Computer Networks, 2024 (c) Dr. Sahar M. Ghanem 63

Use Quizgecko on...
Browser
Browser