31
Transport Layer chapt6 1 Transport Layer • Functions Services to Higher (Application) Layer Quality of Service Recover from unreliable network protocol • Error and flow control similar to data link layer except now end to end Addressing (ports, TSAP) Shields applications from network implementation, issues and failures Resides in software on hosts

Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Embed Size (px)

Citation preview

Page 1: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 1

Transport Layer

• Functions– Services to Higher (Application) Layer– Quality of Service– Recover from unreliable network protocol

• Error and flow control similar to data link layer except now end to end

– Addressing (ports, TSAP)– Shields applications from network implementation,

issues and failures

• Resides in software on hosts

Page 2: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 2

TCP header

Page 3: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 3

Page 4: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 4

TCP Connection-oriented services to higher layer

• connect(QOS) i.e, CR, same in Berkeley UNIX– disconnect, i.e., DR,- close() in Berkeley UNIX– send (data) – same in Berkeley UNIX– receive - “– listen “

• Receive & listen. Block while waiting

– socket in UNIX• Create a new connection

– Bind in UNIX• Get local address (port) for socket

Page 5: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 5

State Transition Diagram p.501also see http://en.wikipedia.org/wiki/Image:TCP_state_diagram.png p.564 in text

for more advanced diagram listen

EstablishedData sent and received

listen

Passive conn. est.pending Active conn. est. pending

Passive dis. pending Active dis. pending

CR received CR sent

CR ack received

DR received DR sent

ack sent

DR receiveddisconnect

Page 6: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 6

UDP Connectionless services to higher layer

• Send

• Receive

• Listen

Page 7: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 7

Quality of Service

• Can negotiate for required service during connection establishment

• Examples:– Throughput– Delay– Residual error rate– Protection (security)– Priority (to drop or not)

Page 8: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 8

By Steve Taylor and Joanie Wexlerhttp://www.networkworld.com/newsletters/2003/0428fr1.html

• “Quality of service has been a prominent topic for years, as the need to gain service-level control over connectionless IP networks has grown increasingly intense. And there are piles of sophisticated QoS technologies and features out there that, when configured just right, can prove extremely useful to enterprises wishing to ensure that certain application traffic gets the network resources it requires to perform well.”

Page 9: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 9

QoS (continued)

• “At its most basic, a successful QoS deployment typically involves the following steps:

1. Figuring out which applications need some level of QoS.

2. Establishing a corporate traffic-treatment policy based on the above.

3. Determining which QoS features on which devices should be configured to support the policy.

4. Enabling the features with the appropriate parameters.”

Page 10: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 10

QoS (continued)

Features referenced in No. 4 above include :- Classifying traffic. - Marking traffic with the appropriate priority. - Setting up the desired number of priority queues in switches and routers. - Rate-limiting certain traffic so it doesn't hog capacity. - Traffic shaping to smooth out peaks and bursts that can cause temporary congestion. - Configuring jitter buffers if voice is involved. - Identifying packets for temporary random discard when congestion flares up.

Page 11: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 11

Issues of unreliable media

• We never can be sure of communication• Apply concept to disconnect in transport layer

– a) abrupt disconnect (disconnect after DR sent)• May lose data from receiver

– b) wait for DR to be acknowledged• If DR/Ack is lost, sender keeps connection open

– Time-out on sender and resend DR?– But what if DR was received by receiver – then receiver has no

open connection and will not send a new DR/Ack

– c) Three way handshake on disconnect

Page 12: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 12

Transport layer anomalies (cont.)• Duplicate “old” packets

– CR sent/delayed/ resent• Data is sent/ connection closed• Old duplicate CR appears

– CR sent/ack/connection est’d• Data packet delayed/resent• Connection is closed• Old duplicate appears but new connection was given its ID

• Mechanisms to try to handle duplicates• handshakes• Large sequence space• Time to live field; time-outs

Page 13: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 13

Addressing• Ports (TSAP) are assigned during socket call• How does sender determine port address of

destination?– May be in response to message (address included)– May be well known address (1-1023)

• Telnet 23/22• ftp 21• http 80• finger, name server, process server

- Use of name (directory) server- Use of process server

Page 14: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 14

Dynamic Buffer/window size allocation

- Maintenance of buffer pools- Fixed or variable sized; store at sender or receiver;

share buffers over multiple connections?

- Flow control – similar to choke packets, dynamic window size – used to throttle sender’s traffic- Control packets may contain change or absolute value

- What if window/buffer was changed to 0 and restoring packet is lost?

- Dead state can occur

- Should control packets be acknowledged?

Page 15: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 15

Multiplexing

- Transport layer multiplexes connections - Upward multiplexing

- several connections are placed on same outgoing line (TDM) – typically because outgoing line is much faster than data being supplied by applications; ex: FDU users on the alpha

