Lecture 5. Transport Layer. Transport Layer 1-1

Similar documents
Transport services and protocols. Chapter 3 outline. Internet transport-layer protocols Chapter 3 outline. Multiplexing/demultiplexing

CC451 Computer Networks

Chapter 3: Transport Layer

Chapter 3: Transport Layer Part A

Internet transport-layer protocols. Transport services and protocols. Sending and receiving. Connection-oriented (TCP) Connection-oriented

Suprakash Datta. Office: CSEB 3043 Phone: ext Course page:

CSE 4213: Computer Networks II

Transport layer: Outline

Chapter 3 Transport Layer

Transport layer. Our goals: Understand principles behind transport layer services: Learn about transport layer protocols in the Internet:

Chapter 3 outline. TDTS06 Computer networks. Principles of Reliable data transfer. Reliable data transfer: getting started

Distributed Systems. 5. Transport Protocols

Chapter 3 Transport Layer

Distributed Systems. 5. Transport Protocols. Werner Nutt

COSC4377. Useful Linux Tool: screen

Chapter 3 Transport Layer

Chapter 3: Transport Layer. Chapter 3 Transport Layer. Chapter 3 outline. Transport services and protocols

32 bits. source port # dest port # sequence number acknowledgement number not used. checksum. Options (variable length)

Computer Networking: A Top Down Approach

CSC358 Week 4. Adapted from slides by J.F. Kurose and K. W. Ross. All material copyright J.F Kurose and K.W. Ross, All Rights Reserved

CSCD 330 Network Programming

TDTS06: Computer Networks

Chapter 3 outline. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management

Computer Networks & Security 2016/2017

Correcting mistakes. TCP: Overview RFCs: 793, 1122, 1323, 2018, TCP seq. # s and ACKs. GBN in action. TCP segment structure

Chapter 3 Transport Layer

Lecture 07 The Transport Layer (TCP & UDP) Dr. Anis Koubaa

Announcement. Homework 1 due last night, how is that? Will discuss some problems in the lecture next week

CMSC 332 Computer Networks Reliable Data Transfer

CSC 4900 Computer Networks: Reliable Data Transport

Foundations of Telematics

Lecture 08: The Transport Layer (Part 2) The Transport Layer Protocol (TCP) Dr. Anis Koubaa

Computer Communication Networks Midterm Review

Transport Layer: outline

LECTURE 3 - TRANSPORT LAYER

RSC Part III: Transport Layer 3. TCP

By Ossi Mokryn, Based also on slides from: the Computer Networking: A Top Down Approach Featuring the Internet by Kurose and Ross

Chapter 3 Transport Layer

Chapter 3 Transport Layer

CSC 8560 Computer Networks: Transport Layer

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 8

Chapter 3 outline. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 9

Lecture 3 The Transport Control Protocol (TCP) Antonio Cianfrani DIET Department Networking Group netlab.uniroma1.it

Computer Networking Introduction

CS 3516: Advanced Computer Networks

Chapter III: Transport Layer

rdt2.0 has a fatal flaw!

Chapter 6 Transport Layer

Transport Layer: Outline

10 minutes survey (anonymous)

Application. Transport. Network. Link. Physical

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

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 7

Chapter 3 Transport Layer

Chapter 3 outline. Chapter 3: Transport Layer. Transport vs. network layer. Transport services and protocols. Internet transport-layer protocols

CSCD 330 Network Programming

Transport layer. UDP: User Datagram Protocol [RFC 768] Review principles: Instantiation in the Internet UDP TCP

Transport layer. Review principles: Instantiation in the Internet UDP TCP. Reliable data transfer Flow control Congestion control

Course on Computer Communication and Networks. Lecture 4 Chapter 3; Transport Layer, Part A

Fall 2012: FCM 708 Bridge Foundation I

Chapter 3 Transport Layer

CSC 4900 Computer Networks: TCP

CS 4390 Computer Networks. Pointers to Corresponding Section of Textbook

CNT 6885 Network Review on Transport Layer

CSE 3214: Computer Network Protocols and Applications Transport Layer (Part 2) Chapter 3 outline. UDP checksum. Port numbers

