Transport: How Applications Communicate

Similar documents
Transport Layer Marcos Vieira

Introduction to TCP/IP networking

User Datagram Protocol

CSCI-GA Operating Systems. Networking. Hubertus Franke

CSCI-1680 Transport Layer I Rodrigo Fonseca

TCP : Fundamentals of Computer Networks Bill Nace

K2289: Using advanced tcpdump filters

Packet Header Formats

CSCI-1680 Transport Layer I Rodrigo Fonseca

Networking Technologies and Applications

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

Layer 4: UDP, TCP, and others. based on Chapter 9 of CompTIA Network+ Exam Guide, 4th ed., Mike Meyers

Different Layers Lecture 20

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

CSEP 561 Connections. David Wetherall

Introduction to Network. Topics

ECE 650 Systems Programming & Engineering. Spring 2018

Introduc)on to Computer Networks

Introduction to Internet. Ass. Prof. J.Y. Tigli University of Nice Sophia Antipolis

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

QUIZ: Longest Matching Prefix

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

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

CSEP 561 Connections. David Wetherall

Internet Layers. Physical Layer. Application. Application. Transport. Transport. Network. Network. Network. Network. Link. Link. Link.

Single Network: applications, client and server hosts, switches, access links, trunk links, frames, path. Review of TCP/IP Internetworking

CS4700/CS5700 Fundamentals of Computer Networks

Transport Over IP. CSCI 690 Michael Hutt New York Institute of Technology

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

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

Internet and Intranet Protocols and Applications

Overview. Internetworking and Reliable Transmission. CSE 561 Lecture 3, Spring David Wetherall. Internetworking. Reliable Transmission

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

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

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

TCP /IP Fundamentals Mr. Cantu

Network and Security: Introduction

Simulation of TCP Layer

The Transport Layer: TCP & Reliable Data Transfer

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

ECE697AA Lecture 3. Today s lecture

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

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

Reliable Transport I: Concepts and TCP Protocol

TCP = Transmission Control Protocol Connection-oriented protocol Provides a reliable unicast end-to-end byte stream over an unreliable internetwork.

Chapter 2 - Part 1. The TCP/IP Protocol: The Language of the Internet

Problem Set 7 Due: Start of Class, November 2

05 Transmission Control Protocol (TCP)

CCNA 1 Chapter 7 v5.0 Exam Answers 2013

ITS323: Introduction to Data Communications

Sequence Number. Acknowledgment Number. Checksum. Urgent Pointer plus Sequence Number indicates end of some URGENT data in the packet

Protocol Layers & Wireshark TDTS11:COMPUTER NETWORKS AND INTERNET PROTOCOLS

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

6. The Transport Layer and protocols

ICS 351: Networking Protocols

Information Network 1 TCP 1/2. Youki Kadobayashi NAIST

TRANSMISSION CONTROL PROTOCOL. ETI 2506 TELECOMMUNICATION SYSTEMS Monday, 7 November 2016

ARP, IP, TCP, UDP. CS 166: Introduction to Computer Systems Security 4/7/18 ARP, IP, TCP, UDP 1

Kent State University

Announcements Computer Networking. Outline. Transport Protocols. Transport introduction. Error recovery & flow control. Mid-semester grades

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

Computer Communication Networks Midterm Review

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

EE 610 Part 2: Encapsulation and network utilities

EEC-682/782 Computer Networks I

Interconnecting Networks with TCP/IP. 2000, Cisco Systems, Inc. 8-1

CS 457 Lecture 11 More IP Networking. Fall 2011

Operating Systems and Networks. Network Lecture 8: Transport Layer. Adrian Perrig Network Security Group ETH Zürich

Operating Systems and Networks. Network Lecture 8: Transport Layer. Where we are in the Course. Recall. Transport Layer Services.

Internet Control Message Protocol (ICMP)

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

Lecture 11: IP routing, IP protocols

TSIN02 - Internetworking

Chapter 24. Transport-Layer Protocols

CSC 401 Data and Computer Communications Networks

9th Slide Set Computer Networks

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

Interconnecting Networks with TCP/IP

TSIN02 - Internetworking

Outline Computer Networking. Functionality Split. Transport Protocols

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

OSI Transport Layer. Network Fundamentals Chapter 4. Version Cisco Systems, Inc. All rights reserved. Cisco Public 1

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

TSIN02 - Internetworking

Introduction to Internetworking

network security s642 computer security adam everspaugh

Multiple unconnected networks

TCP and Congestion Control (Day 1) Yoshifumi Nishida Sony Computer Science Labs, Inc. Today's Lecture

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 25, 2018

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

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

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

IP - The Internet Protocol. Based on the slides of Dr. Jorg Liebeherr, University of Virginia

CHAPTER-2 IP CONCEPTS

Transport Layer. The transport layer is responsible for the delivery of a message from one process to another. RSManiaol

