Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer...

30
Lecture 6 Overview

Transcript of Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer...

Page 1: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Lecture 6 Overview

Page 2: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

TCP: Transmission Control Protocol

• TCP is an alternative transport layer protocol supported by TCP/IP.

• TCP provides:– Connection-oriented– Reliable– Full-duplex– Byte-Stream

CPE 401/601 Lecture 6 : TCP/IP model 2

Page 3: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

TCP Segment Format

CPE 401/601 Lecture 6 : TCP/IP model 3

Destination Port

Options (if any)

Data

1 byte 1 byte

Source Port

Sequence Number

Request Number (ACK)

1 byte 1 byte

offset Rsrvd Control Window Size

Checksum Urgent Pointer

Page 4: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

TCP Segment Format • Sequence Number refers to the first byte of

data included in the segment• Request Number (Acknowledgement Number)

indicates the byte number of the next data that is expected to be received– All bytes up through this number have been

received

• Window: tells sender how many bytes it can send before receiver will have to toss it away – due to fixed buffer size

CPE 401/601 Lecture 6 : TCP/IP model 4

Page 5: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Control Flags

• URG: urgent data included

• ACK: this segment is (among other things) an acknowledgement

• RST: error - abort the session

• SYN: synchronize Sequence Numbers (setup)

• FIN: polite connection termination CPE 401/601 Lecture 6 : TCP/IP model 5

Page 6: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

TCP Connection Creation

CPE 401/601 Lecture 6 : TCP/IP model 6

Client ServerSYN

ISN=X

SYNISN=X

1

SYNISN=Y, ACK=X+1

SYNISN=Y, ACK=X+1

2

ACK=Y+1ACK=Y+1 3

time

Page 7: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

TCP Data and ACK

• Once the connection is established, data can be sent

• Each data segment includes a sequence number identifying the first byte in the segment

• Each segment (data or empty) includes a request number indicating what data has been received

CPE 401/601 Lecture 6 : TCP/IP model 7

Page 8: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

TCP Buffers

• The TCP layer doesn’t know when the application will ask for any received data– buffers incoming data so it’s ready when

application asks for it

• Both client and server allocate buffers to hold incoming and outgoing data

• Both client and server announce with every ACK how much buffer space remains– Window field in a TCP segment

CPE 401/601 Lecture 6 : TCP/IP model 8

Page 9: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Send Buffers

• The application gives the TCP layer some data to send

• The data is put in a send buffer, where it stays until the data is ACK’d– it has to stay, as it might need to be sent again!

• TCP layer won’t accept data from application unless (or until) there is buffer space

CPE 401/601 Lecture 6 : TCP/IP model 9

Page 10: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

ACKs

• A receiver doesn’t have to ACK every segment – it can ACK many segments with a single ACK

segment

• Each ACK can also contain outgoing data – piggybacking

• If a sender doesn’t get an ACK after some time limit (MSL) it resends the data.

CPE 401/601 Lecture 6 : TCP/IP model 10

Page 11: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

TCP Segment Order

• IP delivers TCP segments and IP in not reliable – IP datagrams can be lost or arrive out of order

• Most TCP implementations will accept out-of-order segments– if there is room in the buffer

• Once the missing segments arrive, a single ACK can be sent for the whole thing

TCP/IP model 11

Page 12: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Termination

• The TCP layer can send a RST segment that terminates a connection if something is wrong

• Usually the application tells TCP to terminate the connection politely with a FIN segment

CPE 401/601 Lecture 6 : TCP/IP model 12

Page 13: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Connection Termination

CPE 401/601 Lecture 6 : TCP/IP model 13

App1 App2FIN

SN=X

FINSN=X

1

ACK=X+1ACK=X+12

ACK=Y+1ACK=Y+1 4

FINSN=Y

FINSN=Y

3...

Page 14: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

TCP TIME_WAIT

• Once a TCP connection has been terminated there is some unfinished business:– What if the ACK is lost?

• The last FIN will be resent and it must be ACK’d.

– What if there are lost or duplicated segments that finally reach the destination after a long delay?

• TCP hangs out for a while to handle these situations

CPE 401/601 Lecture 6 : TCP/IP model 14

Page 15: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Lecture 7

Routing

CPE 401 / 601

Computer Network Systems

slides are modified from Dave Hollingerslides are modified from J. Kurose & K. Ross

Page 16: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Two Key Network-Layer Functions

• forwarding: move packets from router’s input to appropriate router output

• routing: determine route taken by packets from source to dest. – routing algorithms

• Analogy– routing: process of planning trip from source to

destination– forwarding: process of getting through single

interchangeCPE 401/601 Lecture 7 : Routing 16

Page 17: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

123

local forwarding tableheader value output link

0100010101111001

3221

routing and forwarding

0111

value in arrivingpacket’s header