The Transport Layer Multiplexing, Error Detection, & UDP

COMP 431 Internet Services & Protocols. Transport Layer Protocols & Services Outline. The Transport Layer Reliable data delivery & flow control in TCP

Course on Computer Communication and Networks. Lecture 4 Chapter 3; Transport Layer, Part A

Chapter 3 Transport Layer

Master Course Computer Networks IN2097

Lecture 8. TCP/IP Transport Layer (2)

Chapter 3- parte B outline

Chapter III: Transport Layer

CSC 401 Data and Computer Communications Networks

Chapter 3 Transport Layer

Chapter 3 outline. 3.5 Connection-oriented transport: TCP. 3.6 Principles of congestion control 3.7 TCP congestion control

CC451 Computer Networks

The Transport Layer: TCP & Reliable Data Transfer

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, Development of reliable protocol Sliding window protocols

TCP. TCP: Overview. TCP Segment Structure. Maximum Segment Size (MSS) Computer Networks 10/19/2009. CSC 257/457 - Fall

Lecture 11: Transport Layer Reliable Data Transfer and TCP

Chapter 2: outline. 2.1 principles of network applications app architectures app requirements

Chapter III: Transport Layer

CS Lecture 1 Review of Basic Protocols

Go-Back-N. Pipelining: increased utilization. Pipelined protocols. GBN: sender extended FSM

CS 655 System and Network Architectures and Implementation. Module 3 - Transport

Chapter 3 Transport Layer

Lecture 9: Transpor Layer Overview and UDP

TCP (Part 2) Session 10 INST 346 Technologies, Infrastructure and Architecture

Rdt2.0: channel with packet errors (no loss!)

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, steam: r Development of reliable protocol r Sliding window protocols

Lecture 10: Transpor Layer Principles of Reliable Data Transfer

CS450 Introduc0on to Networking Lecture 14 TCP. Phu Phung Feb 13, 2015

Chapter 3: Transport Layer. Chapter 3 Transport Layer. Chapter 3 outline. Transport services and protocols

Chapter 3 Transport Layer

CS 4390 Computer Networks. Transport Services and Protocols

Chapter 3 Transport Layer

Computer Networks 1 (Mạng Máy Tính 1) Lectured by: Dr. Phạm Trần Vũ

Computer Communication Networks Midterm Review

Transcription:

Lecture 5 Transport Layer Transport Layer 1-1

Agenda The Transport Layer (TL) Introduction to TL Protocols and Services Connectionless and Connection-oriented Processes in TL Unreliable Data Transfer User Datagram Protocol (UDP) Reliable Data Transfer Transport Control Protocol (TCP) Flow Control Reliable channels Channels with errors and losses Transport Layer 1-2

Introduction: Transport Services and Protocols provide logical end-to-end communication between app processes running on different hosts transport protocols run in end systems send side: breaks application messages into segments, passes to the network layer receiving side: reassembles segments into messages, passes to app layer more than one transport protocol available to applications Internet: TCP and UDP application transport network data link physical application transport network data link physical Transport Layer 1-3

Transport vs. Network layer network layer: logical communication between hosts related to the network core (infrastructure) transport layer: logical communication between processes relies on and enhances network layer services related to network edge (i.e., intelligent end systems or hosts) and running applications (i.e., adopted syntax, semantics, platform, QoS requirements of applications) Transport Layer 1-4

Transport Layer Protocols reliable, in-order delivery: Transport Control Protocol (TCP) flow control congestion control connection setup unreliable, unordered delivery: User Datagram Protocol (UDP) no-frills extension of besteffort IP services not available: delay guarantees Bandwidth guarantees May be losses application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical application transport network data link physical Transport Layer 1-5

Multiplexing/Demultiplexing Demultiplexing at rcv host: delivering received segments to correct socket = socket = process Multiplexing at send host: gathering data from multiple sockets, enveloping data with header (later used for demultiplexing) application P3 P1 P1 application P2 P4 application transport transport transport network network network link link link physical physical host 1 host 2 host 3 physical Transport Layer 1-6

