CSCI-1680 Transport Layer I Rodrigo Fonseca

Similar documents
CSCI-1680 Transport Layer I Rodrigo Fonseca

Introduc)on to Computer Networks

Transport Layer Marcos Vieira

Connections. Topics. Focus. Presentation Session. Application. Data Link. Transport. Physical. Network

Some slides courtesy David Wetherall. Communications Software. Lecture 4: Connections and Flow Control. CSE 123b. Spring 2003.

CS419: Computer Networks. Lecture 10, Part 2: Apr 11, 2005 Transport: TCP mechanics (RFCs: 793, 1122, 1323, 2018, 2581)

TCP Overview. Connection-oriented Byte-stream

Reliable Byte-Stream (TCP)

CSE/EE 461 Lecture 14. Connections. Last Time. This Time. We began on the Transport layer. Focus How do we send information reliably?

Chapter 5 End-to-End Protocols

User Datagram Protocol

Last Class. CSE 123b Communications Software. Today. Naming Processes/Services. Transmission Control Protocol (TCP) Picking Port Numbers.

Internet transport protocols

Mobile Transport Layer Lesson 02 TCP Data Stream and Data Delivery

Application Service Models

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

CSE 461 Module 11. Connections

End-to-End Protocols. End-to-End Protocols

Transport Layer. <protocol, local-addr,local-port,foreign-addr,foreign-port> ϒ Client uses ephemeral ports /10 Joseph Cordina 2005

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

Introduc)on to Computer Networks

CSE 461 The Transport Layer

Internet Protocols Fall Outline

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

Lecture 3: The Transport Layer: UDP and TCP

ECE 435 Network Engineering Lecture 15

CSE/EE 461 Lecture 13 Connections and Fragmentation. TCP Connection Management

Transport: How Applications Communicate

Networking Technologies and Applications

TCP: Transmission Control Protocol UDP: User Datagram Protocol TCP - 1

ECE 650 Systems Programming & Engineering. Spring 2018

6. The Transport Layer and protocols

CSE/EE 461 Lecture 12 TCP. A brief Internet history...

CSCI-131 Networking: the End-to-End Layer. Rodrigo Fonseca March 12 th, 2013

CS 356: Computer Network Architectures. Lecture 17: End-to-end Protocols and Lab 3 Chapter 5.1, 5.2. Xiaowei Yang

TCP: Transmission Control Protocol RFC 793,1122,1223. Prof. Lin Weiguo Copyleft 2009~2017, School of Computing, CUC

TSIN02 - Internetworking

CSC 401 Data and Computer Communications Networks

Lenuta Alboaie Computer Networks

CCNA R&S: Introduction to Networks. Chapter 7: The Transport Layer

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4021: Networks Discussion. Chapter 5 - Part 2

UDP and TCP. Introduction. So far we have studied some data link layer protocols such as PPP which are responsible for getting data

CSE 461 Connections. David Wetherall

End-to-End Protocols: UDP and TCP. Hui Chen, Ph.D. Dept. of Engineering & Computer Science Virginia State University Petersburg, VA 23806

TSIN02 - Internetworking

Computer Networking Introduction

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

CSEP 561 Connections. David Wetherall

COMPUTER NETWORKS CS CS 55201

COMPUTER NETWORKS CS CS 55201

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

NETWORK PROGRAMMING. Instructor: Junaid Tariq, Lecturer, Department of Computer Science

Outline Computer Networking. Functionality Split. Transport Protocols

TSIN02 - Internetworking

Simulation of TCP Layer

EEC-682/782 Computer Networks I

10 minutes survey (anonymous)

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

CS4700/CS5700 Fundamentals of Computer Networks

UNIT IV TRANSPORT LAYER

OSI Transport Layer. objectives

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

TCP : Fundamentals of Computer Networks Bill Nace

TSIN02 - Internetworking

Chapter 3 Transport Layer

CSEP 561 Connections. David Wetherall

05 Transmission Control Protocol (TCP)

CSCI-GA Operating Systems. Networking. Hubertus Franke

Chapter III: Transport Layer

