1 transport protocols lesson 12 nets2150/2850 nets2150/ school of information technologies

33
1 Transport Protocols Lesson 12 NETS2150/2850 http://www.ug.cs.usyd.edu.au/~nets2150/ School of Information Technologies

Upload: tristan-haslem

Post on 01-Apr-2015

223 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

1

Transport Protocols

Lesson 12NETS2150/2850

http://www.ug.cs.usyd.edu.au/~nets2150/

School of Information Technologies

Page 2: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

2

Lesson Outcome understand principles behind transport

layer services: multiplexing/demultiplexing reliable data transfer flow control congestion control

learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport

Page 3: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

3

Position of transport layer

Page 4: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

4

Transport layer duties

Page 5: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

5

Transport services and protocols

provide logical communication between app processes running on different hosts

transport protocols run in end systems (not in ISs)

send side: breaks app messages into segments, passes to network layer

rcv side: reassembles segments into messages, passes to app. layer

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysicalnetwork

data linkphysical

logical end-end transport

Page 6: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

6

Transport vs. Network Layer network layer: logical

communication between hosts transport layer: logical

communication between processes relies on, enhances, network layer

services

Page 7: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

7

Types of data deliveries

Page 8: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

8

TCP & UDP Transmission Control

Protocol Connection oriented RFC 793

User Datagram Protocol (UDP) Connectionless RFC 768

Stream Control Transmission Protocol (SCTP) – for VoIP

SCTP

Some protocols in theTCP/IP protocol suite

Page 9: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

9

IP addresses & port numbers

Port Numbers

IP addresses versus port numbers

Page 10: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

10

Well-known portsWell-known ports

Port Protocol Description

   7 Echo Echoes a received datagram back to the sender

    9 Discard Discards any datagram that is received

  11 Users Active users

  13 Daytime Returns the date and the time

  17 Quote Returns a quote of the day

  19 Chargen Returns a string of characters

  20 FTP, Data File Transfer Protocol (data connection)

  21 FTP, Control File Transfer Protocol (control connection)

  23 TELNET Terminal Network

  25 SMTP Simple Mail Transfer Protocol

  53 DNS Domain Name Server

  67 BOOTP Bootstrap Protocol

  79 Finger Finger

  80 HTTP Hypertext Transfer Protocol

111 RPC Remote Procedure Call

161 SNMP Simple Network Management Protocol

Page 11: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

11

Internet transport-layer protocols

reliable, in-order delivery (TCP) congestion control flow control connection setup

unreliable, unordered delivery: UDP extension of “best-

effort” IP

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysicalnetwork

data linkphysical

logical end-end transport

Page 12: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

12

Issues in a Simple Transport Protocol Multiplexing and Addressing Flow Control Connection establishment

and termination

Page 13: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

13

Socket Address

Process-to-process delivery needs two IDs at each end:

- IP address- Port number

Page 14: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

14

Multiplexing/Demultiplexing

delivering received segmentsto correct socket/process

Demultiplexing at rcv host:

gathering data from multiplesockets, enveloping data with header (later used for demultiplexing)

Multiplexing at send host:

Page 15: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

15

How Demultiplexing Works

host receives IP packets each packet has source

IP address, destination IP address

each packet carries 1 transport-layer segment

each segment has source, destination port number

host uses IP addresses & port numbers to direct segment to appropriate socket

source port # dest port #

32 bits

applicationdata

(message)

other header fields

TCP/UDP segment format

Page 16: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

16

Connectionless demultiplexing

UDP socket identified by two-tuple:(dest IP address, dest port number)

When host receives UDP segment: checks destination port number in segment directs UDP segment to socket with that

port number IP packets with different source IP

addresses and/or source port numbers directed to same socket

Page 17: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

17

Connectionless demux (cont)

ClientIP:B

P2

client IP: A

P1P1P3

serverIP: C

SP: 6428

DP: 9157

SP: 9157

DP: 6428

SP: 6428

DP: 5775

SP: 5775

DP: 6428

SP provides “return address”

Eg.: UDP

Page 18: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

18

Connection-oriented demux

TCP socket identified by 4-tuple: source IP address source port number dest IP address dest port number

recv host uses all four values to direct segment to appropriate socket

Server host may support many simultaneous TCP sockets: each socket

identified by its own 4-tuple

E.g.: Web servers have different sockets for each connecting client

Page 19: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

19

Connection-oriented demux (cont)

ClientIP:B

P2

client IP: A

P1P1P3

serverIP: C

SP: 80

DP: 9157

SP: 9157

DP: 80

SP: 80

DP: 5775

SP: 5775

DP: 80

P4

Eg.: TCP

Page 20: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

