Transport Layer Outline

Similar documents
Transport Layer and Data Center TCP

Transport Layer Protocols

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

Chapter 5. Transport layer protocols

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

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

Higher Layer Protocols: UDP, TCP, ATM, MPLS

Computer Networks UDP and TCP

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

Transport Layer. Chapter 3.4. Think about

Computer Networks - CS132/EECS148 - Spring

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

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

[Prof. Rupesh G Vaishnav] Page 1

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

COMP 361 Computer Communications Networks. Fall Semester Midterm Examination

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

TCP in Wireless Mobile Networks

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

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

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

Data Communications & Networks. Session 6 Main Theme Reliable Data Transfer. Dr. Jean-Claude Franchitti

This sequence diagram was generated with EventStudio System Designer (

Ethernet. Ethernet. Network Devices

15-441: Computer Networks Homework 2 Solution

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

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

Internet Protocols. Background CHAPTER

How do I get to

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

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

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

Access Control: Firewalls (1)

Final for ECE374 05/06/13 Solution!!

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

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

Transport layer protocols for ad hoc networks

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

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

IP - The Internet Protocol

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

Data Communication & Networks G

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

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

Visualizations and Correlations in Troubleshooting

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

IP address format: Dotted decimal notation:

Architecture and Performance of the Internet

Mobile Communications Chapter 9: Mobile Transport Layer

Computer Networks. Data Link Layer

TCP Performance Management for Dummies

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

Chapter 6 Congestion Control and Resource Allocation

Overview of TCP/IP. TCP/IP and Internet

Homework 3 assignment for ECE374 Posted: 03/13/15 Due: 03/27/15

Chapter 11. User Datagram Protocol (UDP)

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

Lecture Computer Networks

Recent advances in transport protocols

8.2 The Internet Protocol

2 TCP-like Design. Answer

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

SIP: Session Initiation Protocol

2.1 Introduction. 2.2 Voice over IP (VoIP)

Advanced Computer Networks Project 2: File Transfer Application

Data Networks Summer 2007 Homework #3

Computer Networks Practicum 2015

TCP for Wireless Networks

What is a DoS attack?

NETWORK LAYER/INTERNET PROTOCOLS

Protocols and Architecture. Protocol Architecture.

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

Gary Hecht Computer Networking (IP Addressing, Subnet Masks, and Packets)

SELECTIVE-TCP FOR WIRED/WIRELESS NETWORKS

1 An application in BPC: a Web-Server

TCP Adaptation for MPI on Long-and-Fat Networks

A Survey on Congestion Control Mechanisms for Performance Improvement of TCP

First Midterm for ECE374 02/25/15 Solution!!

Computer Networks Homework 1

Network Layer: Network Layer and IP Protocol

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

The present and the future of TCP/IP

8-bit Microcontroller. Application Note. AVR460: Embedded Web Server. Introduction. System Description

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

Understanding Layer 2, 3, and 4 Protocols

Introduction to TCP/IP

Networking Test 4 Study Guide

Exercises TCP/IP Networking. Solution. With Solutions

Network Programming TDC 561

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

Secure SCTP against DoS Attacks in Wireless Internet

A Transport Protocol for Multimedia Wireless Sensor Networks

Improved Digital Media Delivery with Telestream HyperLaunch

SCTP for Beginners Erwin P. Rathgeb

Improving Effective WAN Throughput for Large Data Flows By Peter Sevcik and Rebecca Wetzel November 2008

File Transfer Protocol (FTP) Throughput Testing by Rachel Weiss

Transcription:

Transport Layer Outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control Transport Layer 3-1 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 point-to-point: one sender, one receiver no one to many multicasts connection-oriented: processes must handshake before sending data three-way handshake: (exchange of control msgs) initializes sender, receiver state before data exchange pipelined: TCP congestion and flow control set window size send & receive buffers: set-aside during the 3-way handshaking socket door full duplex data: bi-directional data flow in same connection at the same time flow controlled: application writes data TCP send buffer sender will not overwhelm receiver segment application reads data TCP receive buffer socket door Transport Layer 3-2 1

TCP: Overview - cont Maximum Segment Size (MSS): Defined as the maximum amount of application-layer data in the TCP segment. TCP grabs data in chunks from the send buffer where the maximum chunk size is called MSS. TCP segment contains TCP header and MSS. MSS is set by determining the largest link layer frame (Maximum Transmission Unit or MTU) that can be sent by the local host MSS is set so that an MSS put into an IP datagram will fit into a single link layer frame. Common values of MTU is 1460 bytes, 536 bytes and 512 bytes. TCP sequence #s: both sides randomly choose initial seq #s (other than 0) to prevent receiving segments of older connections that were using the same ports. TCP views data as unordered structured stream of bytes so seq #s are over the stream of byes. file size of 500,000 bytes and MSS=1,000 bytes, segment seq #s are: 0, 1000, 2000, etc. TCP acknowledgement #s: uses cumulative acks: TCP only acks bytes up to the first missing byte in the stream. TCP RFCs do not address how to handle out-of-order segments. ACK # field has the next byte offset that the sender or receiver is expecting Transport Layer 3-3 TCP segment structure URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now to upper layer SYN/FIN: connection setup and close. RST=1: used in response when client tries to connect to a non-open server port. Internet checksum (as in UDP) 32 bits source port # dest port # sequence number acknowledgement number header not length used UAP R S F checksum Receive window Urgent data pointer Options (variable length) used to negotiate MSS application data (variable length) counting by bytes of data (not segments!) largest file that can be sent = 2 32 (4GB) total #segments= filesize/mss 16-bit= # bytes receiver willing to accept (RcvWindow size) header-length = 4-bits in 32-bit words Transport Layer 3-4 2

Seq Numbers and Ack Numbers Suppose a data stream of size 500,000 bytes, MSS is 1,000 bytes; the first byte of the data stream is numbered zero. Seq number of the segments: 1 st seg: 0; 2 nd seg: 1000; 3 rd seg: 2000, Ack number: Assume host A is sending seg to host B. Because TCP is full-duplex, A may be receiving data from B simultaneously. Ack number that host B puts in its seg is the seq number of the next byte B is expecting from A B has received all bytes numbered 0 through 535 from A. If B is about to send a segment to host A. The ack number in its segment should 536 Transport Layer 3-5 TCP seq. # s and ACKs - Telnet example Telnet uses echo back to ensure characters seen by user already been received and processed at server. Assume starting seq #s are 42 and 79 for client and server respectively. After connection is established, client is waiting for byte 79 and server for byte 42. Seq. # s: byte stream number of first byte in segment s data ACKs: seq # of next byte expected from other side cumulative ACK User types C host ACKs receipt of echoed C Host A client Host B server Seq=42, ACK=79, data = C Seq=79, ACK=43, data = C Seq=43, ACK=80 simple telnet scenario host ACKs receipt of C, echoes back C time Transport Layer 3-6 3

TCP Round Trip Time and Timeout Q: how to set TCP timeout value? (timer management) based on RTT longer than RTT but RTT varies too short: premature timeout unnecessary retransmissions too long: slow reaction to segment loss Q: how to estimate RTT? SampleRTT: measured time from segment transmission (handing the segment to IP) until ACK receipt ignore retransmissions (why?) SampleRTT will vary from segment to segment, want estimated RTT smoother average several recent measurements, not just current SampleRTT TCP maintains an average called EstimatedRTT to use it to calculate the timeout value Transport Layer 3-7 TCP Round Trip Time (RTT) and Timeout EstimatedRTT = (1- α) * priorestimatedrtt + α * currentsamplertt Exponential Weighted Moving Average (EWMA) Puts more weight on recent samples rather than old ones influence of past sample decreases exponentially fast typical value: α = 0.125 Formula becomes: EstimatedRTT = 0.875 * priorestimatedrtt + 0.125 * currentsamplertt Why TCP ignores retransmissions when calculating SampleRTT: Suppose source sends packet P1, the timer for P1 expires, and the source then sends P2, a new copy of the same packet. Further suppose the source measures SampleRTT for P2 (the retransmitted packet) and that shortly after transmitting P2 an acknowledgment for P1 arrives. The source will mistakenly take this acknowledgment as an acknowledgment for P2 and calculate an incorrect value of SampleRTT. Transport Layer 3-8 4

Example RTT estimation: RTT: gaia.cs.umass.edu to fantasia.eurecom.fr 350 300 RTT (milliseconds) 250 200 150 100 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 time (seconnds) SampleRTT Estimated RTT Transport Layer 3-9 TCP Round Trip Time and Timeout Setting the timeout EstimtedRTT plus safety margin large variation in EstimatedRTT -> larger safety margin first estimate of how much SampleRTT deviates from EstimatedRTT: DevRTT = (1-β)*DevRTT + β* SampleRTT-EstimatedRTT (typically, β = 0.25) Then set timeout interval: TimeoutInterval = EstimatedRTT + 4*DevRTT Transport Layer 3-10 5

TCP: conn-oriented transport segment structure RTT Estimation and Timeout reliable data transfer flow control connection management Transport Layer 3-11 TCP reliable data transfer TCP creates rdt service on top of IP s unreliable service Pipelined segments Cumulative acks TCP uses single retransmission timer as multiple timers require considerable overhead Retransmissions are triggered by: timeout events duplicate acks Initially consider simplified TCP sender: ignore duplicate acks ignore flow control, congestion control Transport Layer 3-12 6

TCP sender events: data rcvd from app: Create segment with seq # seq # is byte-stream number of first data byte in segment start timer if not already running for some other segment (think of timer as for oldest unacknowledged segment) expiration interval: TimeOutInterval timeout: retransmit segment that caused timeout restart timer Ack rcvd: a valid ACK field (cumulative ACK) acknowledges previously unacknowledged segments: update expected ACK # restart timer if there are currently unacknowledged segments Transport Layer 3-13 NextSeqNum = InitialSeqNum SendBase = InitialSeqNum loop (forever) { switch(event) event: data received from application above create TCP segment with sequence number NextSeqNum if (timer currently not running) start timer pass segment to IP NextSeqNum = NextSeqNum + length(data) event: timer timeout retransmit not-yet-acknowledged segment with smallest sequence number start timer event: ACK received, with ACK field value of y if (y > SendBase) { SendBase = y if (there are currently not-yet-acknowledged segments) start timer } } /* end of loop forever */ TCP sender (simplified) Comment: SendBase-1: last cumulatively ack ed byte Example: SendBase-1 = 71; y= 73, so the rcvr wants 73+ ; y > SendBase, so that new data is acked Transport Layer 3-14 7

TCP: retransmission scenarios Host A Host B Host A Host B Seq=92, 8 bytes data timeout SendBase = 100 time Seq=92, 8 bytes data X loss ACK=100 Seq=92, 8 bytes data ACK=100 lost ACK scenario transmit not-yet-ack segment with smallest seq # Sendbase = 100 SendBase = 120 SendBase = 120 Seq=92 timeout Seq=92 timeout time Seq=100, 20 bytes data ACK=100 ACK=120 Seq=92, 8 bytes data ACK=120 premature timeout Transport Layer 3-15 TCP retransmission scenarios (more) SendBase = 120 timeout Host A Seq=92, 8 bytes data loss Host B Seq=100, 20 bytes data X ACK=120 ACK=100 time Cumulative ACK scenario Doubling the timeout value technique is used in TCP implementations. The timeout value is doubled for every retransmission since the timeout could have occurred because the network is congested. (the intervals grow exponentially after each retransmission and reset after either of the two other events) Transport Layer 3-16 8

TCP ACK generation policy [RFC 1122, RFC 2581] Event at Receiver Arrival of in-order segment with expected seq #. All data up to expected seq # already ACKed Arrival of in-order segment with expected seq #. One other segment has ACK pending Arrival of out-of-order segment higher-than-expect seq. #. Gap detected Arrival of segment that partially or completely fills gap TCP Receiver action Delayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK Immediately send single cumulative ACK, ACKing both in-order segments Immediately send duplicate ACK, indicating seq. # of next expected byte Immediate send ACK, provided that segment starts at lower end of gap leaves buffering of out-of-order segments open Transport Layer 3-17 Fast Retransmit Time-out period often relatively long: long delay before resending lost packet Detect lost segments via duplicate ACKs. Dup Ack is an ack that reaknolwedges the receipt of an acknowledged segment Sender often sends many segments back-to-back If segment is lost, there will likely be many duplicate ACKs. If sender receives 3 ACKs for the same data, it supposes that segment after last ACKed segment was lost: sender performs fast retransmit: resend segment before that segment s timer expires algorithm comes as a result of 15 years TCP experience! Transport Layer 3-18 9

Fast retransmit algorithm: event: ACK received, with ACK field value of y if (y > SendBase) { SendBase = y if (there are currently not-yet-acknowledged segments) start timer } else { increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) { resend segment with sequence number y } a duplicate ACK for already ACKed segment fast retransmit Transport Layer 3-19 Is TCP a GBN or SR protocol? TCP can buffer out-of-order segments (like SR). TCP has a proposed RFC called selective acknowledgement to selectively acknowledge out-oforder segments and save on retransmissions (like SR). TCP sender need only maintain smallest seq # of a transmitted but unacknowledged byte and the seq # of next byte to be sent (like GBN). TCP is hybrid between GBN and SR. Transport Layer 3-20 10

TCP: conn-oriented transport segment structure RTT Estimation and Timeout reliable data transfer flow control connection management Transport Layer 3-21 TCP Flow Control receive side of TCP connection has a receive buffer: flow control sender won t overflow receiver s buffer by transmitting too much, too fast app process may be slow at reading from buffer speed-matching service: matching the send rate to the receiving app s drain rate Transport Layer 3-22 11

TCP Flow control: how it works (Suppose TCP receiver discards out-oforder segments) sender maintains variable called receive window spare room in buffer = RcvWindow = RcvBuffer-[LastByteRcvd - LastByteRead] TCP is not allowed to overflow the allocated buffer (LastByteRcvd - LastByteRead <= RcvBuffer) Rcvr advertises spare room by including value of RcvWindow in segments RcvWindow = RcvBuffer at the start of transmission Sender limits unacked data to RcvWindow sender keeps track of UnAcked data size = (LastByteSent - LastByteAcked) UnAcked data size <= RcvWindow When Receiver RcvWindow = 0, Sender does not block but rather sends 1 byte segments that are acked by receiver until RcvWindow becomes bigger. Transport Layer 3-23 TCP: conn-oriented transport segment structure RTT Estimation and Timeout reliable data transfer flow control connection management Transport Layer 3-24 12

TCP Connection Management Recall: TCP sender, receiver establish connection before exchanging data segments initialize TCP variables: seq. #s buffers, flow control info (e.g. RcvWindow) client: connection initiator Socket clientsocket = new Socket("hostname","port number"); server: contacted by client Socket connectionsocket = welcomesocket.accept(); Three way handshake: Step 1: client host sends TCP SYN segment (SYN bit=1) to server specifies initial seq # (client_isn) no data Step 2: server host receives SYN, replies with SYNACK segment server allocates buffers specifies server initial seq. # (server_isn), with ACK # = client_isn+1 Step 3: client receives SYNACK, replies with ACK # = server_isn+1, which may contain data Transport Layer 3-25 TCP Connection Management - connecting client server connection request ACK SYN=1, seq=client_isn SYN=1, seq=server_isn, ack=client_isn+1 connection granted SYN=0, seq=client_isn+1, ack=server_isn+1 Time Time Transport Layer 3-26 13

TCP Connection Management - disconnecting Closing a connection: client server client closes socket: clientsocket.close(); close FIN Step 1: client end system sends TCP FIN control segment (FIN bit=1) to server Step 2: server receives FIN, replies with ACK. Closes connection, sends FIN=1. timed wait closed ACK FIN ACK close Transport Layer 3-27 TCP Connection Management (cont.) Step 3: client receives FIN, replies with ACK. Enters timed wait - will respond with ACK to received FINs where typical wait is 30 sec. All resources and ports are released. Step 4: server, receives ACK. Connection closed. closing timed wait client FIN ACK FIN ACK server closing closed closed Transport Layer 3-28 14

TCP Connection Management (cont) TCP server lifecycle TCP client lifecycle Transport Layer 3-29 TCP Summary TCP Properties: point to point, connection-oriented, full-duplex, reliable TCP Segment Structure How TCP sequence and acknowledgement #s are assigned How does TCP measure the timeout value needed for retransmissions using EstimatedRTT and DevRTT TCP retransmission scenarios, ACK generation and fast retransmit How does TCP Flow Control work TCP Connection Management: 3-segments exchanged to connect and 4-segments exchanged to disconnect Transport Layer 3-30 15