Chapter 3 Transport Layer

Introduction to TCP/IP networking

EE 122: Transport Protocols: UDP and TCP

Fundamentals of Computer Networks ECE 478/578. Transport Layer. End- to- End Protocols 4/16/13. Spring Application. Application.

Two approaches to Flow Control. Cranking up to speed. Sliding windows in action

SWITCHING, FORWARDING, AND ROUTING

TCP /IP Fundamentals Mr. Cantu

Information Network 1 TCP 1/2

Kent State University

TCP/IP Networking. Part 4: Network and Transport Layer Protocols

Applied Networks & Security

ITS323: Introduction to Data Communications

Transmission Control Protocol (TCP)

QUIZ: Longest Matching Prefix

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

Problem. Chapter Outline. Chapter Goal. End-to-end Protocols. End-to-end Protocols. Chapter 5. End-to-End Protocols

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

Guide To TCP/IP, Second Edition UDP Header Source Port Number (16 bits) IP HEADER Protocol Field = 17 Destination Port Number (16 bit) 15 16

Introduction to Networking. Operating Systems In Depth XXVII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

UNIT V. Computer Networks [10MCA32] 1

Introduction to Networks and the Internet

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

Network Technology 1 5th - Transport Protocol. Mario Lombardo -

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

Transmission Control Protocol (TCP)

ECE 435 Network Engineering Lecture 9

User Datagram Protocol (UDP):

Computer Networks. Transmission Control Protocol. Jianping Pan Spring /3/17 CSC361 1

Chapter 7. The Transport Layer

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

CSCI-1680 Transport Layer II Data over TCP Rodrigo Fonseca

Transcription:

CSCI-1680 Transport Layer I Rodrigo Fonseca Based partly on lecture notes by David Mazières, Phil Levis, John Janno<

Today Transport Layer UDP TCP Intro Connection Establishment

Transport Layer "#$ -##$ ). #"#$ #%$ &'$ ($ Transport protocols sit on top of network layer Problem solved: communication among processes! )*# + )*#, )*#! Application-level multiplexing ( ports ) Error detection, reliability, etc.

UDP User Datagram Protocol Unreliable, unordered datagram service Adds multiplexing, checksum End points identified by ports Scope is an IP address (interface) Checksum aids in error detection

UDP Header 0 16 31 SrcPort Length DstPort Checksum Data

UDP Checksum Uses the same algorithm as the IP checksum Set Checksum field to 0 Sum all 16-bit words, adding any carry bits to the LSB Flip bits to get checksum (except 0xffff->0xffff) To check: sum whole packet, including sum, should get 0xffff How many errors? Catches any 1-bit error Not all 2-bit errors Optional in IPv4: not checked if value is 0

Pseudo Header 0 7 8 15 16 23 24 31 +--------+--------+--------+--------+ source address +--------+--------+--------+--------+ destination address +--------+--------+--------+--------+ zero protocol UDP length +--------+--------+--------+--------+ UDP Checksum is computer over pseudoheader prepended to the UDP header For IPv4: IP Source, IP Dest, Protocol (=17), plus UDP length What does this give us? What is a problem with this? Is UDP a layer on top of IP?

Next Problem: Reliability Review: reliability on the link layer Problem Dropped Packets Duplicate Packets Packets out of order Keeping the pipe full Mechanism Acknowledgments + Timeout Sequence Numbers Receiver Window Sliding Window (Pipelining) Single link: things were easy J

Transport Layer Reliability Extra difficulties Multiple hosts Multiple hops Multiple potential paths Need for connection establishment, tear down Analogy: dialing a number versus a direct line Varying RTTs Both across connections and during a connection Why do they vary? What do they influence?

Extra Difficulties (cont.) Out of order packets Not only because of drops/retransmissions Can get very old packets (up to 120s), must not get confused Unknown resources at other end Must be able to discover receiver buffer: flow control Unknown resources in the network Should not overload the network But should use as much as safely possible Congestion Control (next class)

