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

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

Reliable Byte-Stream (TCP)

User Datagram Protocol

Chapter 5 End-to-End Protocols

Internet transport protocols

Application Service Models

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

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

Mobile Transport Layer Lesson 02 TCP Data Stream and Data Delivery

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

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

Lecture 3: The Transport Layer: UDP and TCP

ECE 435 Network Engineering Lecture 15

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

Internet Protocols Fall Outline

Transport: How Applications Communicate

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

Networking Technologies and Applications

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

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

TSIN02 - Internetworking

ECE 650 Systems Programming & Engineering. Spring 2018

Lenuta Alboaie Computer Networks

6. The Transport Layer and protocols

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

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

OSI Transport Layer. objectives

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

TSIN02 - Internetworking

CSC 401 Data and Computer Communications Networks

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

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

10 minutes survey (anonymous)

Computer Networking Introduction

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

Introduction to TCP/IP networking

CSEP 561 Connections. David Wetherall

Information Network 1 TCP 1/2

COMPUTER NETWORKS CS CS 55201

CSCI-GA Operating Systems. Networking. Hubertus Franke

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

ITS323: Introduction to Data Communications

Simulation of TCP Layer

TSIN02 - Internetworking

EEC-682/782 Computer Networks I

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

CS4700/CS5700 Fundamentals of Computer Networks

TCP /IP Fundamentals Mr. Cantu

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

UNIT IV 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

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

Chapter 3 Transport Layer

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

05 Transmission Control Protocol (TCP)

CSEP 561 Connections. David Wetherall

Chapter 3 Transport Layer

Chapter III: Transport Layer

EE 122: Transport Protocols: UDP and TCP

CCNA Exploration Network Fundamentals. Chapter 04 OSI Transport Layer

QUIZ: Longest Matching Prefix

SWITCHING, FORWARDING, AND ROUTING

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

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

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

Kent State University

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

CCNA 1 Chapter 7 v5.0 Exam Answers 2013

Applied Networks & Security

Transmission Control Protocol (TCP)

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

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

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

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

UNIT V. Computer Networks [10MCA32] 1

Introduction to Networks and the Internet

Chapter 23 Process-to-Process Delivery: UDP, TCP, and SCTP 23.1

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)

CS 4390 Computer Networks. Pointers to Corresponding Section of Textbook

ECE 435 Network Engineering Lecture 9

Transcription:

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

Today Transport Layer UDP TCP Intro Connection Establishment

From Lec 2: OSI Reference Model End host Application Application Protocol End host Application Presentation Presentation Session Transport Transport Protocol Session Transport Network Network Protocol Network Network Network Data link Link-Layer Protocol Data link Data link Data link Physical Physical Physical Physical One or more nodes within the network

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 ordered 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?

*MPTCP adds multiple streams and multiple paths This table is not exhaustive! Not the only options UDP TCP SCTP DCCP Multiplexing Connection Reliablity In-order optional Message Stream Flow Control Congestion Control Multiple Streams Multiple Paths * *

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) Three-way handshake SYN, SequenceNum = x SYN + ACK, SequenceNum = y, Acknowledgment = x + 1 ACK, Acknowledgment = y + 1 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 CLOSE_WAIT FIN_WAIT_2 TIME_WAIT CLOSED 2MSL Close LAST_ACK 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 Connection Establishment Close/FIN ESTABLISHED Active close: Can still 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 still send! FIN/ACK ACK TIME_WAIT Timeout after two segment lifetimes ACK CLOSED

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

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!? From: The TIME WAIT state in TCP and Its Effect on Busy Servers, Faber and Touch Infocom 1999

Next class Sending data over TCP