Top Banner
CSCI 3421 DATA COMMUNICATIONS AND NETWORKING Chapter 3 Transport Layer Tami Meredith
44

Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Jan 18, 2016

Download

Documents

Anissa Collins
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

CSCI 3421DATA COMMUNICATIONS

AND NETWORKING

Chapter 3Transport Layer

Tami Meredith

Page 2: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Layered Protocol ModelA protocol defines:

1. Message Format (Syntax)

2. Rules of Communication (Semantics)

3. Synchronisation and other application details (Implementation)

Page 3: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

TCP/IP Protocol Suite

Page 4: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Logical Communication

Applications send each other messages; e.g., http request, http response

Transport layer ensures these messages into pieces called segments (sometimes called datagrams when UDP is used)

The transport layer exists only in end-systems Network layer handles the intermediate

systems Application layer: communication between

processes Transport layer: communication between hosts

Page 5: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Transport Services

Note: IP provides unreliable service1. Reliable data transfer

In correct order Error free

2. Congestion control (prevent links getting swamped or overloaded)

3. Multiplexing and de-multiplexing of multiple (application/process-level) communications

Page 6: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Multiplexing

Multiplexing: Collecting the messages from each port/application-socket and combining them into a single data stream

Demultiplexing: Taking the incoming segments and separating them by port/application-socket

Transport layer messages thus have source port number and destination port number fields (port number is NOT a socket id)

Page 7: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Sockets and Ports

1. UDP uses destination host and destination port to route Packets from different hosts all arrive at the

same socket UDP socket defined by destination host:port

2. TCP builds a connection between two processes and thus the source info is also needed Packets from different hosts go to different ports TCP socket defined by both source and

destination host:port

Page 8: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

UDP: “Unreliable” Data Transfer

User Datagram Protocol Bare-bones and minimal transport

protocol Adds almost nothing to IP Only fields (above IP)

1. Source port – 2 bytes2. Destination port – 2 bytes3. Segment length – 2 bytes4. Checksum – 2 bytes

Page 9: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Advantages

Finer grained application control – no congestion control, re-ordering, acknowledgements etc., just quick fast simple transmission attempts

No connection overhead, construction, take-down, or state maintenance

Minimal packet overhead, little extra data to transmit

Page 10: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Users of UDP

Remote file servers using NFS Network management (SNMP) – since SNMP

run when network is in stressed state Name translation (DNS) – so common it must

be fast Routing (RIP) – frequent updates, lost data

not significant Streaming multimedia/telephony using

proprietary application protocols - avoids overhead of congestion control (reliability is performed at the application level instead)

Page 11: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Reliability

Reliability should exist on an end-to-end level and this is properly done at the highest level (not the lowest)

Even if IP does not detect an error, data could be corrupted when being transferred from the modem to the socket’s memory

Calculating the checksum (RFC 1071) Sum all 16 bit words with overflow wrap around Take 1’s complement

Using the checksum Add the checksum to the sum of all 16 bit words

which should generate 11…11

Page 12: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Finite State Automata

States (circles) – must be in one Transitions (arrows) – taken when event

happens Deterministic – no choice when an event

occurs

Page 13: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

TCP: Reliable Data Transfer

1. All bits arrive (i.e. none are lost)2. In the order they were sent (i.e., not

reordered)3. As they were sent (i.e., unflipped)

This is difficult to do! One of the fundamental challenges of

networking

Page 14: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

RDT 1.0

Assumes underlying channel is error free and can send data as fast as it is produced

Two finite state machines exist (Fig 3.9):1. Sender state1: Wait for a send

Event: Send RequestedAction: Make packet and sent it, go to state1

2. Receiver StateA: Wait for an incoming packet

Event: Packet Arrives Action: Remove header and deliver it, go to stateA

Page 15: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

RDT 2: Stop and Wait

Assumes that all packets are received (none are lost)

Packets may be corrupted (bit errors) Positive acknowledgements: received OK,

ACK Negative acknowledgements: not

understood, NAK Often known as ARQ (Automatic Repeat

reQuest) protocols

Page 16: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

RDT 2.0

Issue: What if anACK or a NAKis corrupted?

Page 17: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Solutions

Introduce a new packet, RPT, “Repeat last ACK or NAK”

Replace checksum with ECC protocol (but doesn’t work later when we consider lost packets)

Add a sequence number so that we can resend last packet and treat garbled ACK as NAK

Page 18: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

RDT 2.1

Page 19: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

RDT 2.2

Alternative to RDT 2.1 except that NAK not used

If a packet is corrupted, the ACK of the last correctly received packet is sent

Need to add sequence numbers to ACK Still handles the same issues – garbled

