TCP Review. CS144 Review Session 4 April 25, 2008 Ben Nham

Similar documents
Fall 2012: FCM 708 Bridge Foundation I

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

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

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

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

Chapter 3- parte B outline

Transport Layer: outline

Transport Layer PREPARED BY AHMED ABDEL-RAOUF

CS321: Computer Networks Error and Flow Control in TCP

Computer Communication Networks Midterm Review

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

CSC 401 Data and Computer Communications Networks

Lecture 20 Overview. Last Lecture. This Lecture. Next Lecture. Transport Control Protocol (1) Transport Control Protocol (2) Source: chapters 23, 24

The Transport Layer: TCP & Reliable Data Transfer

10 minutes survey (anonymous)

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

Transport Layer: Outline

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

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

Chapter 3 Transport Layer

TCP. 1 Administrivia. Tom Kelliher, CS 325. Apr. 2, Announcements. Assignment. Read From Last Time

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

CS457 Transport Protocols. CS 457 Fall 2014

CS 4390 Computer Networks. Pointers to Corresponding Section of Textbook

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

Transmission Control Protocol (TCP)

Computer Networking Introduction

Chapter III: Transport Layer

CS118 Discussion 1A, Week 4. Zengwen Yuan Dodd Hall 78, Friday 10:00 11:50 a.m.

TCP : Fundamentals of Computer Networks Bill Nace

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

Chapter III: Transport Layer

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

Transmission Control Protocol. ITS 413 Internet Technologies and Applications

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

TCP Review. Carey Williamson Department of Computer Science University of Calgary Winter 2018

Review Questions for Midterm Exam-2 Fall 2016

Chapter 3 Transport Layer

ICS 451: Today's plan. Sliding Window Reliable Transmission Acknowledgements Windows and Bandwidth-Delay Product Retransmission Timers Connections

05 Transmission Control Protocol (TCP)

RSC Part III: Transport Layer 3. TCP

User Datagram Protocol

Lecture 8. TCP/IP Transport Layer (2)

CS 43: Computer Networks. 18: Transmission Control Protocol October 12-29, 2018

CSCD 330 Network Programming

CSC 4900 Computer Networks: TCP

6.1 Internet Transport Layer Architecture 6.2 UDP (User Datagram Protocol) 6.3 TCP (Transmission Control Protocol) 6. Transport Layer 6-1

Transport Layer. Application / Transport Interface. Transport Layer Services. Transport Layer Connections

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

Reliable Transport II: TCP and Congestion Control

CSCE 463/612 Networks and Distributed Processing Spring 2017

COMP/ELEC 429/556 Introduction to Computer Networks

Transport Protocols and TCP

CS Lecture 1 Review of Basic Protocols

CS 43: Computer Networks. 19: TCP Flow and Congestion Control October 31, Nov 2, 2018

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

CSE 4213: Computer Networks II

Lecture 3: The Transport Layer: UDP and TCP

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

Congestion / Flow Control in TCP

Transport Protocols. Raj Jain. Washington University in St. Louis

TCP Service Model. Today s Lecture. TCP Support for Reliable Delivery. EE 122:TCP, Connection Setup, Reliability

TCP: Overview RFCs: 793,1122,1323, 2018, 2581

Department of Computer and IT Engineering University of Kurdistan. Transport Layer. By: Dr. Alireza Abdollahpouri

Flow and Congestion Control Marcos Vieira

Networking Technologies and Applications

Kent State University

Chapter 3 Transport Layer

CNT 6885 Network Review on Transport Layer

CC451 Computer Networks

Computer Communication Networks Midterm Review

Transport Layer. -UDP (User Datagram Protocol) -TCP (Transport Control Protocol)

Flow and Congestion Control (Hosts)

Reliable Transport II: TCP and Congestion Control

ECE 333: Introduction to Communication Networks Fall 2001

Chapter 3 Transport Layer

Chapter 3 Review Questions

Connection-oriented (virtual circuit) Reliable Transfer Buffered Transfer Unstructured Stream Full Duplex Point-to-point Connection End-to-end service

