Chapter 15. Transmission Control Protocol (TCP) TCP/IP Protocol Suite 1

Similar documents
Transport Layer Protocols

Chapter 5. Transport layer protocols

B-2 Analyzing TCP/IP Networks with Wireshark. Ray Tompkins Founder of Gearbit

Outline. TCP connection setup/data transfer Computer Networking. TCP Reliability. Congestion sources and collapse. Congestion control basics

Computer Networks. Chapter 5 Transport Protocols

TCP Flow Control. TCP Receiver Window. Sliding Window. Computer Networks. Lecture 30: Flow Control, Reliable Delivery

TCP over Multi-hop Wireless Networks * Overview of Transmission Control Protocol / Internet Protocol (TCP/IP) Internet Protocol (IP)

TCP in Wireless Mobile Networks

TCP/IP Optimization for Wide Area Storage Networks. Dr. Joseph L White Juniper Networks

Transport Layer. Chapter 3.4. Think about

This sequence diagram was generated with EventStudio System Designer (

[Prof. Rupesh G Vaishnav] Page 1

Access Control: Firewalls (1)

Improving the Performance of TCP Using Window Adjustment Procedure and Bandwidth Estimation

CSE 473 Introduction to Computer Networks. Exam 2 Solutions. Your name: 10/31/2013

A Survey on Congestion Control Mechanisms for Performance Improvement of TCP

ICOM : Computer Networks Chapter 6: The Transport Layer. By Dr Yi Qian Department of Electronic and Computer Engineering Fall 2006 UPRM

La couche transport dans l'internet (la suite TCP/IP)

COMP 3331/9331: Computer Networks and Applications. Lab Exercise 3: TCP and UDP (Solutions)

TCP over Wireless Networks

Simulation-Based Comparisons of Solutions for TCP Packet Reordering in Wireless Network

Computer Networks UDP and TCP

TCP/IP Networking for Wireless Systems. Integrated Communication Systems Group Ilmenau University of Technology

Prefix AggregaNon. Company X and Company Y connect to the same ISP, and they are assigned the prefixes:

Overview. Securing TCP/IP. Introduction to TCP/IP (cont d) Introduction to TCP/IP

CPS221 Lecture: Layered Network Architecture

Ethernet. Ethernet. Network Devices

Names & Addresses. Names & Addresses. Hop-by-Hop Packet Forwarding. Longest-Prefix-Match Forwarding. Longest-Prefix-Match Forwarding

Lecture Objectives. Lecture 07 Mobile Networks: TCP in Wireless Networks. Agenda. TCP Flow Control. Flow Control Can Limit Throughput (1)

q Connection establishment (if connection-oriented) q Data transfer q Connection release (if conn-oriented) q Addressing the transport user

TCP Performance Management for Dummies

Visualizations and Correlations in Troubleshooting

First Midterm for ECE374 03/24/11 Solution!!

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Transport Layer and Data Center TCP

TCP/IP Fundamentals. OSI Seven Layer Model & Seminar Outline

How do I get to

Mobile Communications Chapter 9: Mobile Transport Layer

Data Networks Summer 2007 Homework #3

LESSON Networking Fundamentals. Understand TCP/IP

Transport layer issues in ad hoc wireless networks Dmitrij Lagutin,

La couche transport dans l'internet (la suite TCP/IP)

Lecture 15: Congestion Control. CSE 123: Computer Networks Stefan Savage

CSE331: Introduction to Networks and Security. Lecture 9 Fall 2006

Transport layer protocols for ad hoc networks

Computer Networks. Data Link Layer

Congestions and Control Mechanisms n Wired and Wireless Networks

Data Link Layer(1) Principal service: Transferring data from the network layer of the source machine to the one of the destination machine

2 TCP-like Design. Answer

TCP in Wireless Networks

Stop And Wait. ACK received; transmit frame 2 CS 455 3

IP address format: Dotted decimal notation:

Chapter 3. TCP/IP Networks. 3.1 Internet Protocol version 4 (IPv4)

TCP Westwood for Wireless

Networking Test 4 Study Guide

TCP and Wireless Networks Classical Approaches Optimizations TCP for 2.5G/3G Systems. Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme

Final for ECE374 05/06/13 Solution!!

SELECTIVE-TCP FOR WIRED/WIRELESS NETWORKS

Parallel TCP Data Transfers: A Practical Model and its Application

Recent advances in transport protocols

Network Security TCP/IP Refresher

Midterm Exam CMPSCI 453: Computer Networks Fall 2011 Prof. Jim Kurose

Final exam review, Fall 2005 FSU (CIS-5357) Network Security

Computer Networks - CS132/EECS148 - Spring

Per-Flow Queuing Allot's Approach to Bandwidth Management

Overview of TCP/IP. TCP/IP and Internet

High Speed Internet Access Using Satellite-Based DVB Networks

TRANSPORT LAYER AND SECURITY PROTOCOLS FOR AD HOC WIRELESS NETWORKS

Solution of Exercise Sheet 5

Transport and Network Layer

(Refer Slide Time: 02:17)

A Study on TCP Performance over Mobile Ad Hoc Networks

A packet-reordering solution to wireless losses in transmission control protocol

Internet Packets. Forwarding Datagrams

Chapter 6 Congestion Control and Resource Allocation

Pig Laboratory. Additional documentation for the laboratory. Exercises and Rules. Tstat Data

Networks: IP and TCP. Internet Protocol

Chapter 11. User Datagram Protocol (UDP)

Command Manual - Network Protocol Quidway S3000 Series Ethernet Switches. Table of Contents

Optimization of Communication Systems Lecture 6: Internet TCP Congestion Control

Effect of Packet-Size over Network Performance

First Midterm for ECE374 03/09/12 Solution!!

Configuring TCP Intercept (Preventing Denial-of-Service Attacks)

Mobile Computing/ Mobile Networks

COMP 361 Computer Communications Networks. Fall Semester Midterm Examination

Low-rate TCP-targeted Denial of Service Attack Defense

Troubleshooting Tips and Tricks

CS335 Sample Questions for Exam #2

Introduction to IP networking

CSMA/CA. Information Networks p. 1

Higher Layer Protocols: UDP, TCP, ATM, MPLS

The present and the future of TCP/IP

IP - The Internet Protocol

Application Level Congestion Control Enhancements in High BDP Networks. Anupama Sundaresan

An enhanced TCP mechanism Fast-TCP in IP networks with wireless links

Transcription:

Chapter 15 Transmission Control Protocol (TCP) TCP/IP Protocol Suite 1 Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Chapter Outline TCP/IP Protocol Suite 2

15-1 TCP SERVICES Figure 15.1 shows the relationship of TCP to the other protocols in the TCP/IP protocol suite. TCP lies between the application layer and the network layer, and serves as the intermediary between the application programs and the network operations. TCP/IP Protocol Suite 3

TCP Services Process-to-Process Communication TCP/IP Protocol Suite 4

TCP/IP Protocol Suite 5

TCP Services Process-to-Process Communication Stream-oriented Service UDP send messages with predefined boundaries TCP deliver and receive data as a stream of bytes TCP/IP Protocol Suite 6

Figure 15.2 Stream delivery TCP/IP Protocol Suite 7

Figure 15.3 Sending and receiving buffers Buffer is a circular array Sender: White: Blue: data sent but not yet acknowledged Gray: data sent and acknowledged Receiver: White: Blue: received data Stream of bytes TCP/IP Protocol Suite 8

Figure 15.4 TCP segments TCP group a number of bytes together into a packet called a segment Segements are not necessarily all the same size Segment N H Segment 1 H TCP/IP Protocol Suite 9

TCP Services Process-to-Process Communication Stream-oriented Service UDP send messages with predefined boundaries TCP deliver and receive data as a stream of bytes Full-Duplex Service Data can flow in both direction at the same time Connection-Oriented Service Reliable Service Acknowledgement mechanism TCP/IP Protocol Suite 10

15-2 TCP FEATURES To provide the services mentioned in the previous section, TCP has several features that are briefly summarized in this section and discussed later in detail. TCP/IP Protocol Suite 11

TCP Numbering System Numbering System Byte number: between 0 and 2 32 1, the numbering may not start from 0 Sequence number for each segment is the number of the first byte Acknowledgement number defines the next byte that expected to receive The acknowledgement number is cumulative TCP/IP Protocol Suite 12

Example 15.1 Suppose a TCP connection is transferring a file of 5,000 bytes. The first byte is numbered 10,001. What are the sequence numbers for each segment if data are sent in five segments, each carrying 1,000 bytes? Solution The following shows the sequence number for each segment: TCP/IP Protocol Suite 13

Note The bytes of data being transferred in each connection are numbered by TCP. The numbering starts with an arbitrarily generated number. TCP/IP Protocol Suite 14

Note The value in the sequence number field of a segment defines the number assigned to the first data byte contained in that segment. TCP/IP Protocol Suite 15

Note The value of the acknowledgment field in a segment defines the number of the next byte a party expects to receive. The acknowledgment number is cumulative. TCP/IP Protocol Suite 16

15-3 SEGMENT Before discussing TCP in more detail, let us discuss the TCP packets themselves. A packet in TCP is called a segment. TCP/IP Protocol Suite 17

Figure 15.5 TCP segment format TCP/IP Protocol Suite 18

Figure 15.6 Control field TCP/IP Protocol Suite 19

Note The use of the checksum in TCP is mandatory. TCP/IP Protocol Suite 20

Figure 15.8 Encapsulation TCP header Application-layer data IP header Frame header Data-link layer payload TCP payload IP payload TCP/IP Protocol Suite 21

15-4 A TCP CONNECTION TCP is connection-oriented. It establishes a virtual path between the source and destination. All of the segments belonging to a message are then sent over this virtual path. You may wonder how TCP, which uses the services of IP, a connectionless protocol, can be connection-oriented. The point is that a TCP connection is virtual, not physical. TCP operates at a higher level. TCP uses the services of IP to deliver individual segments to the receiver, but it controls the connection itself. If a segment is lost or corrupted, it is retransmitted. TCP/IP Protocol Suite 22

Connection Establishment Three-way handshaking Connection Establishment Passive open: server tells its TCP that it is ready to accept a connection Active open: client issues a request Data Transfer Connection Termination TCP/IP Protocol Suite 23

Figure 15.9 Connection establishment using three-way handshake seq: 8000 U A P R S F SYN seq: 8000 ack: 15001 rwnd: 10000 U A P R S F ACK U A P R S F seq: 15000 ack: 8001 rwnd: 5000 SYN + ACK TCP/IP Protocol Suite 24

Note A SYN segment cannot carry data, but it consumes one sequence number. TCP/IP Protocol Suite 25

Note A SYN + ACK segment cannot carry data, but does consume one sequence number. TCP/IP Protocol Suite 26

Note An ACK segment, if carrying no data, consumes no sequence number. TCP/IP Protocol Suite 27

Figure 15.10 Data Transfer Connection Termination TCP/IP Protocol Suite 28

Figure 15.11 Connection termination using three-way handshake TCP/IP Protocol Suite 29

Note The FIN segment consumes one sequence number if it does not carry data. TCP/IP Protocol Suite 30

Note The FIN + ACK segment consumes one sequence number if it does not carry data. TCP/IP Protocol Suite 31

Figure 15.12 Half-Close TCP/IP Protocol Suite 32

Connection Reset TCP may deny a connection request, may abort an existing Connection, may terminate an idle connection. All of these are done with the RST (reset) flag. TCP/IP Protocol Suite 33

15-6 WINDOWS IN TCP Before discussing data transfer in TCP and the issues such as flow, error, and congestion control, we describe the windows used in TCP. TCP uses two windows (send window and receive window) for each direction of data transfer, which means four windows for a bidirectional communication. To make the discussion simple, we make an assumption that communication is only unidirectional; the bidirectional communication can be inferred using two unidirectional communications with piggybacking. TCP/IP Protocol Suite 34

Figure 13.11 Sliding window in circular format TCP/IP Protocol Suite 35

Figure 13.12 Sliding window in linear format TCP/IP Protocol Suite 36

Topics Discussed in the Section Send Window Sending window size is dictated by the receiver and the congestion Three status Open, close, shrink Receive Window Two status: open, close It should never shrink TCP/IP Protocol Suite 37

Figure 15.22 Send window in TCP TCP/IP Protocol Suite 38

Figure 15.23 Receive window in TCP TCP/IP Protocol Suite 39

15-7 FLOW CONTROL As discussed before, flow control balances the rate a producer creates data with the rate a consumer can use the data. TCP separates flow control from error control. In this section we discuss flow control, ignoring error control. We temporarily assume that the logical channel between the sending and receiving TCP is error-free. Figure 15.24 shows unidirectional data transfer between a sender and a receiver; bidirectional data transfer can be deduced from unidirectional one. TCP/IP Protocol Suite 40

Figure 15.24 TCP/IP protocol suite Messages are pushed 1 5 Flow control feedback 3 Messages are pulled 2 Segements are pushed 4 Flow control feedback Opening and closing windows The receive window close when more bytes arrive from the sender; it opens when more bytes are pulled; it doesn t shrink The opening, closing, and shrinking of the send window is controlled by the receiver TCP/IP Protocol Suite 41

Figure 15.25 An example of flow control TCP/IP Protocol Suite 42

Shrink of Windows The send window can shrink The receive window CANNOT shrink new ackno + new rwnd >= last ackno + last rwnd The receive window can temporarily shut down by sending a rwnd of 0. TCP/IP Protocol Suite 43

Figure 15.26 Example 15.2 TCP/IP Protocol Suite 44

15-8 ERROR CONTROL TCP is a reliable transport layer protocol. This means that an application program that delivers a stream of data to TCP relies on TCP to deliver the entire stream to the application program on the other end in order, without error, and without any part lost or duplicated. Error control in TCP is achieved through the use of three tools: checksum, acknowledgment, and time-out. TCP/IP Protocol Suite 45

Error Control Tools Checksum: mandatory Acknowledgment: Cumulative Acknowledgement (ACK) Selective Acknowledgement (SACK) Report out of order, or duplicated data Retransmission: After Retransmission Time-Out (RTO) After three duplicate ACK segments --- fast retransmission TCP/IP Protocol Suite 46

Note ACK segments do not consume sequence numbers and are not acknowledged. TCP/IP Protocol Suite 47

Note Data may arrive out of order and be temporarily stored by the receiving TCP, but TCP guarantees that no out-of-order data are delivered to the process. The receiver TCP delivers only ordered data to the process. TCP/IP Protocol Suite 48

15-9 CONGESTION CONTROL Congestion may occur if the load on the network (the number of packages sent to the network) is greater than the capacity of the network (the number of packages a network can handle). TCP uses a congestion window (cwnd) and a congestion policy that avoid congestion and detect and alleviate congestion after it has occurred. TCP/IP Protocol Suite 49

Congestion Control in TCP Congestion Window: Actual window size = minimum(rwnd, cwnd) Congestion Policy Slow start: cwnd start with one maximum segment size (MSS), but grows exponentially, until it reaches a slow start threshold (ssthresh) Congestion avoidance: increase cwnd additively instead of exponentially until congestion is detected Congestion detection: congestion occurs when retransmission is needed RTO timer times out: Strong possibility of congestion ssthressh dropped to half: cwnd = 1; start the slow start phase again Three duplicate ACKs: Weak possibility of congestion ssthressh dropped to half; cwnd = ssthressh; start the congestion avoidance phase again TCP/IP Protocol Suite 50

Figure 15.34 Slow start, exponential increase TCP/IP Protocol Suite 51

Note In the slow start algorithm, the size of the congestion window increases exponentially until it reaches a threshold. TCP/IP Protocol Suite 52

Figure 15.35 Congestion avoidance, additive increase TCP/IP Protocol Suite 53

Note In the congestion avoidance algorithm the size of the congestion window increases additively until congestion is detected. TCP/IP Protocol Suite 54

Figure 15.36 TCP Congestion policy summary TCP/IP Protocol Suite 55

Figure 15.37 Congestion example TCP/IP Protocol Suite 56

15-10 TCP TIMERS To perform its operation smoothly, most TCP implementations use at least four timers as shown in Figure 15.38 (slide 83). TCP/IP Protocol Suite 57

Figure 15.38 TCP timers Persistence Timer: deal with zero-window-size segment Keepalive Timer: prevent a long idle connections TIME-WAIT Timer: used for connection termination TCP/IP Protocol Suite 58

Retransmission Timer Round-trip time (RTT) Measured RTT (RTT M ) Smoothed RTT (RTT S ) RTT Deviation (RTT D ) TCP/IP Protocol Suite 59

Figure 15.43 No-operation option Smoother RTT RTT Deviation Retransmission Time-out (RTO) D α = 1/8 β = 1/4 TCP/IP Protocol Suite 60

Figure 15.39 Example 15.3 TCP/IP Protocol Suite 61

Example 15.3 Let us give a hypothetical example. Figure 15.39 shows part of a connection. The figure shows the connection establishment and part of the data transfer phases. 1. When the SYN segment is sent, there is no value for RTTM, RTTS, or RTTD. The value of RTO is set to 6.00 seconds. The following shows the value of these variable at this moment: 2. When the SYN+ACK segment arrives, RTTM is measured and is equal to 1.5 seconds. TCP/IP Protocol Suite 62

Example 15.3 Let us give a hypothetical example. Figure 15.39 shows part of a connection. The figure shows the connection establishment and part of the data transfer phases. 1. When the SYN segment is sent, there is no value for RTTM, RTTS, or RTTD. The value of RTO is set to 6.00 seconds. The following shows the value of these variable at this moment: 2. When the SYN+ACK segment arrives, RTTM is measured and is equal to 1.5 seconds. TCP/IP Protocol Suite 63

Example 15.3 Continued 3. When the first data segment is sent, a new RTT measurement starts. No RTT measurement starts for the second data segment because a measurement is already in progress. The arrival of the last ACK segment is used to calculate the next value of RTTM. Although the last ACK segment acknowledges both data segments (cumulative), its arrival finalizes the value of RTTM for the first segment. The values of these variables are now as shown below. TCP/IP Protocol Suite 64

Karn s Algorithm A segment is not acknowledged --- Karn s Algorithm Do not update the value of RTTs until you send a segment and receive an acknowledgement without the need for retransmission Exponential Backoff The value of RTO is double for each retransmission TCP/IP Protocol Suite 65

Figure 15.40 Example 15.4 TCP/IP Protocol Suite 66

15-11 OPTIONS The TCP header can have up to 40 bytes of optional information. Options convey additional information to the destination or align other options. We can define two categories of options: 1-byte options and multiplebyte options. The first category contains two types of options: end of option list and no operation. The second category, in most implementations, contains five types of options: maximum segment size, window scale factor, timestamp, SACK-permitted, and SACK (see Figure 15.41). TCP/IP Protocol Suite 67

Figure 15.41 Options TCP/IP Protocol Suite 68

Figure 15.42 End-of-option option TCP/IP Protocol Suite 69

Note EOP can be used only once. TCP/IP Protocol Suite 70

Figure 15.43 No-operation option TCP/IP Protocol Suite 71

Note NOP can be used more than once. TCP/IP Protocol Suite 72

Figure 15.44 Maximum-segment-size option MSS option defines the size of the biggest unit of data that can be received by the destination of the TCP segment The default value is 536 bytes TCP/IP Protocol Suite 73

Note The value of MSS is determined during connection establishment and does not change during the connection. TCP/IP Protocol Suite 74

Figure 15.45 Window-scale-factor option New window size = window size defined in the header * 2 window scale factor TCP/IP Protocol Suite 75

Note The value of the window scale factor can be determined only during connection establishment; it does not change during the connection. TCP/IP Protocol Suite 76

Figure 15.46 Timestamp option TCP/IP Protocol Suite 77

Note One application of the timestamp option is the calculation of round-trip time (RTT). TCP/IP Protocol Suite 78

Figure 15.47 Example 15.5 TCP/IP Protocol Suite 79

Figure 15.48 SACK TCP/IP Protocol Suite 80

Example 15.6 Let us see how the SACK option is used to list out-of-order blocks. In Figure 15.49 an end has received five segments of data. TCP/IP Protocol Suite 81

Example 15.7 Figure 15.50 shows how a duplicate segment can be detected with a combination of ACK and SACK. In this case, we have some out-of-order segments (in one block) and one duplicate segment. To show both out-of-order and duplicate data, SACK uses the first block, in this case, to show the duplicate data and other blocks to show out-of-order data. Note that only the first block can be used for duplicate data. The natural question is how the sender, when it receives these ACK and SACK values, knows that the first block is for duplicate data (compare this example with the previous example). The answer is that the bytes in the first block are already acknowledged in the ACK field; therefore, this block must be a duplicate. TCP/IP Protocol Suite 82

Figure 15.50 Example 15.7 TCP/IP Protocol Suite 83

Example 15.8 Figure 15.51 shows what happens if one of the segments in the out-of-order section is also duplicated. In this example, one of the segments (4001:5000) is duplicated. The SACK option announces this duplicate data first and then the out-of-order block. This time, however, the duplicated block is not yet acknowledged by ACK, but because it is part of the out-of-order block (4001:5000 is part of 4001:6000), it is understood by the sender that it defines the duplicate data. TCP/IP Protocol Suite 84

Figure 15.51 Example 15.8 TCP/IP Protocol Suite 85

Summaries: To introduce TCP as a protocol that provides reliable stream delivery service. To define TCP features and compare them with UDP features. To define the format of a TCP segment and its fields. To show how TCP provides a connection-oriented service, and show the segments exchanged during connection establishment and connection termination phases. To discuss the state transition diagram for TCP and discuss some scenarios. To introduce windows in TCP that are used for flow and error control. TCP/IP Protocol Suite 86

Summaries (continued): To discuss how TCP implements flow control in which the receive window controls the size of the send window. To discuss error control and FSMs used by TCP during the data transmission phase. To discuss how TCP controls the congestion in the network using different strategies. To list and explain the purpose of each timer in TCP. To discuss options in TCP and show how TCP can provide selective acknowledgment using the SACK option. TCP/IP Protocol Suite 87