packets only, not loss tolerant Not really any simpler – Is {ACK0, ACK1}

different from {ACK, NAK} but builds framework for RDT 3

Page 20: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

RDT 3

Channel now permitted to lose packets and garble them

Sender retransmits when no ACK received in a timely manner (uses a countdown timer)

Also considers that packets can be duplicated Puts burden of work on the sender (alternatives

which focus on the receiver are also possible) No ACK = Packet lost/delayed, ACK lost/delayed Uses checksums, sequence numbers, timers, ACK,

and NAK Known as an alternating bit protocol Problem is that it is stop and wait – tooooo slow!

Page 21: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.
Page 22: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Pipelining

Utilisation of connection using stop and wait is very low, often down around 1%!

Pipelining permits a burst of packets to be sent until such time as an ACK is expected

Requires more buffering Multiple parts could be lost Protocols more complicated Two basic approaches used

1. Go-Back-N2. Selective Repeat

Page 23: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

GBN

Also known as a sliding window protocol

N is the window size (number of packets that have not been ACK’d)

Sequence numbers now needed in headers

ACK is used for cumulative acknowledgement

When timer expires all unacknowledged packets are resent

Provides some rudimentary congestion control

Page 24: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

GBNn=4

Page 25: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.
Page 26: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.
Page 27: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Selective Repeat

If n is large and the first packet is lost, GBN can require many packets to be resent and waste bandwidth – only the missing packets need to be resent

Selective repeat addresses this issue

Page 28: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.
Page 29: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

TCP

Connection oriented Not a persistent physical connection but

an endhost-to-endhost logical connection Point-to-point – not multicast Full duplex – both endhosts can transmit

simultaneously Three way (3 segments) handshake for

connection establishment – 3rd segment may have payload

Page 30: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

MSS (Max Seg Size) = MTU (Data Link Layer) – TCP/IP Header Data = Maximum segment payload sizeSegments sent at own convenience (RFC 793)

Page 31: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

TCP Segment

Page 32: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Sequence & ACK Numbers

Sequence number = byte offset (into entire message) of the first byte of payload data

Acknowledgement number = sequence number (offset) of the next byte expected

Cumulative acknowledgement (like GBN) When an out of order packet arrives, it is NOT

required that the packet is kept (but it almost always is)

Page 33: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Timeouts [RFC6298]

How long do we wait before doing a retransmit? Needs to be longer than the RTT (round trip

time) Estimated RTT is a exponential weighted

moving average (most recent packets have more weight)

DevRTT is the deviation that segments can show

Timeout = EstimatedRTT + 4 * DevRTT Start at 1 second ONLY 1 TIMER!

Page 34: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

TCP Implementations

No one “right” way to implement TCP Various implementations exist due to the

freedom allowed by the RFC The text gives one correct and possible

implementation Event Based:

1. Send (App. Layer provides data)2. Timeout by timer3. ACK received

Page 35: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

TCP Operation (1)

Page 36: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

TCP Operation (2)

Fast Retransmit (n=3)

Page 37: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Timeout Doubling

The timeout is doubled in duration every time a timer expiry event occurs

Intervals grow exponentially after every retransmission

Helps perform congestion control since retransmission is probably due to congestion

Page 38: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Flow Control

Matching send rate to the rate at which the receiver is receiving

Trying to avoid receivers buffer from overflowing

Is influenced by congestion but is NOT the same thing

Uses the Receive Window field of the header

Not static – changes constantly

Page 39: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Window Size

Window is the amount of spare room in the buffer

Reading moves data from buffer to application

= BufSize – [data in buffer] = BufSize – [LastByteRcvd – LastByteRead] Sender must also account for packets “in

transit” (sent but not acknowledged) If window = 0, still send one byte data

packets to force a response containing an updated window size

Page 40: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

3 Way Handshake

Page 41: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Closing a Connection

Page 42: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Causes of Congestion

Large queuing delays as packet arrival nears link capacity

Retransmissions to compensate for lost packets due to buffer overflow

Unneeded retransmissions due to large delays (and subsequent timeouts)

Wasted bandwidth for packets that don’t make it all the way to the destination

Page 43: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

Solutions

Network Assisted Congestion Control (Not possible since IP does not provide support)

1. Choke packet2. Congestion field set by router

End-to-end Congestion Control (TCP approach) Presence of congestion is inferred and each

application acts independently to reduce it

Page 44: Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.

TCP Principles

A lost segment implies congestion ACK indicates reception and sending rate

can be increased Cyclical Probing

Increase rate until loss occurs Decrease rate because loss occurs Go back to increasing …

Three components to algorithm: Slow start Congestion avoidance Fast recovery