TSIN02 - Internetworking

CSC 8560 Computer Networks: TCP

Transport Layer Marcos Vieira

7. TCP 최양희서울대학교컴퓨터공학부

TCP. CSU CS557, Spring 2018 Instructor: Lorenzo De Carli (Slides by Christos Papadopoulos, remixed by Lorenzo De Carli)

Chapter 24. Transport-Layer Protocols

QUIZ: Longest Matching Prefix

Homework 3 50 points. 1. Computing TCP's RTT and timeout values (10 points)

Sequence Number. Acknowledgment Number. Data

TCP Overview. Connection-oriented Byte-stream

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2. Goals for Todayʼs Lecture. Role of Transport Layer

TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581

Multiple unconnected networks

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

ECE 435 Network Engineering Lecture 10

23-3 TCP. Topics discussed in this section: TCP Services TCP Features Segment A TCP Connection Flow Control Error Control 23.22

The Transport Layer: Review

TSIN02 - Internetworking

TSIN02 - Internetworking

TSIN02 - Internetworking

file:///c:/users/hpguo/dropbox/website/teaching/fall 2017/CS4470/H...

Transcription:

TCP Review CS144 Review Session 4 April 25, 2008 Ben Nham

Announcements Upcoming dates Wed, 4/30: Lab 3 due, Lab 4 out Fri, 5/2: Midterm Review Mon, 5/5: In class midterm Wed, 5/14: Lab 4 due Lab 3 is more complex than Lab 1 or Lab 2, so start now

TCP Overview Network layer protocol ProperRes Full duplex connecron Two way communicaron between (IP, port) src and (IP, port) dst ConnecRon setup before any transfer ConnecRon teardown aver transfer finishes Each connecron creates state in sending and receiving hosts How is this different than with a VC network? Reliable: resends lost/corrupted segments In order: buffers at sender and receiver Stream of bytes: looks like a file you can R/W to

TCP Segments Provide illusion of a stream of bytes, but we actually are going over a datagram network using packets (IP) Data is carried in TCP segments and placed into an IP packet HLEN 4 Src port RSVD IP Data TCP Data Sequence # Ack Sequence # URG ACK PSH RST SYN FIN Dst port 6 Window Size Checksum (TCP OpRons) TCP Hdr Urg Pointer IP Hdr 0 15 31 TCP Data Credit: CS244A Handout 8

Sequence Numbers ISN (iniral sequence number) Host A Seq number = First byte of segment TCP Data TCP Hdr Ack seq number = next expected byte TCP Data TCP Hdr Host B Credit: CS244A Handout 8

Three Way Handshake Exchange iniral sequence numbers at connecron startup Client SYN SEQ = x Server Client s ISN = x Server s ISN = y Send a special segment with SYN bit set ( synchronize ) SYN takes up one byte

Shutdown Either side can inirate shutdown Can shutdown only one side of connecron, if desired TIME_WAIT state to handle case of whether last ACK was lost FIN SEQ = v

Sockets and TCP socket, bind connect SYN SYN/ACK ACK socket, bind listen accept send/recv send/recv shutdown (SHUT_RDWR) FIN ACK FIN ACK shutdown (SHUT_RDWR)

Sender Window Window size: maximum amount of unacked bytes/segments Usually dynamically adjusted in response to congesron Must be smaller than receiver window Local state maintained at sender Sender Round Trip Time Window Size ACK ACK ACK Receiver Window Size Credit: CS244A Handout 8

Example: Ideal TCP Transfer Rate Assume an ideal TCP connecron between two hosts A and B. What is the maximum transmission rate between the two hosts in terms of: W, the window size in bytes RTT, the round trip Rme R, the transmission rate of the link

SoluRon: Ideal TCP Transfer Rate Window Size Round Trip Time Window Size RTT Window Size Sender Receiver ACK ACK ACK ACK (1) RTT > Window Size (2) RTT = Window Size So ideal transfer rate is W/RTT independent of link BW! Credit: CS244A Handout 8

