Guide to TCP/IP Fourth Edition Chapter 9: TCP/IP Transport Layer Protocols
Objectives Explain the key features and functions of the User Datagram Protocol and the Transmission Control Protocol Explain, in detail, the header fields and functions of the UDP packet, as well as port numbers, processes, and how UDP behaves when used as a transport protocol by IPv6 Explain in detail, the mechanisms that drive segmentation, reassembly, and retransmission for TCP as well as how TCP behaves when used as a transport protocol by IPv6 2
Objectives (cont d.) Describe how UDP and TCP pseudo-headers are organized with the IPv6 header and extension headers Explain the differences between connectionless and connection-oriented transport mechanisms Choose between using User Datagram Protocol and Transmission Control Protocol 3
Understanding UDP and TCP UDP and TCP actually function as peers IP operates at the Network layer of the OSI model Responsible for transferring variable length data sequences from a source host to a destination host TCP guarantees acknowledged delivery At the cost of both time and bandwidth UDP is used for applications that do not need verified delivery Gain in speed and a reduced use of network bandwidth 4
UDP with IPv4 and IPv6 Connectionless protocols Provide the simplest kind of transport services UDP Used by applications that contain their own connection oriented timeout values and retry counters Runs up to 40 percent faster than TCP 5
UDP with IPv4 and IPv6 (cont d.) Connectionless protocols handle the following kinds of tasks Message checksum Higher-layer protocol identification 6
TCP with IPv4 and IPv6 TCP (connection-oriented protocol) Used by applications that rely on data reaching its destination TCP offers connection-oriented services with: Sequencing, error recovery, and a sliding window mechanism TCP hosts create a virtual connection with each other using a handshake process TCP transfers data as a continuous stream of bytes 7
TCP with IPv4 and IPv6 (cont d.) 8
User Datagram Protocol UDP limitations No reliability mechanisms No delivery guarantees No connection handling Identifies the Application layer protocol Checksum for entire message carried in UDP header No buffering services No segmentation 9
UDP Header Fields and Functions UDP header s main function To define the process or application that is using the IP and UDP Network and Transport layers UDP header fields Source Port Number field Destination Port Number field Length field Checksum field 10
UDP Header Fields and Functions (cont d.) 11
UDP Header Fields and Functions (cont d.) Source Port Number field Defines the application or process that sends the packet using the UDP header Well-known port numbers (0 Through 1023) Assigned to core services that systems offer Registered port numbers (1024 Through 49151) Assigned to industry applications and processes Dynamic ports Used as temporary ports for specific communications while they are underway 12
UDP Header Fields and Functions (cont d.) 13
UDP Header Fields and Functions (cont d.) Destination Port Number Field Defines destination application or process that uses the IP and UDP headers Length field Defines the length of the packet from the UDP header to the end of valid data Checksum field is optional 14
UDP Port Numbers and Processes UDP and TCP Use port numbers to define the source and destination processes or applications By default Windows Vista, Windows 7, and Windows Server 2008 support a port range of 49152 to 65535 15
UDP Port Numbers and Processes (cont d.) 16
17
UDP and IPv6 18
Transmission Control Protocol Responsible for providing ordered delivery of a stream of bytes From an application on one network node to an application on another network node Communications between two computers that are being established through TCP Use a three-way handshake procedure 19
TCP and IPv4 Primary functions and features of TCP communications: Start-up connection process (TCP handshake) Keep-alive process Connection termination Sequence and acknowledgment process Error-detection and error-recovery processes Congestion control Sliding window Header fields and functions 20
TCP Startup Connection Process Begins with handshake between two hosts One host initiates the handshake to another host to: Ensure the destination host is available Ensure the destination host is listening on the destination port number Inform destination host of initiator s sequence number 21
22
23
24
25
TCP Startup Connection Process (cont d.) 26
TCP Half-Open Connections Occur when the handshake process does not end successfully with a final ACK Half-open connection communication sequence occurs in the following order SYN >>>>> <<<<< ACK SYN <<<<< ACK SYN <<<<< ACK SYN 27
TCP Keep-Alive Process Can maintain connection when there is no data sent across the wire TCP keep-alives Disabled by default on Windows XP, Windows Vista, Windows 7, Windows Server 2003, and Windows Server 2008 KeepAliveTime setting Defines how long to wait before sending the first TCP keep-alive packet 28
TCP Keep-Alive Process (cont d.) 29
TCP Connection Termination Requires four packets Host 1 Sends a TCP packet with the FIN and ACK flags set Host 2 Sends an ACK in response Then sends a TCP packet with FIN and ACK flags set Host 1 Returns ACK response 30
31
32
TCP Sequence and Acknowledgment Process Guarantees that packets are ordered properly and protects against missing segments During handshake process Each side of connection selects its own starting sequence number Each side increments its sequence number value by the amount of data included in the outbound packet 33
TCP Sequence and Acknowledgment Process (cont d.) 34
35
TCP Error-Detection and Error- Recovery Process Retransmission timer First error-detection and error-recovery mechanism Retransmission timeout (RTO) Value specified by timer Retransmission operation increments 1st retransmit: RTO seconds 2nd retransmit: 2 x RTO seconds 3rd retransmit: 4 x RTO seconds 4th retransmit: 8 x RTO seconds 5th retransmit: 16 x RTO seconds 36
TCP Congestion Control Congestion The overloading of the network or a receiver Overloading of the network Occurs when there is too much data on the network medium Overloading a receiver Occurs when the number of data bytes is greater than the advertised window Current window Always the lesser of what the network and receiver can handle 37
TCP Congestion Control (cont d.) 38
TCP Congestion Control (cont d.) TCP has four defined congestion control mechanisms Slow Start Congestion Avoidance Fast Retransmit Fast Recovery 39
TCP Congestion Control (cont d.) Table 9-11 GlobalMaxTcpWindowSize Registry setting 40
TCP Congestion Control (cont d.) 41
TCP Sliding Window Used to determine the amount of unacknowledged data that can go out on the wire from any sender Nagle algorithm When small data segments are being sent, but not acknowledged, no other small segments can be sent Silly Window Syndrome (SWS) Caused when enough data is sent to a TCP host to fill its receiver buffer Puts receiver in a zero-window state 42
TCP Header Fields and Functions Source Port Number Field Destination Port Number Field Sequence Number Field Acknowledgment Number Field Header Length Field 43
TCP Header Fields and Functions (cont d.) 44
Table 9-13 TCP flag settings 45
TCP Header Fields and Functions (cont d.) Window Size Field TCP Checksum Field Urgent Pointer Field TCP Options Field(s) 46
TCP Header Fields and Functions (cont d.) 47
TCP Header Fields and Functions (cont d.) 48
TCP and IPv6 49
UDP, TCP, and IPv6 Extension Headers IPv6 headers put all optional data in extension headers Extension header Contains optional Internet-layer data that is stored in separate headers IPv6 header and each extension header, if present, contain a Next Header field 50
UDP, TCP, and IPv6 Extension Headers (cont d.) 51
52
Choosing Between TCP and UDP Because TCP is robust and reliable, it carries a lot of baggage, including: Additional header fields Explicit meta-messages in the form of TCP messages For some lightweight services, such as Microsoft Messenger Service TCP is overkill and UDP is used instead TCP is no longer as important as it once was Long-haul and local area networks have significantly increased speed, capacity, and reliability 53
Summary Transport layer protocols come in two types Connectionless and connection-oriented User Datagram Protocol The connectionless protocol associated with TCP/IP protocol suite UDP header is short and simple, consisting of: A protocol identifier in the IP header An optional checksum value Source and destination port addresses 54
Summary (cont'd.) Transmission Control Protocol Heavyweight, connection-oriented protocol that helps name the TCP/IP protocol suite TCP header Longer and more complex, Includes a variety of flags, values, and message types 55
Summary (cont'd.) Appropriate (and historical) uses for UDP Concentrate on Application layer services that manage their own reliability and connections Appropriate (and historical) uses for TCP Concentrate on providing reliable delivery of user services Although there are no updated versions for TCP and UDP that correspond to IPv6 The functions of these transport protocols are treated differently when used by IPv4 or IPv6 56