TCP Transmission Control Protocol Application process Application process Write bytes Read bytes TCP Send buffer TCP Receive buffer Segment Segment Segment Transmit segments Service model: reliable, connection oriented, full duplex byte stream Endpoints: <IP Address, Port> Flow control If one end stops reading, writes at other eventually stop/fail Congestion control Keeps sender from overloading the network

TCP Specification RFC 793 (1981), RFC 1222 (1989, some corrections), RFC 5681 (2009, congestion control), Was born coupled with IP, later factored out We talked about this, don t always need everything! End-to-end protocol Minimal assumptions on the network All mechanisms run on the end points Alternative idea: Provide reliability, flow control, etc, link-by-link Does it work?

Why not provide (*) on the network layer? Cost These functionalities are not free: don t burden those who don t need them Conflicting Timeliness and in-order delivery, for example Insufficient Example: reliability * may be security, reliability, ordering guarantees,

End-to-end argument Functions placed at lower levels of a system may be redundant or of little value They may need to be performed at a higher layer anyway But they may be justified for performance reasons Or just because they provide most of what is needed Example: retransmissions Lesson: weigh the costs and benefits at each layer Also: the end also varies from case to case

TCP Header 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Source Port Destination Port +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Sequence Number +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Acknowledgment Number +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Data U A P R S F Offset Reserved R C S S Y I Window G K H T N N +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Checksum Urgent Pointer +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Options Padding +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ data +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Header Fields Ports: multiplexing Sequence number Correspond to bytes, not packets! Acknowledgment Number Next expected sequence number Window: willing to receive Lets receiver limit SWS (even to 0) for flow control Data Offset: # of 4 byte (header + option bytes) Flags, Checksum, Urgent Pointer

Header Flags URG: whether there is urgent data ACK: ack no. valid (all but first segment) PSH: push data to the application immediately RST: reset connection SYN: synchronize, establishes connection FIN: close connection

Establishing a Connection Connect Active participant (client) SYN, SequenceNum = x SYN + ACK, SequenceNum = y, Acknowledgment = x + 1 ACK, Acknowledgment = y + 1 Three-way handshake Two sides agree on respective initial sequence nums If no one is listening on port: server sends RST If server is overloaded: ignore SYN If no SYN-ACK: retry, timeout Passive participant (server) Listen, Accept Accept returns

Connection Termination FIN bit says no more data to send Caused by close or shutdown Both sides must send FIN to close a connection Typical close Close FIN_WAIT_1 FIN ACK CLOSE_WAIT FIN_WAIT_2 TIME_WAIT FIN Close LAST_ACK 2MSL ACK CLOSED CLOSED

Summary of TCP States Unsynchronized Synchronized SYN_RCVD CLOSED Passive open Close Close LISTEN SYN/SYN + ACK Send/SYN SYN/SYN + ACK ACK SYN + ACK/ACK Active open/syn SYN_SENT ConnecWon Establishment Close/FIN ESTABLISHED AcWve close: Can swll receive FIN_WAIT_1 ACK FIN_WAIT_2 Close/FIN FIN/ACK ACK + FIN/ACK CLOSING FIN/ACK CLOSE_WAIT LAST_ACK Close/FIN Passive close: Can swll send! FIN/ACK ACK TIME_WAIT Timeout after two segment lifetimes ACK CLOSED

From: The TIME WAIT state in TCP and Its Effect on Busy Servers, Faber and Touch Infocom 1999 Endpoint 1 (address a, port p) Endpoint 2 (address b, por t q) FIN FIN, ACK Time ACK SYN SYN, ACK ACK Old Connection Closed New Connection Established Duplicate Old Packet Accepted!?

TIME_WAIT Why do you have to wait for 2MSL in TIME_WAIT? What if last ack is severely delayed, AND Same port pair is immediately reused for a new connection? Solution: active closer goes into TIME_WAIT Waits for 2MSL (Maximum Segment Lifetime) Can be problematic for active servers OS has too many sockets in TIME_WAIT, can accept less connections Hack: send RST and delete socket, SO_LINGER = 0 OS won t let you re-start server because port in use SO_REUSEADDR lets you rebind

Next class Sending data over TCP