TCP (Transmission Control Protocol)

Similar documents
Transport Layer Protocols

Computer Networks UDP and TCP

Computer Networks. Chapter 5 Transport Protocols

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

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

Chapter 5. Transport layer protocols

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

[Prof. Rupesh G Vaishnav] Page 1

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

Transport Layer. Chapter 3.4. Think about

Network Security TCP/IP Refresher

This sequence diagram was generated with EventStudio System Designer (

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

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

IP address format: Dotted decimal notation:

Ethernet. Ethernet. Network Devices

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

TCP Performance Management for Dummies

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

Objectives of Lecture. Network Architecture. Protocols. Contents

Networking Test 4 Study Guide

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

2.1 Introduction. 2.2 Voice over IP (VoIP)

This sequence diagram was generated with EventStudio System Designer (

RARP: Reverse Address Resolution Protocol

Access Control: Firewalls (1)

Transport layer protocols for ad hoc networks

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

Recent advances in transport protocols

Protocols and Architecture. Protocol Architecture.

IP - The Internet Protocol

Voice over IP. Demonstration 1: VoIP Protocols. Network Environment

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

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

What is a DoS attack?

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

Networks: IP and TCP. Internet Protocol

Network layer" 1DT066! Distributed Information Systems!! Chapter 4" Network Layer!! goals: "

Overview of TCP/IP. TCP/IP and Internet

Final for ECE374 05/06/13 Solution!!

Understanding Layer 2, 3, and 4 Protocols

EITF25 Internet Techniques and Applications L5: Wide Area Networks (WAN) Stefan Höst

Internet Control Protocols Reading: Chapter 3

1 An application in BPC: a Web-Server

How do I get to

Multipath TCP in Practice (Work in Progress) Mark Handley Damon Wischik Costin Raiciu Alan Ford

CS268 Exam Solutions. 1) End-to-End (20 pts)

Guide to TCP/IP, Third Edition. Chapter 3: Data Link and Network Layer TCP/IP Protocols

Layer 7 Load Balancing and Content Customization

Algorithms and Techniques Used for Auto-discovery of Network Topology, Assets and Services

Network Layer: Network Layer and IP Protocol

Visualizations and Correlations in Troubleshooting

Internet Protocols. Background CHAPTER

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

TCP/IP and the Internet

CS 457 Lecture 19 Global Internet - BGP. Fall 2011

Computer Networks Practicum 2015

Introduction to TCP/IP

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

Higher Layer Protocols: UDP, TCP, ATM, MPLS

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

Network Intrusion Detection Systems. Beyond packet filtering

We will give some overview of firewalls. Figure 1 explains the position of a firewall. Figure 1: A Firewall

Lecture 16: TCP/IP Vulnerabilities: IP Spoofing and Denial-of-Service Attacks. Lecture Notes on Computer and Network Security

Networking Attacks: Link-, IP-, and TCP-layer attacks. CS 161: Computer Security Prof. David Wagner

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

Network Programming TDC 561

Introduction to Cisco IOS Flexible NetFlow

Exercises TCP/IP Networking. Solution. With Solutions

Request For Comments: 1350 STD: 33 July 1992 Obsoletes: RFC 783

Kap. 2. Transport - Schicht

8.2 The Internet Protocol

Advanced Computer Networks Project 2: File Transfer Application

Architecture and Performance of the Internet

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

The present and the future of TCP/IP

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

Introduction to IP networking

21.4 Network Address Translation (NAT) NAT concept

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

TOE2-IP FTP Server Demo Reference Design Manual Rev1.0 9-Jan-15

Solution of Exercise Sheet 5

Answer FIVE Questions only. Each carries 20 marks.

Encapsulating Voice in IP Packets

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

Indian Institute of Technology Kharagpur. TCP/IP Part I. Prof Indranil Sengupta Computer Science and Engineering Indian Institute of Technology

CHAPTER 1 PRINCIPLES OF NETWORK MONITORING

Title: DEVELOPING TCP/IP AND UDP TRAFFIC MONITORING TOOL. RAFIQ BIN CHE MAT ( )

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

Internet Protocol: IP packet headers. vendredi 18 octobre 13

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

TCP in Wireless Mobile Networks

Transport Layer and Data Center TCP

Transport and Network Layer

2 TCP-like Design. Answer

Question: 3 When using Application Intelligence, Server Time may be defined as.

Transcription:

TCP (Transmission Control Protocol) Originally defined in RFC 793 (September 1981) UDP features: multiplexing + protection against bit errors Ports, checksum Connection-oriented Establishment and teardown of the connections Reliable Missing or corrupt segments are detected and retransmitted Stream-based, in-order delivery The sender writes bytes into a TCP connection and the receiver reads bytes out of the TCP connection Full duplex Each TCP connection supports a pair of byte streams, one flowing in each direction Flow control Keep sender from overrunning receiver (end-to-end issue) Congestion Control Keep sender from overrunning network Algorithm tries to fill available capacity

Data Link vs. Transport At the heart of TCP is the sliding window algorithm TCP runs over the Internet rather than a point-to-point link Many important differences TCP potentially connects many different hosts Explicit connection establishment and teardown Some shared information to enable the sliding window algorithm to start Different RTT (Round Trip Times) LANs vs. satellite networks, peak hour Variations in the RTT are even possible during a single TCP connection that lasts only a few minutes Adaptive timeout mechanism Potentially long delay in network Packets may be reordered as they cross the Internet TCP has to be prepared for very old packets to suddenly show up at the receiver, potentially confusing the sliding window algorithm Maximum Segment Lifetime (MSL) Since IP throws packets away after their TTL expires, TCP assumes that each packet has a maximum lifetime The current recommended setting is 120 s (conservative estimation) Different capacity at destination Multiple TCP connections supported at the same time TCP must include a mechanism that each side uses to learn what resources (e.g., how much buffer space) the other side is able to apply to the connection Different network capacity The sender has no idea what links will be traversed to reach the destination

TCP Overview Application process Client Server Application process The client process passes a stream of data through the socket The application reads the stream of data from the receive buffer TCP TCP Send Buffer TCP Segments Receive Buffer Basic Data Transfer (RFC 793): The TCP is able to transfer a continuous stream of octets in each direction between its users by packaging some number of octets into segments for transmission through the internet system. In general, the TCPs decide when to block and forward data at their own convenience. Current status of the sliding window mechanism Maximum Segment Size (MSS): MTU of the directly connected network, minus the size of the TCP and IP headers standard MSS for TCP = 536 bytes (576 20-20) push operation timer

Source Port Destination Port TCP Header Sequence Number Acknowledgment Source Port: 16 bits The source port number Destination Port: 16 bits The destination port number HLen Resrvd Flags Checksum AdvertisedWindow UrgPtr The SrcPort and DstPort, plus the SRc and Dst IP addresses, combine to uniquely identify each TCP connection (SrcPort, SrcIPAddr,DstPort,DstIPAddr) TCP demux key Options (variable) Checksum: 16 bits The checksum field is the 16 bit one's complement of the one's complement sum of all 16 bit words in the TCP header, TCP data and the pseudo header. Required in both IPv4 and IPv6. HdrLen (Data Offset): 4 bits The number of 32 bit words in the TCP Header. This indicates where the data begins. The TCP header (even one including options) is an integral number of 32 bits long. Reserved: 6 bits Reserved for future use. Must be zero.

TCP Header: Sliding window algorithm Sequence Number: 32 bits The sequence number of the first data octet in this segment (except when SYN is present). If SYN is present the sequence number is the initial sequence number (ISN) and the first data octet is ISN+1. Acknowledgment Number: 32 bits If the ACK control bit is set this field contains the value of the next Sequence Number the sender of the segment is expecting to receive. Once a connection is established this is always sent. Advertised Window: 16 bits The number of data octets beginning with the one indicated in the acknowledgment field which the sender of this segment is willing to accept. Sequence Number (Data) Acknowledgment + AdvertisedWindow Sequence Number (Data) Acknowledgment + AdvertisedWindow

TCP Flags Control Bits: 6 bits (from left to right) URG: Urgent Pointer field significant This flag is used to identify incoming data as 'urgent'. Such incoming segments do not have to wait until the previous segments are consumed by the receiving end but are sent directly and processed immediately Out-of-band signalling Interrupt/abort character sequence in remote login session ACK: Acknowledgment field significant PSH: Push Function A push causes the TCP to promptly forward and deliver data up to that point to the receiver The Push flag is usually set on the last segment of a file to prevent buffer deadlocks RST: Reset the connection if a packet is sent to a host in order to establish a connection, and there is no such service waiting to answer at the remote host, then the host would automatically reject the request and then send a reply with the RST flag set SYN: Synchronize sequence numbers the SYN flag is set when establishing the classical 3-way handshake between two hosts FIN: No more data from sender This flag is used to tear down the virtual connections Urgent Pointer: 16 bits This field communicates the current value of the urgent pointer as a positive offset from the sequence number in this segment. The urgent pointer points to the sequence number of the octet following the urgent data. This field is only be interpreted in segments with the URG control bit set.

TCP Connection Management Connection establishment (Three-Way handshake) TCP sender, receiver establish connection before exchanging data segments initialize TCP variables: seq. #s buffers, flow control info (e.g. RcvWindow) Connection setup is an asymmetric activity: one side does a passive open and the other side does an active open client: connection initiator server: contacted by client The two sides begin sending data only after this connection establishment phase is over Connection termination Connection teardown is symmetric: each side has to close the connection independently As soon as a participant is done sending data, it closes one direction of the connection The other side can keep the other half of the bidirectional connection open and continue sending data

Initial Sequence Number (ISN) The protocol places no restriction on a particular connection being used over and over again. New instances of a connection will be referred to as incarnations of the connection. How does the TCP identify duplicate segments from previous incarnations of the connection? The connection is being opened and closed in quick succession, The connection breaks with loss of memory and is then reestablished To avoid confusion TCP must prevent segments from one incarnation of a connection from being used while the same sequence numbers may still be present in the network from an earlier incarnation. When new connections are created, an initial sequence number (ISN) generator is employed which selects a new 32 bit ISN The generator is bound to a (possibly fictitious) 32 bit clock whose low order bit is incremented roughly every 4 microseconds. Thus, the ISN cycles approximately every 4.55 hours. Since TCP assumes that segments will stay in the network no more than the Maximum Segment Lifetime (MSL) and that the MSL is less than 4.55 hours we can reasonably assume that ISN's will be unique. For a connection to be established or initialized, the two TCPs must synchronize on each other's initial sequence numbers. This is done in an exchange of connection establishing segments carrying a control bit called "SYN" (for synchronize) and the initial sequence numbers. As a shorthand, segments carrying the SYN bit are also called SYNs The solution requires a suitable mechanism for picking an initial sequence number and a slightly involved handshake to exchange the ISN's.

Three-Way Handshake active participant (client) A timer is scheduled for each of the first two segments, and if the expected response is not received, the segment is retransmitted SYN+ACK, SeqNum=y Ack=x+1 SYN SeqNum=x ACK, SeqNum=x+1 Ack=y+1 passive participant (server) The Acknowledgement Field identifies the next sequence number expected, thereby implicitly acknowledging all earlier sequence numbers ACK, SeqNum=x+1 Ack=y+1 First data segment

TCP State-Transition diagram States involved in opening a connection States involved in closing a connection

As the connection progresses, the connection moves from state to state according to the arcs TCP State-Transition diagram All Connections start in the CLOSED state The local application process invokes an operation on TCP States of the connection Each arc is labelled with a tag of the form event/action A segment arrives from the peer TimeOut based Retransmissions are NOT shown in the diagram

client SYN server Three-Way Handshake SYN+ACK ACK

Normal Connection Termination The application process on both sides of the connection must independently close its half of the connection Initiator Sequence FIN ACK Responder Sequence If only one side closes the connection, it is still available to receive data from the other side FIN ACK

TIME_WAIT State The TIME-WAIT state is required since the local side of the connection does not know if its ACK was successfully delivered Retransmission of the FIN segment Delayed packets FIN ACK FIN ACK SYN FIN

Connection Termination Simultaneous Close It is also possible for two devices to try to terminate a connection simultaneously. This term simultaneously does not mean that they both decide to shut down at exactly the same time. It simply means that one host decides to shut down and sends a FIN, but the other host sends its own FIN before receiving it. FIN FIN ACK ACK Both devices crosses the same states

Connection Termination- Rare transition Initiator Sequence FIN FIN+ACK Responder Sequence ACK

Connection Termination - Summary