Receiver Window AdverRsed to sender in TCP header Amount of out of order bytes the receiver will buffer Sender window cannot be larger than adverrsed receiver window Example RecvWind = receiver window in bytes Last ack to sequence number x Then receiver will buffer any bytes in the sequence number range [x, x+recvwind)

Example: TCP RST Arack Suppose we have a long lived TCP connecron (like a BGP session), and we want to maliciously terminate it Suppose we know the IP and port numbers for both sides of the connecron Then sending a TCP RST packet will immediately terminate the session Given a receiver window size of 8K, what is the chance that a RST packet with a random sequence number will terminate the connecron? How many RST packets are needed to span the enrre sequence number space? Using 58 byte RST packets on a 10 Mbps link, how long does it take to generate this number of packets?

SoluRon: TCP RST Arack Given a receiver window size of 8K, what is the chance that a RST packet with a random sequence number will terminate the connecron? 2 13 /2 32 = 2 19 = 1 in half a million chance How many RST packets are needed to span the enrre sequence number space? 2 19 packets Using 58 byte RST packets on a 10 Mbps link, how long does it take to generate this number of packets? 2 19 packets * 58 bytes/packet * 8 bits/byte / 10 Mbps = 24 seconds

Flow Control Don t want to overwhelm the network or the receiver with packets Adjust cwnd (congesron window) dynamically in response to loss events Sender window = min(cwnd, rwnd) CongesRon window resized using AIMD When connecron starts, start with window size of 1 As long as segments are acked: Increase window size by 1 segment size every RTT (addirve increase) If loss is detected: Halve window size (mulrplicarve decrease)

TCP Sawtooth Timeouts Window Size halved t Src D A D D A A D D D A A A Dest Credit: CS244A Handout 8

OpRmizaRons Slow start iniralizaron Increase cwnd by MSS for every ack (doubles cwnd for every RTT) Suppose we detect first loss at window size W Set ssthresh := W/2 Set cwnd := 1 Use slow start unrl our window size is ssthresh Then use AIMD (congesron avoidance mode) Fast retransmit and fast recovery if we get three duplicate acks during slow start Suppose we send 1, 2, 3, 4, 5,, 8, 9, 10 Get acks 1, 2, 3, 4, 5,, 8, 8, 8 Probably 9 th segment has been lost, so: Resend it before retransmit Rmer expires (fast retransmit) Set cwnd := ssthresh rather than 1 and go into AIMD (fast recovery)

TCP Sawtooth With OpRmizaRons Triple Dup Ack Loss Window Size Loss halved t Slow Start Slow Start Credit: CS244A Handout 8

Example: Reaching Maximum CongesRon Window Size with Slow Start Assume this TCP implementaron: MSS = 125 bytes RTT is fixed at 100 ms (even when buffers start filling) Uses slow start with AIMD Analyze one flow between A and B, where borleneck link is 10 Mbps Ignore receiver window What is the maximum congesron window size? For one flow (ideally), W/RTT = rate W = (100 ms * 10 Mbps) / (8 bits/byte) = 125000 bytes How long does it take to reach this size? Slow start grows cwnd exponenrally, starrng from one MSS Find n s.t. 125 * 2 n >= 125000 n = 10 Then it takes n * RTT = 1 s to reach the max cwnd size

DetecRng Losses Each segment sent has a retransmit Rmer If a segment s retransmit Rmer expires before ack for that segment arrive, assume loss Retransmission Rmeout (RTO) for Rmer based on exponenral weighted moving average of the previous RTTs and variance between RTT samples EstRTT k = (1 α) EstRTT k 1 + α SampleRTT k Recommended α is 0.125 EstRTT is an EWMA of the SampleRTT DevRTT k = (1 β ) DevRTT k 1 + β SampleRTT k EstRTT k Recommended β is 0.25 DevRTT is an EWMA of the difference between sampled and esrmated RTT RTO = EstRTT + 4 DevRTT

Lab 3 OperaRon ACK packets STDIN Client handle_pkt handle_ack Server STDOUT Send Buffer Receiver State Rmer Data packets handle_pkt