- Downward multiplexing- One connection is sent over multiple lines (typically

using round robin for data units) – typically to get higher throughput; ex: 2 B channels on an ISDN line

Page 16: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 16

Crash Recovery

- If server fails- Do we change first, then ack

- What if crash occurs and we have not received ack- Has change been made?

- Do we ack, then change- What if ack is received? Can we guarantee that

change was made?

- Higher layer must handle with logs and checkpoints

Page 17: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 17

UDP

- Connectionless- Header: (64 bits)

Source Port Destination portLength checksum

- No BEC, flow control, sequencing- Used by RTP, DNS, RPC

- These applications provide their own features as needed

Page 18: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 18

UDP

Page 19: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 19

UDP

Page 20: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 20

Remote Procedure Call (RPC)

- Client calls server (think of main program making a procedure call)- Suspended while server executes

- Send/receive in network provides return values in parameter

- Implemented by client and server stubs (library routines) that construct message to be sent- Cannot use reference parameters

- Parameters in general must be restricted

Page 21: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 21

Real-Time Transport Protocol (RTP)

- Used for real-time multimedia- BEC is not feasible (delay), no acks

- Packets are numbered

- If error is found (checksum in UDP), discard and interpolate from previous data

- Timestamps- Destination controls jitter by buffering

- Synchronizing several input streams- Say film with voice

Page 22: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 22

RTP Header

Page 23: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 23

RTP (RFC 3550)

- RTP HeaderVersion(2 bits);P(1 bit) indicates padding to 4 bytes;

X(1) indicates extension header; CC(4) - # of contributing sources; M(1) last unit; Payload type (7) – type of data &encoding algorithm; sequence number (16)

Timestamp Synchronizing source IDCC source ID (up to 16)Optional extension headers

Page 24: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 24

More on TCP

- IP payload is limited to 65,535 bytes (note 16 bit field for size in IP header)

- Each network has a MTU (maximum transfer unit)

- This value may be 1000 bits for X.25, 1500 bytes (without control info) for Ethernet

- TCP software will typically break up message into segments if it knows the MTU of entering network and the message is larger than MTU

- Otherwise routers must fragment TPDU

Page 25: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 25

TCP pseudoheader

- Included in software checksum - (against layering principle)

- Contains beginning of IP header- Source address- Destination address

- Also protocol ID (6) identifying TCP

- TPDU + header length

Page 26: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 26

TCP options- For connection establishment

- Maximum payload- Default of 536 bytes

- Window size- Maintained similar to ARQ, with time-outs, acks- Limited to 2^16

- During connection establishment- For faster networks, longer distances, a scale can be used to

fill the pipe- Shift up to 14 bits to the left

- Can have 2^30 – 1 in sender’s window max- Alternatively - selective reject

Page 27: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 27

TCP connection establishment

- Three way handshakeSYN (seq=x)

SYN(seq=y,ack=x+1) ack bit is on

data(seq=x+1,ack=y+1)

Page 28: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 28

TCP connection release

- Sender issues a FIN TPDU.- Receiver issues a FIN /ACK TPDU.- Sender terminates connection when ack is

received and returns ack for FIN TPDU- Receiver terminates connection

- Timers are used (twice the packet lifetime) to handle lost data units

Page 29: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 29

TCP congestion control- Three windows

- Agreed upon window size- Congestion window- Current threshold

- When segment is sent, TCP sets timer for ack- Congestion window initialized to first segment size

- If ack is in time, congestion window is doubled - This repeats until congestion window reaches

window size- If ack is late, threshold is set to half congestion window,

congestion window is initialized to one maximum segment

- Doubles until it reaches threshold- Increases linearly until reaches window

- Called slow start

Page 30: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 30

Example of slow start• Set maximum window size

– Assume agreed upon value of 2000 segments (high)

• Initialize threshold to 2000 segments

• Initialize congestion window to 1 segment

• Scenario: 5 acks received; 6th lost; next 10 acks received

• Congestion Window: 1, 2, 4, 8, 16, 32 (this ack was not received)

• Threshold set to 16 (half of the last congestion window)

• Congestion Window: 1, 2, 4, 8, 16, 17, 18, 19, 20, 21, 22

• If the ack for 22 is not received, threshold is set to 11

Page 31: Transport Layer chapt61 Transport Layer Functions –Services to Higher (Application) Layer –Quality of Service –Recover from unreliable network protocol

Transport Layer chapt6 31

Wireless TCP and UDP

- Congestion control of TCP is based on time-out, which can occur frequently due to transmission errors in wireless

- If there is 20% error rate, throughput of 100 packets/seconds becomes 80 packets/second

- Then if window is halved, becomes 40 packets/second

- Additional problems if a wireless (say cellular) network is connected to a wired one