20

TCP Flow Control

receive side of TCP connection has a receive buffer:

speed-matching service: matching the send rate to the receiving app’s drain rate

app process may be slow at reading from buffer

sender won’t overflow

receiver’s buffer bytransmitting too

much, too fast

flow control

J. Kurose and Ross, Computer Networking

Page 21: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

21

Connection Establishment and Termination

Allow each end to know the other exists

Negotiation of optional parameters by mutual agreement (3-way handshake)

Triggers allocation of transport entity resources

Only in TCP

Page 22: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

22

UDP: User Datagram Protocol [RFC 768]

“bare bones” Internet transport protocol

Best-effort service, UDP segments may be:

lost delivered out of order

to app connectionless:

no handshaking between UDP sender, receiver

each UDP segment handled independently of others

Why is there a UDP? fast: no connection

establishment (which can add delay)

simple: no connection state at sender, receiver

small segment header

no congestion control: UDP can blast away as fast as desired

Page 23: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

23

UDP (2) often used for

streaming multimedia apps loss tolerant

other UDP uses DNS (domain

name resolution) SNMP (network

management) Need to perform

application-specific error recovery!

source port # dest port #

32 bits

Applicationdata

(message)

UDP segment format

length checksumLength, in

octets,including

header

Page 24: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

24

Page 25: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

25

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

full duplex data: bi-directional data flow

in same connection Specifies maximum

segment size (MSS) connection-oriented:

handshaking (exchange of control msgs) init’s sender, receiver state before data exchange

flow controlled: sender will not

overwhelm receiver

point-to-point: one sender, one

receiver reliable, in-order send & receive

buffers

socketdoor

T C Psend buffer

T C Preceive buffer

socketdoor

segm ent

applicationwrites data

applicationreads data

Page 26: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

26

TCP segment structure

source port # dest port #

32 bits

applicationdata

(variable length)

sequence number

acknowledgement numberReceive window

Urg data pnterchecksum

FSRPAUheadlen

notused

Options (variable length)

URG: urgent data (generally not used)

ACK: ACK #valid

PSH: push data now(generally not used)

RST, SYN, FIN:connection estab(setup, teardown

commands)

Internetchecksum

(as in UDP)

J. Kurose and Ross, Computer Networking

Page 27: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

27

TCP seq. #’s and ACKsSeq. #’s:

byte stream “number” of first octet in segment’s data

ACKs: seq # of next

octet expected from other side

cumulative ACK

time

Host A Host B

Seq=42, ACK=79, data = ‘C’

Seq=79, ACK=43, data = ‘C’

Seq=43, ACK=80

Usertypes

‘C’

host ACKsreceipt

of echoed‘C’

host ACKsreceipt of

‘C’, echoesback ‘C’

simple Telnet scenario

Page 28: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

28

TCP Connection Management

Recall: TCP sender, receiver establish “connection” before exchanging data segments

initialize TCP variables: seq. #s buffers, flow

control info (e.g. RcvWindow)

Three way handshake:

Step 1: client host sends TCP SYN segment to server specifies initial seq # no data

Step 2: server host receives SYN, replies with SYNACK segment server allocates buffers specifies server initial

seq. #Step 3: client receives

SYNACK, replies with ACK segment, which may contain data

Page 29: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

29

TCP Connection Management (cont.)

Closing a connection:

Step 1: client end system sends TCP FIN control segment to server

Step 2: server receives FIN, replies with ACK. Closes connection, sends FIN.

Step 3: client receives FIN, replies with ACK.

Step 4: server, receives ACK. Connection closed.

client

FIN

server

ACK

ACK

FIN

close

close

closed

tim

ed w

ait

Page 30: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

30

TCP Connection Management (cont.)

Could be combined (3-way)

Setup Termination

Page 31: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

31

Principles of Congestion Control

Congestion: informally: “too many sources sending too

much data too fast for network to handle” different from flow control!! manifestations:

lost packets (buffer overflow at routers) long delays (queueing in router buffers)

a top-10 problem!

Page 32: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

32

TCP congestion control

There is no explicit feedback from network

Congestion inferred from end-system observed loss, delay

When this happens, TCP reduces its window size Using CWnd and RcvWnd

More details in NETS3303/3603!

Page 33: 1 Transport Protocols Lesson 12 NETS2150/2850 nets2150/ School of Information Technologies

33

Summary Transport layer establishes the

process-to-process communication TCP uses reliable, connection oriented

approach Used by FTP, HTTP, Telnet apps

UDP uses unreliable, connectionless approach Used by DNS, SNMP and streaming apps like

Realplayer and MS Windows Media Player

Stallings 20.1, 20.2 and 204.