Transport Protocols Reading: Sections 5.1 and 5.2 COS 461: Computer Networks Spring 2011 Mike Freedman

Slides:



Advertisements
Similar presentations
Congestion Control Jennifer Rexford Advanced Computer Networks Tuesdays/Thursdays 1:30pm-2:50pm.
Advertisements

CCNA – Network Fundamentals
Transportation Layer. Very similar to the data link layer. – two hosts connected by a link or two hosts connected by a network differences: – When two.
Fundamentals of Computer Networks ECE 478/578 Lecture #20: Transmission Control Protocol Instructor: Loukas Lazos Dept of Electrical and Computer Engineering.
Transport Layer3-1 TCP. Transport Layer3-2 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data flow in same connection.
Data Communications and Computer Networks Chapter 3 CS 3830 Lecture 16 Omar Meqdadi Department of Computer Science and Software Engineering University.
1 Chapter 3 Transport Layer. 2 Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4.
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
1 Transport Layer Lecture 9 Imran Ahmed University of Management & Technology.
1 CS492B Project #2 TCP Tutorial # Jin Hyun Ju.
1 TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Winter 2008CS244a Handout #61 CS244a: An Introduction to Computer Networks Handout 6: The Transport Layer, Transmission Control Protocol (TCP), and User.
BZUPAGES.COM 1 User Datagram Protocol - UDP RFC 768, Protocol 17 Provides unreliable, connectionless on top of IP Minimal overhead, high performance –No.
Transport Layer – TCP (Part1) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
TELE202 Lecture 14 TCP/UDP (2) 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »TCP/UDP (1) »Source: chapter 17 ¥This Lecture »TCP/UDP (2) »Source: chapter.
Computer Networks 2 Lecture 2 TCP – I - Transport Protocols: TCP Segments, Flow control and Connection Setup.
Professor Yashar Ganjali Department of Computer Science University of Toronto
TCP EE 122, Fall 2013 Sylvia Ratnasamy Material thanks to Ion Stoica, Scott Shenker, Jennifer Rexford, Nick McKeown,
Chapter 3 outline 3.1 transport-layer services
Transport Layer 3-1 Transport Layer r To learn about transport layer protocols in the Internet: m TCP: connection-oriented protocol m Reliability protocol.
Transport Layer Transport Layer: TCP. Transport Layer 3-2 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional.
Transport Layer 3-1 Transport Layer r To learn about transport layer protocols in the Internet: m TCP: connection-oriented protocol m Reliability protocol.
Announcement Project 2 out –Much harder than project 1, start early! Homework 2 due next Tu.
1 Transport Protocols Reading: Sections 2.5, 5.1, and 5.2 COS 461: Computer Networks Spring 2006 (MW 1:30-2:50 in Friend 109) Jennifer Rexford Teaching.
Transport Protocols Reading: Sections 2.5, 5.1, and 5.2 COS 461: Computer Networks Spring 2009 (MW 1:30-2:50 in COS 105) Mike Freedman
3-1 Transport services and protocols r provide logical communication between app processes running on different hosts r transport protocols run in end.
Transport Layer TCP and UDP IS250 Spring 2010
1 Transport Protocols Reading: Sections 2.5, 5.1, and 5.2 COS 461: Computer Networks Spring 2008 (MW 1:30-2:50 in COS 105) Jennifer Rexford Teaching Assistants:
Process-to-Process Delivery:
1 Transport Layer Computer Networks. 2 Where are we?
3: Transport Layer3b-1 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data flow in same connection m MSS: maximum.
TCOM 509 – Internet Protocols (TCP/IP) Lecture 04_b Transport Protocols - TCP Instructor: Dr. Li-Chuan Chen Date: 09/22/2003 Based in part upon slides.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Transport Layer3-1 Chapter 3: Transport Layer Our goals: r understand principles behind transport layer services: m multiplexing/demultipl exing m reliable.
Transport Layer Moving Segments. Transport Layer Protocols Provide a logical communication link between processes running on different hosts as if directly.
CSE679: Computer Network Review r Review of the uncounted quiz r Computer network review.
Transport Layer Mike Freedman COS 461: Computer Networks Best-effort local packet delivery Best-effort.
1 End-to-End Protocols (UDP, TCP, Connection Management)
4-1 Lecture 04: Transport Layer r Transport layer protocols in the Internet: m UDP: connectionless transport m TCP: connection-oriented transport m TCP.
Networking Basics CCNA 1 Chapter 11.
81 Sidevõrgud IRT 0020 loeng okt Avo Ots telekommunikatsiooni õppetool, TTÜ raadio- ja sidetehnika inst.
Transport Protocols.
Transport Layer: Sliding Window Reliability
Transport Layer3-1 Chapter 3 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles.
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
Retransmission. Automatic Repeat reQuest (ARQ) 2 Time Packet ACK Timeout Automatic Repeat Request –Receiver sends acknowledgment (ACK) when it receives.
IP1 The Underlying Technologies. What is inside the Internet? Or What are the key underlying technologies that make it work so successfully? –Packet Switching.
IT 424 Networks2 IT 424 Networks2 Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross Chapter 3: Transport.
Transport Layer3-1 Transport Layer If you are going through Hell Keep going.
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
CSEN 404 Transport Layer II Amr El Mougy Lamia AlBadrawy.
11 CS716 Advanced Computer Networks By Dr. Amir Qayyum.
Computer Networks 1000-Transport layer, TCP Gergely Windisch v spring.
1 TCP ProtocolsLayer name DNSApplication TCP, UDPTransport IPInternet (Network ) WiFi, Ethernet Link (Physical)
Chapter 5 Peer-to-Peer Protocols and Data Link Layer Timing Recovery.
DMET 602: Networks and Media Lab Amr El Mougy Yasmeen EssamAlaa Tarek.
Professor Ayse Karaman Announcements Programming assignment 1 Due: Friday, October 30 th (5PM) If you submit 10 days (by the.
Introduction to Networks
5. End-to-end protocols (part 1)
Process-to-Process Delivery
Introduction of Transport Protocols
Transport Layer ECE544: Communication Networks-II, Spring 2013
Transport Layer Jennifer Rexford COS 461: Computer Networks
Transportation Layer.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Handout # 10: Transport Protocols
Transport Protocols: TCP Segments, Flow control and Connection Setup
Process-to-Process Delivery: UDP, TCP
Presentation transcript:

Transport Protocols Reading: Sections 5.1 and 5.2 COS 461: Computer Networks Spring 2011 Mike Freedman 1

Goals for Today’s Lecture Principles underlying transport-layer services – (De)multiplexing – Detecting corruption – Reliable delivery – Flow control Transport-layer protocols in the Internet – User Datagram Protocol (UDP) Simple (unreliable) message delivery – Transmission Control Protocol (TCP) Reliable bidirectional stream of bytes 2

Recall the Internet layering model 3 HTTP TCP IP Ethernet interface HTTP TCP IP Ethernet interface IP Ethernet interface Ethernet interface SONET interface SONET interface host router HTTP message TCP segment IP packet

Two Basic Transport Features Demultiplexing: port numbers Error detection: checksums 4 Web server (port 80) Client host Server host Echo server (port 7) Service request to :80 OS Client IPpayload detect corruption Request from :3456 Demux table (“5 tuple”)Socket 5 6

User Datagram Protocol (UDP) Datagram messaging service – Demultiplexing of messages: port numbers – Detecting corrupted messages: checksum Lightweight communication between processes – Send messages to and receive them from a socket – Avoid overhead and delays of ordered, reliable delivery 5 SRC port DST port checksumlength DATA

Why Would Anyone Use UDP? Fine control over what data is sent and when – As soon as app process writes into socket – … UDP will package data and send packet No delay for connection establishment – UDP blasts away without any formal preliminaries – … avoids introducing unnecessary delays No connection state (no buffers, sequence #’s, etc.) – Can scale to more active clients at once Small packet header overhead (header only 8B long) 6

Popular Applications That Use UDP Simple query protocols like DNS – Overhead of connection establishment is overkill – Easier to have the application retransmit if needed Multimedia streaming (VoIP, video conferencing, …) – Retransmitting lost/corrupted packets is not worthwhile – By time packet is retransmitted, it’s too late ” “ ” 7

Transmission Control Protocol (TCP) Stream-of-bytes service: Send/recv streams, not msgs Reliable, in-order delivery – Checksums to detect corrupted data – Sequence numbers to detect losses and reorder data – Acknowledgments & retransmissions for reliable delivery Connection oriented: Explicit set-up and tear-down Flow control: Prevent overload of receiver’s buffer Congestion control (next class!): Adapt for greater good 8

Breaking a Stream of Bytes into TCP Segments 9

TCP “Stream of Bytes” Service 10 Byte 0Byte 1 Byte 2Byte 3 Byte 0Byte 1Byte 2Byte 3 Host A Host B Byte 80

… Emulated Using TCP “Segments” 11 Byte 0Byte 1 Byte 2Byte 3 Byte 0Byte 1Byte 2Byte 3 Host A Host B Byte 80 TCP Data Byte 80 Segment sent when: 1.Segment full (Max Segment Size), 2.Not full, but times out, or 3.“Pushed” by application

TCP Segment IP packet – No bigger than Maximum Transmission Unit (MTU) – E.g., up to 1500 bytes on an Ethernet TCP packet – IP packet with a TCP header and data inside – TCP header is typically 20 bytes long TCP segment – No more than Maximum Segment Size (MSS) bytes – E.g., up to 1460 consecutive bytes from the stream 12 IP Hdr IP Data TCP HdrTCP Data (segment)

Sequence Number 13 Host A Host B TCP Data ISN (initial sequence number) Sequence number = 1 st byte Byte 81 Why not ISN of 0? Traditionally: Clock-based -What if port realloc’d and old packet in flight? -ISN based on clock, wraps around every 4.55 hr Now: Randomized -Hard to guess, thus harder to “hijack” TCP connection Why not ISN of 0? Traditionally: Clock-based -What if port realloc’d and old packet in flight? -ISN based on clock, wraps around every 4.55 hr Now: Randomized -Hard to guess, thus harder to “hijack” TCP connection

Reliable Delivery on a Lossy Channel With Bit Errors 14

An Analogy: Talking on a Cell Phone Alice and Bob talking on cell phones – If Bob couldn’t understand? Ask Alice to repeat – If Bob hasn’t heard for a while? Acknowledgments from receiver – Positive: “okay” or “uh huh” or “ACK” – Negative: “please repeat that” or “NACK” Timeout by the sender (“stop and wait”) – Don’t wait indefinitely w/o a response, whether ACK or NACK Retransmission by the sender – After receiving “NACK” from receiver – After receiving no feedback from receiver 15

Challenges of Reliable Data Transfer Over a perfectly reliable channel – All data arrives in order, just as sent. Simple. Over a channel with bit errors – All data arrives in order, but some bits corrupted – Receiver detects errors and says “please repeat that” – Sender retransmits corrupted data Over a lossy channel with bit errors – Some data is missing, and some bits are corrupted – Receiver detects errors but cannot always detect loss – Sender must wait for acknowledgment (“ACK” or “OK”) – … and retransmit data after some time if no ACK arrives 16

TCP Support for Reliable Delivery Detect bit errors: checksum – Used to detect corrupted data at the receiver – …leading the receiver to drop the packet Detect missing data: sequence number – Used to detect a gap in the stream of bytes –... and for putting the data back in order Recover from lost data: retransmission – Sender retransmits lost or corrupted data – Two main ways to detect lost packets 17

TCP Acknowledgments 18 Host A Host B TCP Data TCP HDR TCP HDR ISN (initial sequence number) Sequence number = 1 st byte ACK sequence # = next expected byte

Automatic Repeat reQuest (ARQ) 19 Time Packet ACK Timeout Automatic Repeat reQuest –Receiver sends ACK when it receives packet –Sender waits for ACK. –If ACK not received within some timeout period, resend packet Simplest: “stop and wait” –One packet at a time… SenderReceiver

Reasons for Retransmission 20 Packet ACK Timeout Packet ACK Timeout Packet Timeout Packet ACK Timeout Packet ACK Timeout Packet ACK Timeout ACK lost DUPLICATE PACKET Packet lostEarly timeout DUPLICATE PACKETS

How Long Should Sender Wait? Too short? Wasted retransmissions Too long? Excessive delays when packet lost TCP sets timeout as function of Round Trip Time – ACK should arrive after RTT + fudge factor for queuing How does sender know RTT? – Can estimate RTT by watching the ACKs – Smooth estimate: Exponentially-weighted moving avg (EWMA) EstimatedRTT = a * EstimatedRTT + (1–a) * SampleRTT – Compute timeout: TimeOut = 2 * EstimatedRTT 21

Example RTT Estimation 22

A Flaw in This Approach ACK acknowledges receipt to data, not transmission Consider a retransmission of a lost packet – If assume ACK with 1st transmission, SampleRTT too large Consider a duplicate packet – If assume ACK with 2nd transmission, SampleRTT too small Simple solution in the Karn/Partridge algorithm – Only collect samples for segments sent one single time 23

Increasing TCP throughput Problem: Stop-and-wait + timeouts are inefficient – Only one TCP segment “in flight” at time Solution: Send multiple packets at once Problem: How many w/o overwhelming receiver? Solution: Determine “window size” dynamically Flow Control via TCP Sliding Window 24

Motivation for Sliding Window Numerical example – 1.5 Mbps link with a 45 msec round-trip time (RTT) Delay-bandwidth product is 67.5 Kbits (or 8 KBytes) – But, sender can send at most one packet per RTT Assuming a segment size of 1 KB (8 Kbits) … leads to 8 Kbits/seg / 45 Msec/seg  182 Kbps Just one-eighth of the 1.5 Mbps link capacity 25

Sliding Window Allow a larger amount of data “in flight” – Sender can get ahead of receiver, though not too far 26 Sending processReceiving process Last byte ACKed Last byte sent TCP Next byte expected Last byte written Last byte read Last byte received

Receiver Buffering Window size – Amount that can be sent w/o ACK, because receiver can buffer Receiver advertises window to receiver – Tells amount of free space left (in bytes) – Sender agrees not to exceed this amount 27 Window Size Outstanding Un-ack’d data Data OK to send Data not OK to send yet Data ACK’d Sender

Solution to timeout inefficiency: Fast Retransmission Better solution possible under sliding window – Although packet n might have been lost – … packets n+1, n+2, and so on might get through Idea: “Duplicate ACKs” suggest loss – ACK says receiver is awaiting n th packet – Repeated ACKs suggest later packets have arrived – Sender use “duplicate ACKs” as early hint of loss Fast retransmission – Sender retransmits data after the triple duplicate ACK 28

Effectiveness of Fast Retransmit When does Fast Retransmit work best? – Long transfers: High likelihood of many pkts in flight – Large window: High likelihood of many packets in flight – Low loss burstiness: Higher likelihood that later pkts arrive Implications for Web traffic – Most Web objects are short (e.g., 10 packets) – So, often aren’t many packets in flight – … making fast retransmit less likely to “kick in” – … another reason for persistent connections! 29

Starting and Ending a Connection: TCP Handshakes 30

Establishing a TCP Connection Three-way handshake to establish connection – Host A sends a SYNchronize (open) to the host B – Host B returns a SYN ACKnowledgment (SYN ACK) – Host A sends an ACK to acknowledge the SYN ACK 31 SYN SYN ACK ACK Data AB Each host tells its ISN to other host

TCP Header 32 Source portDestination port Sequence number Acknowledgment Advertised window HdrLen Flags 0 ChecksumUrgent pointer Options (variable) Data Flags: SYN FIN RST PSH URG ACK

Step 1: A’s Initial SYN Packet 33 A’s Initial Sequence Number Acknowledgment Advertised window 20 Flags 0 ChecksumUrgent pointer Options (variable) A tells B it wants to open a connection… Flags: SYN FIN RST PSH URG ACK B’s portA’s port

Step 2: B’s SYN-ACK Packet 34 B’s portA’s port B’s Initial Sequence Number A’s ISN plus 1 Advertised window 20 Flags 0 ChecksumUrgent pointer Options (variable) B tells A it accepts, and is ready to hear the next byte… … upon receiving this packet, A can start sending data Flags: SYN FIN RST PSH URG ACK

Step 3: A’s ACK of the SYN-ACK 35 B’s ISN plus 1 Advertised window 20 Flags 0 ChecksumUrgent pointer Options (variable) A tells B it is okay to start sending… Sequence number Flags: SYN FIN RST PSH URG ACK B’s portA’s port … upon receiving this packet, B can start sending data

What if the SYN Packet Gets Lost? Suppose SYN packet gets lost – Packet lost inside network, or – Server rejects packet (e.g., listen queue is full) Eventually, no SYN-ACK arrives – Sender sets timer and waits, retransmitting if needed How should TCP sender set timer? – Sender has no estimate of RTT – Some TCP stacks use default of 3 or 6 seconds Why reload button in your browser is useful: Opens new connection and “retransmits” SYN in < 3-6 sec 36

Tearing Down the Connection 37 SYN SYN ACK ACK Data AB ACK FIN ACK FIN Setup Data Transfer Teardown Closing a connection – Process done writing: invokes close() – Once TCP sends all outstanding byte, TCP sends a FINish message Receiving a FINish – Process reading data from socket – Eventually, read attempt returns EOF Tear-down is two-way – FIN to close, but receive remaining – Other host ACKs the FIN – Rest (RST) to close and not receive remaining: error condition

38

Conclusions Transport protocols – Multiplexing and demultiplexing – Checksum-based error detection – Sequence numbers – Retransmission – Window-based flow control Next lecture – Congestion control 39