routing algorithm

CPE 401/601 Lecture 7 : Routing 17

Page 18: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Connection setup

• 3rd important function in some architectures– ATM, frame relay, X.25

• before datagrams flow, two end hosts and intervening routers establish virtual connection– routers get involved

• network vs transport layer connection service:– network: between two hosts

• may also involve intervening routers in case of VCs

– transport: between two processes

CPE 401/601 Lecture 7 : Routing 18

Page 19: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Network service model

• Q: What service model for channel transporting datagrams from sender to receiver?

• Example services for individual datagrams:– guaranteed delivery– guaranteed delivery with less than 40 msec delay

• Example services for a flow of datagrams:– in-order datagram delivery– guaranteed minimum bandwidth to flow– restrictions on changes in inter-packet spacing

CPE 401/601 Lecture 7 : Routing 19

Page 20: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Network layer service models

NetworkArchitecture

Internet

ATM

ATM

ATM

ATM

ServiceModel

best effort

BR

VBR

ABR

UBR

Bandwidth

none

constantrateguaranteedrateguaranteed minimumnone

Loss

no

yes

yes

no

no

Order

no

yes

yes

yes

yes

Timing

no

yes

yes

no

no

Congestionfeedback

no (inferredvia loss)nocongestionnocongestionyes

no

Guarantees ?

CPE 401/601 Lecture 7 : Routing 20

Page 21: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Connection and connection-less service

• Datagram network provides network-layer connectionless service

• Virtual Circuit network provides network-layer connection service

• analogous to the transport-layer services, but:– service: host-to-host– no choice: network provides one or the other– implementation: in network core

CPE 401/601 Lecture 7 : Routing 21

Page 22: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Virtual circuits• src-to-dst path behaves much like telephone circuit

– performance-wise– network actions along source-to-dest path

• call setup, teardown for each call before data can flow

• each packet carries VC identifier– not destination host address

• every router on source-dest path maintains “state” for each passing connection

• link, router resources (bandwidth, buffers) may be allocated to VC– dedicated resources = predictable service)

CPE 401/601 Lecture 7 : Routing 22

Page 23: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

VC implementation

• A VC consists of:– path from source to destination– VC numbers

• one number for each link along path

– entries in forwarding tables in routers along path

• packet belonging to VC carries VC number– rather than dest address

• VC number can be changed on each link– New VC number comes from forwarding table

CPE 401/601 Lecture 7 : Routing 23

Page 24: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Forwarding table

12 22 32

12

3

VC number

interfacenumber

Incoming interface Incoming VC # Outgoing interface Outgoing VC #

1 12 3 222 63 1 18 3 7 2 171 97 3 87… … … …

Forwarding table innorthwest router:

Routers maintain connection state information!

CPE 401/601 Lecture 7 : Routing 24

Page 25: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Virtual circuits: signaling protocols

• used to setup, maintain teardown VC• used in ATM, frame-relay, X.25• not used in today’s Internet

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

1. Initiate call 2. incoming call3. Accept call4. Call connected

5. Data flow begins 6. Receive data

CPE 401/601 Lecture 7 : Routing 25

Page 26: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Datagram networks• no call setup at network layer• routers: no state about end-to-end connections

– no network-level concept of “connection”

• packets forwarded using destination host address– packets between same src-dst pair may take different paths

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

1. Send data 2. Receive data

CPE 401/601 Lecture 7 : Routing 26

Page 27: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Forwarding table

Destination Address Range Link Interface

11001000 00010111 00010000 00000000 through 0 11001000 00010111 00010111 11111111

11001000 00010111 00011000 00000000 through 1 11001000 00010111 00011000 11111111

11001000 00010111 00011001 00000000 through 2 11001000 00010111 00011111 11111111

otherwise 3

4 billion possible entries

CPE 401/601 Lecture 7 : Routing 27

Page 28: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Longest prefix matching

Network Layer 4-28

Prefix Match Link Interface 11001000 00010111 00010 0 11001000 00010111 00011000 1 11001000 00010111 00011 2 otherwise 3

DA: 11001000 00010111 00011000 10101010

Examples

DA: 11001000 00010111 00010110 10100001 Which interface?

Which interface?

Page 29: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Datagram or VC network: why?

• Internet (datagram)– data exchange among computers

• “elastic” service, no strict timing requirement

– “smart” end systems (computers)• can adapt, perform control, error recovery• simple inside network, complexity at “edge”

– many link types • different characteristics• uniform service difficult

CPE 401/601 Lecture 7 : Routing 29

Page 30: Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.

Datagram or VC network: why?

• ATM (VC)– evolved from telephony– human conversation:

• strict timing, reliability requirements• need for guaranteed service

– “dumb” end systems• telephones• complexity inside network

CPE 401/601 Lecture 7 : Routing 30