17
CSE 123: Computer Networks Aaron Schulman Lecture 6: Transport Layer Protocols

Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

  • Upload
    others

  • View
    7

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

CSE 123: Computer NetworksAaron Schulman

Lecture 6:Transport Layer Protocols

Page 2: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

Overview

! Process naming/demultiplexing

! User Datagram Protocol (UDP)

! Transport Control Protocol (TCP)u Three-way handshakeu Flow control

2CSE 123 – Lecture 6: Transport Protocols

Page 3: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

Today: Transport Layer

3

HTTP

TCP

IP

Ethernetinterface

HTTP

TCP

IP

Ethernetinterface

IP IP

Ethernetinterface

Ethernetinterface

SONETinterface

SONETinterface

host host

router router

Application Layer

Transport Layer

Link Layer

Network Layer

CSE 123 – Lecture 6: Transport Protocols

Page 4: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

Transport Layer Tasks

! Define and provide specific delivery semanticsu To which end point (which application/process)?u When?u How?u If?

! Multiplexing different processes on the same links

! Reliability

4CSE 123 – Lecture 6: Transport Protocols

Page 5: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

Naming Processes/Services! Process here is an abstract term for your Web browser

(HTTP), Email servers (SMTP), hostname translation (DNS)

! How do we identify for remote communication?u Process id or memory address are OS-specific and transient

! So TCP and UDP use portsu 16-bit integers representing mailboxes that processes “rent”u Identify process uniquely as (IP address, protocol, port)

5CSE 123 – Lecture 6: Transport Protocols

Page 6: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

Picking Port Numbers! We still have the problem of allocating port numbers

u What port should a Web server use on host X?u To what port should you send to contact that Web server?

! Servers typically bind to well-known port numbersu e.g., HTTP 80, SMTP 25, DNS 53, … look in /etc/servicesu Ports below 1024 traditionally reserved for well-known

services

! Clients use OS-assigned temporary (ephemeral) portsu Above 1024, recycled by OS when client finished

6CSE 123 – Lecture 6: Transport Protocols

Page 7: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

Establishing well-known ports

7CSE 123 – Lecture 6: Transport Protocols

Page 8: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

User Datagram Protocol (UDP)! Provides unreliable message delivery between

processesu Source port filled in by OS as message is sentu Destination port identifies UDP delivery queue at endpoint

! Connectionless (no state about who talks to whom)

SrcPort DstPort

Checksum Length

Data

0 16 31

8CSE 123 – Lecture 6: Transport Protocols

Page 9: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

Applicationprocess

Applicationprocess

Applicationprocess

Packets arrive

Ports

MessageQueues

DeMux

UDP Delivery

Kernelboundary

9CSE 123 – Lecture 6: Transport Protocols

Page 10: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

UDP Checksum! UDP includes optional protection against errors

u Checksum intended as an end-to-end check on deliveryu So it covers data, UDP header, and IP pseudoheader (history)

SrcPort DstPort

Checksum Length

Data

0 16 31

10CSE 123 – Lecture 6: Transport Protocols

Page 11: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

Applications for UDP! Streaming media (e.g., live video)

! DNS (Domain Name Service)

! NTP (Network Time Protocol) (synchronizing clocks)

! FPS multi-player video games (e.g., Call of Duty)

! Why might UDP be appropriate for these?

11CSE 123 – Lecture 6: Transport Protocols

Page 12: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

Transmission Control Protocol! Reliable bi-directional bytestream between processes

u Uses a sliding window protocol for efficient transfer

! Connection-orientedu Conversation between two endpoints with beginning and end

! Flow control (last lecture)u Prevents sender from over-running receiver buffersu (tell sender how much buffer is left at receiver)

! Congestion control (later in term)u Prevents sender from over-running network capacity

12CSE 123 – Lecture 6: Transport Protocols

Page 13: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

TCP Delivery

Application process

Writebytes

TCPSend buffer

Segment Segment SegmentTransmit segments

Application process

Readbytes

TCPReceive buffer

… …13CSE 123 – Lecture 6: Transport Protocols

Page 14: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

TCP Header Format! Ports plus IP addresses identify a connection (4-tuple)

Options (variable)

Data

Checksum

SrcPort DstPort

HdrLen 0 Flags

UrgPtr

AdvertisedWindow

SequenceNum

Acknowledgment

0 4 10 16 31

14CSE 123 – Lecture 6: Transport Protocols

Page 15: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

TCP Header Format! Sequence, Ack numbers used for the sliding window

u How big a window? Flow control/congestion control determine

Options (variable)

Data

Checksum

SrcPort DstPort

HdrLen 0 Flags

UrgPtr

AdvertisedWindow

SequenceNum

Acknowledgment

0 4 10 16 31

15CSE 123 – Lecture 6: Transport Protocols

AdvertisedWindow Flow control –Receiver tells thetransmitter how big itsremaining window is

Page 16: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

TCP Header Format! Flags may be ACK, SYN, FIN, URG, PSH, RST

Options (variable)

Data

Checksum

SrcPort DstPort

HdrLen 0 Flags

UrgPtr

AdvertisedWindow

SequenceNum

Acknowledgment

0 4 10 16 31

16CSE 123 – Lecture 6: Transport Protocols

Page 17: Lecture 6: Transport Layer Protocolscseweb.ucsd.edu/classes/sp20/cse123-a/lectures/123-sp20-l6.pdfToday: Transport Layer 3 HTTP TCP IP Ethernet interface HTTP TCP Ethernet interface

For next time…

! More TCP details

! Read Ch 5.2 in P&D

17CSE 123 – Lecture 6: Transport Protocols