How Demultiplexing Works host receives IP datagrams each datagram has source IP address, destination IP address each datagram carries 1 transport-layer segment each segment has source, destination port number host uses IP addresses & port numbers to direct segment to appropriate socket (it is called sometimes socket address) 32 bits source port # dest port # other header fields application data (message) TCP/UDP segment format Transport Layer 1-7

Connectionless Demux. vs. Connection-oriented Demux. Connectionless-oriented Demux. UDP socket identified by two-tuple: (dest IP address, dest port number) When host receives UDP segment: checks destination port number in segment directs UDP segment to socket with that port number IP datagrams with different source IP addresses and/or source port numbers directed to same socket Connection-oriented Demux. TCP socket identified by 4-tuple: source IP address source port number dest IP address dest port number receiving host uses all four values to direct segment to appropriate socket Transport Layer 1-8

Connectionless Demux, UDP DatagramSocket serversocket = new DatagramSocket(6428); P2 P3 P1 P1 SP: 6428 DP: 9157 SP: 6428 DP: 5775 SP: 9157 SP: 5775 client IP: A DP: 6428 server IP: C DP: 6428 Client IP:B SP provides return address Transport Layer 1-9

Connection-oriented Demux., TCP P1 P4 P5 P6 P2 P1 P3 SP: 5775 DP: 80 S-IP: B D-IP:C SP: 9157 SP: 9157 client IP: A DP: 80 S-IP: A D-IP:C server IP: C DP: 80 S-IP: B D-IP:C Client IP:B Transport Layer 1-10

UDP: User Datagram Protocol [RFC 768] no frills, bare bones Internet transport protocol best effort service, UDP segments may be: lost delivered out of order to the application layer connectionless: no handshaking between UDP sender, receiver each UDP segment handled independently of others Why is there a UDP? no connection establishment (which can add delay) simple: no connection state at sender, receiver small segment header no congestion control: UDP can blast away as fast as desired Transport Layer 1-11

More about UDP often used for streaming multimedia apps loss tolerant rate sensitive other UDP uses DNS SNMP reliable transfer over UDP: add reliability at application layer application-specific error recovery! Length, in bytes of UDP segment, including header 32 bits source port # dest port # length Application data (message) checksum UDP segment format Transport Layer 1-12

UDP Checksum Goal: detect errors (e.g., flipped bits) in transmitted segment Sender: treat segment contents as sequence of 16-bit integers checksum: addition (1 s complement sum) of segment contents sender puts checksum value into UDP checksum field Receiver: compute checksum of received segment check if computed checksum equals checksum field value: NO - error detected YES - no error detected. But maybe errors nonetheless?. Transport Layer 1-13

Principles of Reliable Data Transfer important in app., transport, link layers top-10 list of important networking topics! characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) Transport Layer 1-14

Rdt1.0: reliable transfer over a reliable channel underlying channel perfectly reliable no bit errors no loss of packets separate finite state machines for sender, receiver: sender sends data into underlying channel receiver read data from underlying channel Wait for call from above rdt_send(data) packet = make_pkt(data) udt_send(packet) Wait for call from below rdt_rcv(packet) extract (packet,data) deliver_data(data) sender receiver Transport Layer 1-15

Rdt2.0: channel with bit errors underlying channel may flip bits in packet (pkt) checksum to detect bit errors the question: how to recover from errors? acknowledgements (ACKs): receiver explicitly tells sender that pkt received OK negative acknowledgements (NAKs): receiver explicitly tells sender that pkt had errors sender retransmits pkt on receipt of NAK new mechanisms in rdt2.0 (beyond rdt1.0): error detection receiver feedback: control msgs (ACK,NAK) rcvr->sender Transport Layer 1-16

rdt2.0 has a fatal flaw! What happens if ACK/NAK corrupted? sender doesn t know what happened at receiver! can t just retransmit: possible duplicate Handling duplicates: sender retransmits current pkt if ACK/NAK garbled sender adds sequence number to each pkt receiver discards (doesn t deliver up) duplicate pkt stop and wait Sender sends one packet, then waits for receiver response Transport Layer 1-17