CS 455: INTRODUCTION TO DISTRIBUTED SYSTEMS [NETWORKING] Frequently asked questions from the previous class surveys

Networking Overview. CS 161: Computer Security Prof. Vern Paxson. TAs: Jethro Beekman, Mobin Javed, Antonio Lupher, Paul Pearce & Matthias Vallentin

Dongsoo S. Kim Electrical and Computer Engineering Indiana U. Purdue U. Indianapolis

TCP/IP. Chapter 5: Transport Layer TCP/IP Protocols

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

Transcription:

Transport: How Applications Communicate Week 2 Philip Levis 1

7 Layers (or 4) 7. 6. 5. 4. 3. 2. 1. Application Presentation Session Transport Network Link Physical segments packets frames bits/bytes Application Transport Network Link 4 3 2 1 2

7 Layers (or 4) 7. 6. 5. 4. 3. 2. 1. Application Presentation Session Transport Network Link Physical segments packets frames bits/bytes Application Transport Network Link 4 3 2 1 3

Transport Provides inter-program communication ICMP: control messages to operating system UDP: unreliable datagrams to user programs TCP: reliable stream to user programs Evidenced by naming IP packets are addressed to hosts with addresses UDP and TCP segments are named to programs with ports ICMP is implicitly named to operating system/ip software 4

IP Header ver. len type of serv. total len identification O D M fragment offset TTL protocol checksum source address destination address options 32 bits (4 octets) 5

IP Header ver. len type of serv. total len 1 ICMP identification O D M 4 fragment IP offset TTL protocol 6 checksum TCP source address 17 UDP destination address options 32 bits (4 octets) 6

ICMP Internet Control Message Protocol, RFC 792 Way for Internet hosts to send control information You ll work a lot with ICMP in lab 3 (router) Unreliable datagrams type code data checksum 7 Example: type 3 is destination unreachable code 0: net unreachable code 1: host unreachable code 2: protocol unreachable code 3: port unreachable

ICMP: ping ping, a very basic tool! Source sends an ICMP Echo message Destination replies with an ICMP Echo Reply message echo echo reply 8 0 identifier 0 0 identifier checksum sequence number checksum sequence number 8

ICMP: traceroute Send UDP segments to destination with increasing TTL ICMP type 11: time to live exceeded 11 0 checksum first 64 bits of generating packet 9

UDP User Datagram Protocol, RFC 768 Very thin layer on top of IP, just adds ports Unreliable, datagrams source port UDP len destination port checksum 10

UDP: DNS Example UDP program: Domain Name System (DNS) Maps names like cs.stanford.edu to IP addresses UDP port 53 Learn details about DNS in Week 5 11

DNS Header Structure (RFC1035) Header Question Answer Authority Additional QR: 0=query, 1=response OPCODE: 0=standard query RCODE: error code Flags AA: authoritative answer TC: truncated RD: recursion desired RA: recursion available ID QR OPCODE AA TC RD RA Z RCODE QDCOUNT ANCOUNT NSCOUNT ARCOUNT 12 16 bits

IP UDP DNS Encapsulation ver. len type of serv. total len identification O D M fragment offset TTL protocol checksum source address destination address source port destination port UDP len checksum ID fields QDCOUNT ANCOUNT NSCOUNT ARCOUNT data 13

TCP Transmission Control Protocol, RFC 793 Different abstraction: bidirectional, reliable byte stream Building block of most applications today Abstracts away entire network -- just a pipe between two programs One side reads what the other writes Application level controls communication pattern and payloads World Wide Web (HTTP) Skype BitTorrent 14

Audacious Idea TCP: make a reliable data stream out of an unreliable network Can fail, but almost always explicitly detected (connection breaks) Assumes random errors, not malicious ones Part of a larger theme in computer systems, making robust, high performance computing out of cheap, unreliable parts TCP from IP datagrams RAID: Redundant Array of Inexpensive Disks Early cloud computing systems (MapReduce, Hadoop, etc.) Domain Name System 15

How to Start? Reliable communication typically benefits from have some state on each end of a connection Need to be able to identify data to determine if it s been delivered For a stream, need to know where in stream data is Problem: connection establishment How do you set up this state? Problem: connection teardown How do you clean up (reuse ports, etc.)? 16

TCP Header source port destination port sequence number acknowledgment number offset reserved U A P R S F window checksum urgent pointer options padding 32 bits (4 octets) 17

Connection Setup source port destination port sequence number acknowledgment number offset reserved U A P R S F window checksum urgent pointer options padding 32 bits (4 octets) 18

3-way Handshake Active opener sends first packet SYN with sequence number Passive opener responds SYN with sequence number ACKs active opener s SYN packet Active opener responds ACKs passive opener s SYN packet Also support simultaneous open Two SYNs pass each other Each side ACKs the other active SYN ACK SYN SYN/ACK ACK data data passive SYN/ACK SYN SYN/ACK ACK 19

