Summary

This document explains the functions of the transport layer in computer networks, including logical communication, and the roles of both TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).

Full Transcript

Role of the Transport Layer Logical Communication: Facilitates communication between applications on di3erent hosts. Interface: Acts as the intermediary between the application layer and the lower layers that handle network transmission. Transport Layer Responsibilities Tracking Conv...

Role of the Transport Layer Logical Communication: Facilitates communication between applications on di3erent hosts. Interface: Acts as the intermediary between the application layer and the lower layers that handle network transmission. Transport Layer Responsibilities Tracking Conversations: Monitors and manages individual communication sessions. Segmenting and Reassembling: Divides data into segments for transmission and reassembles them at the destination. Header Information: Adds headers with control information to segments. Conversation Management: Identifies, separates, and manages multiple concurrent conversations. Segmentation and Multiplexing: Enables multiple communication streams to interleave over the same network connection. Transport Layer Protocols IP Limitation: IP handles packet delivery but does not detail how packets are transported or managed. Transport Layer Role: Specifies methods for transferring messages between hosts and managing reliability. Key Protocols: TCP (Transmission Control Protocol): Ensures reliable, ordered, and error-checked delivery of data. UDP (User Datagram Protocol): Provides a connectionless, faster alternative with no guarantee of reliability or order. Transmission Control Protocol (TCP)* TCP ensures reliable and e3icient data transmission with the following basic operations: Number and Track Segments: Identifies and monitors data segments sent from an application to a host. Acknowledge Receipt: Confirms the receipt of data segments. Retransmit Data: Resends any data segments that are not acknowledged within a specified timeframe. Sequence Data: Orders data segments that may arrive out of sequence. Flow Control: Adjusts the data transmission rate to match the receiver's capacity. User Datagram Protocol (UDP) UDP facilitates data delivery between applications with minimal overhead and checking: Connectionless Protocol: UDP does not establish or maintain a connection before sending data. Best-ENort Delivery: There is no acknowledgment of data receipt, meaning UDP does not guarantee delivery or order of packets. Choosing the Right Transport Layer Protocol UDP: Ideal for applications with minimal data where speed and low overhead are crucial. Useful in request-and-reply scenarios where quick retransmissions are possible and data loss is acceptable. TCP: Best for applications requiring reliable, ordered delivery of data. Ensures that all data arrives intact and in the correct sequence, making it suitable for applications where data integrity is critical. TCP Features Establishes a Session: TCP is a connection-oriented protocol that establishes a reliable connection between source and destination devices before any data is transmitted. Ensures Reliable Delivery: TCP guarantees that all data segments reach their destination, even if segments are lost or corrupted during transmission. Provides Same-Order Delivery: TCP ensures that data arrives in the correct order, despite multiple routes or varying transmission rates. Supports Flow Control: TCP manages the rate of data transmission to prevent overloading the receiving device's resources. TCP Header Stateful Protocol: TCP keeps track of the state of the communication session between source and destination. Session Tracking: TCP maintains records of sent and acknowledged data, ensuring accurate and reliable data transmission. TCP Header Fields Source Port: 16-bit field identifying the source application's port number. Destination Port: 16-bit field identifying the destination application's port number. Sequence Number: 32-bit field for tracking data segments and reassembling data. Acknowledgment Number: 32-bit field indicating the next expected byte from the source, confirming receipt of data. Header Length: 4-bit field, also known as "data o3set," specifying the length of the TCP header. Reserved: 6-bit field reserved for future use. Control Bits: 6-bit field containing flags indicating the segment's purpose and function. Window Size: 16-bit field specifying the number of bytes that can be accepted at once. Checksum: 16-bit field used for error-checking the segment header and data. Urgent Pointer: 16-bit field indicating if the data is urgent and should be prioritized. Applications that use TCP TCP is commonly used for applications where reliable data transmission is crucial, including: Web Browsing: HTTP/HTTPS for loading web pages. Email: SMTP, POP3, and IMAP for sending and receiving emails. File Transfer: FTP for transferring files between systems. Remote Access: SSH and Telnet for secure and remote access to devices. Streaming Services: Protocols like RTSP and some streaming applications use TCP for reliable data delivery. UDP Features No Guaranteed Order: Data may arrive out of order and is reconstructed in the order it is received. No Retransmission: Lost segments are not resent; UDP does not provide retransmission of lost data. Connectionless: No session establishment is required; each datagram is sent independently. No Feedback on Resource Availability: The sender does not receive information about the receiver's resource availability or congestion. UDP Header The UDP header is simpler than the TCP header and consists of four fields, requiring a total of 8 bytes (64 bits): 1. Source Port (16 bits): Identifies the source application by port number. 2. Destination Port (16 bits): Identifies the destination application by port number. 3. Length (16 bits): Specifies the length of the UDP header and data. 4. Checksum (16 bits): Used for error-checking of the header and data. UDP Header Fields Field Description A 16-bit field used to identify the source application Source Port by port number. Destination A 16-bit field used to identify the destination Port application by port number. A 16-bit field that indicates the total length of the UDP Length datagram (header + data). A 16-bit field used for error-checking of the UDP Checksum header and data. Applications that Use UDP Live Video and Multimedia Applications Require low latency and can tolerate some data loss. Examples: VoIP, live streaming video. Simple Request and Reply Applications Handle simple transactions with minimal overhead. Examples: DNS, DHCP. Applications Handling Reliability Themselves Unidirectional communication where reliability features are managed by the application. Examples: SNMP, TFTP. Port Numbers and Socket Pairs Socket The combination of an IP address and a port number, used to identify a specific process or service on a networked device. Source and Destination Ports Included in the segment to help route and manage data between applications. These ports, along with the IP addresses, form the socket pairs. Encapsulation Segments containing port numbers are encapsulated within IP packets for transmission across the network. Purpose of Sockets Allow multiple processes on a client to distinguish themselves and multiple connections to a server to be di3erentiated. Port Number Groups Well-known Ports (0 to 1,023) Reserved for common services and applications (e.g., HTTP, FTP, SMTP). Allow clients to easily identify and connect to standard services. Registered Ports (1,024 to 49,151) Assigned by IANA for specific processes or applications requested by entities. Used by individual applications not covered by well-known ports (e.g., Cisco’s RADIUS server uses port 1812). Private and/or Dynamic Ports (49,152 to 65,535) Also known as ephemeral ports. Assigned dynamically by the client’s OS for temporary connections. Typically used for client-side connections to servers. Common Port Numbers and Their Protocols 20 TCP: File Transfer Protocol (FTP) - Data Used for transferring files in FTP connections. 21 TCP: File Transfer Protocol (FTP) - Control Used for sending commands and responses in FTP. 22 TCP: Secure Shell (SSH) Provides secure command-line access and file transfers. 23 TCP: Telnet Used for remote command-line access (insecure). 25 TCP: Simple Mail Transfer Protocol (SMTP) Used for sending emails between servers. 53 UDP, TCP: Domain Name Service (DNS) Resolves domain names to IP addresses. 67 UDP: Dynamic Host Configuration Protocol (DHCP) - Server Used by DHCP servers to assign IP addresses to clients. 68 UDP: Dynamic Host Configuration Protocol (DHCP) - Client Used by DHCP clients to receive IP addresses from servers. 69 UDP: Trivial File Transfer Protocol (TFTP) A simpler version of FTP for transferring files. 80 TCP: Hypertext Transfer Protocol (HTTP) Used for transferring web pages and data on the internet. 110 TCP: Post O3ice Protocol version 3 (POP3) Used for retrieving emails from a server. 143 TCP: Internet Message Access Protocol (IMAP) Used for retrieving and managing emails from a server. 161 UDP: Simple Network Management Protocol (SNMP) Used for network management and monitoring. 443 TCP: Hypertext Transfer Protocol Secure (HTTPS) Secure version of HTTP, used for encrypted web communications. The This command will list all active network connections and their statuses. Here is what the output will look like: Active Connections Proto Local Address Foreign Address State TCP 192.168.1.124:3126 192.168.0.2:netbios-ssn ESTABLISHED TCP 192.168.1.124:3158 207.138.126.152:http ESTABLISHED TCP 192.168.1.124:3159 207.138.126.169:http ESTABLISHED TCP 192.168.1.124:3160 207.138.126.169:http ESTABLISHED TCP 192.168.1.124:3161 sc.msn.com:http ESTABLISHED TCP 192.168.1.124:3166 www.cisco.com:http ESTABLISHED This output helps you identify active connections and understand which services are communicating with your machine. TCP Connection Establishment Port Number Assignment: Each server application process is configured to use a specific port number. This port number is crucial for identifying which application should handle incoming network tra3ic. Unique Port Assignment: Within the same transport layer, an individual server cannot have two services listening on the same port number. This means each port number is unique to a particular service or application on a server. Open Ports: When a server application is actively listening on a port, it is considered "open." This means that the transport layer of the server is set up to accept and process incoming data directed to that port. Handling Incoming Requests: When a client sends a request to the server, it addresses the request to a specific socket, which is a combination of the server's IP address and port number. If the port number matches an open port on the server, the server application receives the data and processes it accordingly. Session Termination 1. Client Initiates Termination: The client, having no more data to send, sends a TCP segment with the FIN flag set. This indicates to the server that the client has finished sending data. 2. Server Acknowledges Client's FIN: The server responds with an ACK (Acknowledgment) segment to confirm that it has received the FIN from the client. This step marks the termination of the data flow from the client to the server. 3. Server Initiates Termination: After sending the ACK, the server sends its own FIN segment to the client to indicate that it too has finished sending data and wishes to close the connection. 4. Client Acknowledges Server's FIN: The client responds with an ACK segment to acknowledge the receipt of the server's FIN. This completes the termination process and ensures that both sides have agreed to close the connection. This sequence of messages ensures a clean and orderly shutdown of the connection, allowing both sides to finish any ongoing transmissions and close the connection gracefully. The TCP three-way handshake is a crucial process for establishing a reliable connection between a client and server. Here’s a detailed analysis of its functions: 1. Establish Device Presence: Purpose: Verifies that the destination device is present and reachable on the network. Process: The client sends a SYN (synchronize) packet to the server, indicating a request to start a connection. This initial packet is used to establish that the server is available to accept the connection. 2. Verify Service Availability: Purpose: Ensures that the server has an active service listening on the specified port number. Process: Upon receiving the SYN packet, the server responds with a SYNACK (synchronize-acknowledge) packet. This response signifies that the server is listening on the specified port and is ready to handle the connection request. 3. Inform of Connection Intent: Purpose: Notifies the server that the client is ready to establish a communication session on the specified port. Process: The client acknowledges the server’s SYN-ACK packet by sending an ACK (acknowledge) packet. This final step of the handshake completes the connection setup, confirming that both parties are ready to begin data transmission. Connection Termination: After Communication: Once the data exchange is complete, the connection is terminated using a four-step process (FIN and ACK flags) to ensure that both sides agree to close the session and that no data is lost. Reliability Function: TCP Reliability: The handshake process ensures that both parties are synchronized and agree on connection parameters before data transmission begins. This helps in managing data flow and error checking, contributing to TCP’s reliable data transfer capabilities. In the TCP protocol, the three-way handshake involves the use of several control bit flags within the TCP header. These flags help manage the state of the connection and the flow of data. Here’s a brief overview of the six key control bit flags used in TCP: 1. URG (Urgent Pointer field significant): Purpose: Indicates that the data within the segment is urgent and should be processed immediately. Usage: The urgent pointer field in the TCP header becomes valid and indicates the end of the urgent data. 2. ACK (Acknowledgment): Purpose: Used to acknowledge the receipt of data. The acknowledgment number field in the TCP header is valid when this flag is set. Usage: This flag is set in all segments after the initial SYN segment is received, including during connection establishment and session termination. 3. PSH (Push): Purpose: Instructs the receiving device to pass the data to the application as soon as possible, without waiting for additional data. Usage: Used when the sender wants the receiver to process the received data immediately. 4. RST (Reset): Purpose: Used to abruptly terminate a connection or refuse a connection attempt. Usage: This flag resets the connection if there is a problem, such as an error or timeout, and clears all queued data. 5. SYN (Synchronize): Purpose: Used to initiate a connection by synchronizing sequence numbers between two devices. Usage: The SYN flag is set in the initial packet from the client to the server and in the corresponding response from the server. 6. FIN (Finish): Purpose: Indicates that the sender has finished sending data. Usage: This flag is used in the session termination process to signal that no more data will be sent. These control flags are crucial for the reliable establishment, maintenance, and termination of TCP connections. They ensure that data is transmitted accurately and in the correct order, while also providing mechanisms for handling errors and controlling the flow of data. TCP Reliability and Flow Control Guaranteed and Ordered Delivery: Flow Control: TCP helps manage the flow of data between sender and receiver to ensure that neither end becomes overwhelmed. This is crucial for preventing network congestion and ensuring e3icient communication. Handling Lost or Out-of-Order Segments: In network communication, packets may sometimes get lost or arrive out of order. TCP addresses this issue by ensuring that all data reaches its destination correctly and in the proper sequence. Reassembly of Data: TCP segments may arrive out of sequence due to various factors, such as di3ering network paths. TCP uses sequence numbers, which are assigned in the header of each packet, to keep track of the order of data. When segments are received, TCP reassembles them into the correct order, ensuring that the data stream is accurately reconstructed as it was sent. This process guarantees reliable data transmission and ensures that applications receive the data as intended, without loss or corruption. TCP Reliability – Data Loss and Retransmission (Cont.) Selective Acknowledgment (SACK): Optional Feature: Modern host operating systems often support an optional feature called Selective Acknowledgment (SACK). This feature is negotiated between the sender and receiver during the initial TCP three-way handshake. Purpose of SACK: The SACK option enhances TCP's reliability by allowing the receiver to acknowledge not only the cumulative number of bytes received but also specific segments or bytes that have been received out of order. This is particularly useful in situations where multiple segments are lost or received out of order. Functionality of SACK: When SACK is enabled, the receiver can explicitly inform the sender about which segments have been successfully received, even if there are gaps due to lost segments. This information allows the sender to retransmit only the missing segments, rather than retransmitting all unacknowledged data, thus improving the e3iciency of the retransmission process and minimizing unnecessary data transfer. By using SACK, TCP can more e3ectively manage data loss and retransmission, ensuring more e3icient and reliable communication, especially over networks where packet loss and reordering are common. TCP Flow Control – Window Size and Acknowledgments Flow Control Mechanisms: Purpose: Flow control in TCP ensures that the sender does not overwhelm the receiver with more data than it can process and store. This mechanism helps maintain a balanced and reliable communication flow, preventing congestion and potential data loss. Window Size: The window size is a critical aspect of TCP flow control. It specifies the amount of data (in bytes) that the receiver is willing to accept and process at a time without sending an acknowledgment. This window size is communicated to the sender through the TCP header's window size field. The sender can send data up to the specified window size before it must stop and wait for an acknowledgment from the receiver, indicating that more data can be sent. Acknowledgments: TCP uses acknowledgments to confirm the receipt of data. The acknowledgment number in the TCP header indicates the next byte expected by the receiver. This number also implicitly acknowledges the receipt of all prior bytes. If the receiver’s bu3er is full or nearing capacity, it can advertise a smaller window size, signaling the sender to reduce its transmission rate. Conversely, if the bu3er has ample space, the receiver can increase the window size, allowing the sender to transmit more data before requiring an acknowledgment. Dynamic Adjustment: The window size can change dynamically during a session based on the receiver's capacity and network conditions. This dynamic adjustment helps optimize data flow and maintain e3icient communication. By implementing flow control mechanisms like window size and acknowledgments, TCP ensures that data is transmitted at a rate that matches the receiver's ability to process it, thereby enhancing the overall reliability and e3iciency of the communication process. TCP Flow Control – Maximum Segment Size (MSS) Maximum Segment Size (MSS): Definition: The Maximum Segment Size (MSS) is the largest amount of data, in bytes, that a device is willing to receive in a single TCP segment. It specifies the maximum payload size, excluding the TCP and IP headers. Common MSS Value: For IPv4, a typical MSS value is 1,460 bytes. This is derived from the standard Ethernet Maximum Transmission Unit (MTU) and the sizes of the IP and TCP headers. Calculation: The Ethernet MTU defines the maximum packet size that can be transmitted over an Ethernet network. The default Ethernet MTU is 1500 bytes. The IP header typically consumes 20 bytes, and the TCP header also typically consumes 20 bytes, totaling 40 bytes for the headers. Therefore, the MSS is calculated as follows: MSS=MTU−(IP Header Size+TCP Header Size) MSS=1500−(20+20)=1460 bytes MSS=1500−(20+20)=1460 bytes Purpose of MSS: ENiciency: The MSS ensures e3icient data transmission by setting an upper limit on the amount of data sent in a single segment, avoiding fragmentation and reducing overhead. Compatibility: By specifying the MSS during the TCP connection setup, both communicating devices agree on the segment size they can handle, ensuring compatibility and e3icient data exchange. Negotiation: The MSS is communicated during the TCP three-way handshake process. Each device sends its preferred MSS value in the TCP options field of the SYN segment. The lower of the two MSS values from the sender and receiver is used for the duration of the session, ensuring that both parties can handle the segment size. TCP Flow Control – Congestion Avoidance (Summary) TCP uses several mechanisms to manage congestion and maintain reliable communication: 1. Slow Start: Begins with a small congestion window (cwnd) that increases exponentially until a threshold (ssthresh) is reached or packet loss occurs. 2. Congestion Avoidance: After reaching the threshold, the cwnd increases linearly to avoid overloading the network. 3. Fast Retransmit and Fast Recovery: Quickly retransmits lost packets upon receiving duplicate acknowledgments and reduces the cwnd to manage congestion. 4. Congestion Control Algorithms: Variants like TCP Tahoe and TCP Reno adjust cwnd and ssthresh based on network conditions to optimize data flow. 5. Timers and Control Parameters: Includes mechanisms like the retransmission timer and dynamically adjusting cwnd to balance data throughput and prevent congestion collapse. UDP LOW Overhead versus Reliability No Connection Establishment: UDP does not require a connection setup before data transmission. Low Overhead: It has a small datagram header, leading to minimal additional data. No Network Management TraNic: UDP does not include mechanisms for error checking or acknowledgments. Speed and ENiciency: Ideal for applications where speed is more critical than reliability, such as live streaming and real-time communications. Lack of Data Integrity and Order Guarantee: No assurance of data being received correctly or in the correct order. UDP Datagram Reassembly No Sequence Tracking: UDP does not use sequence numbers like TCP. No Reordering: UDP does not reorder datagrams; they are processed in the order received. Simple Reassembly: Data is reassembled in the received order and forwarded to the application without additional processing. UDP Processes and Request Port Assignment: UDP-based server applications use well- known or registered port numbers. Datagram Handling: When UDP receives a datagram for a specific port, it forwards the data to the corresponding application based on the port number. UDP Client Proecesses Source Port Selection: The UDP client process dynamically selects a port number from the available range for the source port. Destination Port: The destination port is typically a well-known or registered port number assigned to the server process. Consistency: Once the client selects the source and destination ports, the same port pair is used in the header of all subsequent UDP datagrams in the session.

Use Quizgecko on...
Browser
Browser