rdt2.1: discussion Sender and receiver can handle garbled ACK/NAKs Sender: seq # added to pkt two seq. # s (0,1) will suffice. Why? must check if received ACK/NAK corrupted twice as many states state must remember whether current pkt has 0 or 1 seq. # Receiver: must check if received packet is duplicate state indicates whether 0 or 1 is expected pkt seq # note: receiver can not know if its last ACK/NAK received OK at sender Transport Layer 1-18

rdt2.2: a NAK-free protocol same functionality as rdt2.1, using ACKs only instead of NAK, receiver sends ACK for last pkt received OK receiver must explicitly include seq # of pkt being ACKed duplicate ACK at sender results in same action as NAK: retransmit current pkt Transport Layer 1-19

rdt3.0: channels with errors and loss New assumption: underlying channel can also lose packets (data or ACKs) checksum, seq. #, ACKs, retransmissions will be of help, but not enough Approach: sender waits reasonable amount of time for ACK retransmits if no ACK received in this time if pkt (or ACK) just delayed (not lost): retransmission will be duplicate, but use of seq. # s already handles this receiver must specify seq # of pkt being ACKed requires countdown timer Transport Layer 1-20

rdt3.0 in action Transport Layer 1-21

Performance of rdt3.0 rdt3.0 works, but performance stinks Example: 1 Gbps link, 15 ms propagation delay (i.e., RTT = 30 ms), 8000 bit packet: L 8000bits d trans 8microseconds R 9 10 bps U sender : utilization fraction of time sender busy sending U sender = L / R RTT + L / R =.008 30.008 = 0.00027 microsec 1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link network protocol limits use of physical resources! Transport Layer 1-22

rdt3.0: stop-and-wait operation first packet bit transmitted, t = 0 last packet bit transmitted, t = L / R sender receiver RTT first packet bit arrives last packet bit arrives, send ACK ACK arrives, send next packet, t = RTT + L / R U sender = L / R RTT + L / R =.008 30.008 = 0.00027 microsec Transport Layer 1-23

Pipelined protocols Pipelining: sender allows multiple, in-flight, yet-tobe-acknowledged pkts range of sequence numbers must be increased buffering at sender and/or receiver Two generic forms of pipelined protocols: go-back-n, selective repeat Transport Layer 1-24

Pipelining: increased utilization first packet bit transmitted, t = 0 last bit transmitted, t = L / R sender receiver RTT ACK arrives, send next packet, t = RTT + L / R first packet bit arrives last packet bit arrives, send ACK last bit of 2 nd packet arrives, send ACK last bit of 3 rd packet arrives, send ACK Increase utilization by a factor of 3! U sender = 3 * L / R RTT + L / R =.024 30.008 = 0.0008 microsecon Transport Layer 1-25

Pipelining Protocols Go-back-N: big picture: Sender can have up to N unacked packets in pipeline Rcvr only sends cumulative acks Doesn t ack packet if there s a gap Sender has timer for oldest unacked packet If timer expires, retransmit all unacked packets Selective Repeat: big pic Sender can have up to N unacked packets in pipeline Rcvr acks individual packets Sender maintains timer for each unacked packet When timer expires, retransmit only unack packet Transport Layer 1-26

Go-Back-N or GBN Sender: k-bit seq # in pkt header window of up to N, consecutive unack ed pkts allowed ACK(n): ACKs all pkts up to, including seq # n - cumulative ACK may receive duplicate ACKs (see receiver) timer for each in-flight pkt timeout(n): retransmit pkt n and all higher seq # pkts in window Transport Layer 1-27

GBN in action Transport Layer 1-28

Selective Repeat receiver individually acknowledges all correctly received pkts buffers pkts, as needed, for eventual in-order delivery to upper layer sender only resends pkts for which ACK not received sender timer for each unacked pkt sender window N consecutive seq # s again limits seq #s of sent, unacked pkts Transport Layer 1-29

Selective Repeat: sender, receiver windows Transport Layer 1-30