TCP Setup FSM 20

Conceptual Model SYN message tells destination endpoint the starting sequence number Can t send data until it acknowledges it knows the starting sequence number ACK of SYN tells source that this endpoint knows the starting seq no. Happens in both directions: bidirectional dream 21

Connection established! Now what? How do we send data? 22

Flow Control Don t send more packets than receiver can process Receiver gives sender feedback Two basic approaches Stop and wait (lab 1) Sliding window (lab 2) 23

Finite State Machines event causing state transition actions taken on state transition State 1 event action State 3 State 2 24

Stop and Wait At most one packet in flight at any time Sender sends one packet Receiver sends acknowledgment packet when it receives data On receiving acknowledgment, sender sends new data On timeout, sender resends current data 25

Stop and Wait Problem San Francisco Boston Bottleneck is 10Mbps RTT is 100ms 26

Stop and Wait Problem San Francisco Boston Bottleneck is 10Mbps RTT is 100ms At most 10 packets/second! 120Kbps << 10Mbps 27

Sliding Window San Francisco Boston Bottleneck is 10Mbps RTT is 50ms Generalization of stop-and-wait: allow multiple un-acked segments Bound on number of un-acked segments, called window Can keep pipe full 28

Sliding Window Sender Every segment has a sequence number (SeqNo) Maintain 3 variables Send window size (SWS) Last acknowledgment received (LAR) Last segment sent (LSS) Maintain invariant: (LSS - LAR) SWS Advance LAR on new acknowledgment Buffer up to SWS segments 29

Sliding Window Receiver Maintain 3 variables Receive window size (RWS) Last acceptable segment (LAS) Last segment received (LSR) Maintain invariant: (LAS - LSR) RWS If received packet is < LAS, send acknowledgment Send cumulative acks: if received 1, 2, 3, 5, acknowledge 3 NOTE: TCP acks are next expected data (e.g., ack 4 in above example) 30

RWS, SWS, and Sequence Space RWS 1, SWS 1, RWS SWS Assuming packets not more than 2 RTTs: If RWS = 1, go back N protocol, need SWS+1 sequence numbers If RWS = SWS, need 2SWS sequence numbers Generally need RWS+SWS sequence numbers per 2 RTTs of delay 31

TCP Flow Control Receiver advertises RWS using window field Sender can only send data up to LAR + window source port destination port data sequence number acknowledgment sequence number offset res N C E U A P R S F window checksum urgent options 32

Sequence numbers TCP sequence numbers are in bytes: specifies where in the stream the data in this particular segment resides Denotes state of forward stream, from source to destination of packet Sequence number 2,032, length 800 is bytes 2032 2831 Sequence number 123,400, length 1200 is bytes 123,400 124,599 Acknowledgement number specifies state of stream in reverse direction Cumulative acknowledgements: specifies the first byte of the stream that hasn t been received If stream from A to B started at sequence number 5,000, acknowledgement 15,201 sent from B means that B has received bytes 5,000 15,200 successfully 33

Connection Teardown source port destination port sequence number acknowledgment number offset reserved U A P R S F window checksum urgent pointer options padding 32 bits (4 octets) 34

Connection Teardown FIN bit says no more data to send Caused by close() or shutdown() on other end Both sides must send FIN to terminate a connection Typical teardown exchange: A B: FIN, seq S A, ack SB B A: ack S A + 1 B A: FIN, seq S B, ack SA + 1 A B: ack S B + 1 Can also have simultaneous close Can A and B forget about closed socket after final message? 35

Cleaning Up Safely Problems with closed socket What if final ack is lost in the network? What if the same port pair is immediately reused for a new connection? Solution: active closer goes into TIME WAIT Active close is sending FIN before receiving one Keep socket around for 2MSL (twice the maximum segment lifetime ) Can pose problems with servers OS has too many sockets in TIME WAIT, slows things down Hack: Can send RST and delete socket, set SO_LINGER socket option to time 0 OS won t let you re-start server because port still in use (SO_REUSEADDR option lets you re-bind used port number) 36

Full TCP FSM 37 http://en.wikipedia.org/wiki/file:tcp_state_diagram_fixed.svg

Transport Provides inter-program communication ICMP: control messages to operating system UDP: unreliable datagrams to user programs TCP: reliable stream to user programs Evidenced by naming IP packets are addressed to hosts with addresses UDP and TCP segments are named to programs with ports ICMP is implicitly named to operating system/ip software 38

Transport Abstractions ICMP: unreliable datagrams, control messages between IP software UDP: unreliable datagrams, application data TCP: reliable stream, application data Need to establish connections: 3-way handshake Data transfer: stop and wait Data transfer: sliding window - Receiver states current window size - Sender can have up to window size unacknowledged bytes in flight Connection teardown 39