Selective Repeat in action sender data from above : if next available seq # in window, send pkt timeout(n): resend pkt n, restart timer ACK(n) in [sendbase,sendbase+n]: mark pkt n as received if n smallest unacked pkt, advance window base to next unacked seq # receiver pkt n in [rcvbase, rcvbase+n-1] send ACK(n) out-of-order: buffer in-order: deliver (also deliver buffered, in-order pkts), advance window to next not-yet-received pkt pkt n in [rcvbase-n,rcvbase-1] ACK(n) otherwise: ignore Transport Layer 1-31

Selective Repeat in action Transport Layer 1-32

CONNECTION-ORIENTED TRANSPORT TCP Transport Layer 1-33

TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 socket door point-to-point: one sender, one receiver reliable, in-order byte steam: no message boundaries pipelined: TCP congestion and flow control set window size send & receive buffers application writes data TCP send buffer segment application reads data TCP receive buffer socket door full duplex data: bi-directional data flow in same connection MSS: maximum segment size connection-oriented: handshaking (exchange of control msgs) between sender and receiver flow controlled: sender will not overwhelm receiver Transport Layer 3-34

TCP segment structure URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now (generally not used) RST, SYN, FIN: connection estab (setup, teardown commands) Internet checksum (as in UDP) 32 bits source port # dest port # head len sequence number acknowledgement number not used U A P R S F checksum Receive window Urg data pnter Options (variable length) application data (variable length) counting by bytes of data (not segments!) # bytes rcvr willing to accept Transport Layer 3-35

TCP seq. # s and ACKs Seq. # s: ACKs: byte stream number of first byte in segment s data seq # of next byte expected from other side cumulative ACK User types C host ACKs receipt of echoed C Host A Host B host ACKs receipt of C, echoes back C simple telnet scenario time Transport Layer 3-36

TCP Round Trip Time and Timeout Q: how to set TCP timeout value? 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 until ACK receipt ignore retransmissions SampleRTT will vary, want estimated RTT smoother average several recent measurements, not just current SampleRTT Set timeout = average + safe margin Transport Layer 3-37

RTT (milliseconds) TCP Round Trip Time and Timeout EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT Exponential weighted moving average influence of past sample decreases exponentially fast typical value: = 0.125 RTT: gaia.cs.umass.edu to fantasia.eurecom.fr 350 300 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-38

TCP reliable data transfer TCP creates rdt service on top of IP s unreliable service Pipelined segments Cumulative ACKs TCP uses single retransmission timer Retransmissions are triggered by: timeout events duplicate ACKs Transport Layer 3-39

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 (think of timer as for oldest unacked segment) expiration interval: TimeOutInterval timeout: retransmit segment that caused timeout restart timer Ack rcvd: If acknowledges previously unacked segments update what is known to be acked start timer if there are outstanding segments Transport Layer 3-40

Seq=92 timeout timeout Seq=92 timeout TCP: retransmission scenarios Host A Host B Host A Host B X loss Sendbase = 100 SendBase = 120 SendBase = 100 time lost ACK scenario SendBase = 120 time premature timeout Transport Layer 3-41

timeout TCP retransmission scenarios (more) Host A Host B X loss SendBase = 120 time Cumulative ACK scenario Transport Layer 3-42

Fast Retransmit Time-out period often relatively long: long delay before resending lost packet Detect lost segments via duplicate ACKs. Sender often sends many segments back-toback 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 ACKed data was lost: fast retransmit: resend segment before timer expires Transport Layer 3-43

timeout Host A Host B Fast Retransmit X Packets time Resending a segment after triple duplicate ACK 1 2 3 4 5 2 Acknowledgements (waiting seq#) 2 2 2 2 Transport Layer 3-44

Quiz Which of the following is true about different unicast routing protocols: - Link-state protocols do not suffer from the count-to-infinity problem. - BGP always uses the shortest path (in terms of router hops) between two nodes. Transport Layer 1-45

Lecture Summary Covered material The Transport Layer (TL) Introduction to TL Protocols and Services Connectionless and Connection-oriented Demultiplexing Processes in TL Unreliable Data Transfer User Datagram Protocol (UDP) Reliable Data Transfer Transport Control Protocol (TCP) Reliable channels Channels with errors and losses Material to be covered next lecture Continue the Transport Layer Introduction to the Application Layer Transport Layer 1-46