chapter 04 transport layer

44
© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public ITE PC v4.0 Chapter 1 1 OSI Transport Layer Network Fundamentals – Chapter 4

Upload: eelu

Post on 18-Nov-2023

1 views

Category:

Documents


0 download

TRANSCRIPT

© 2007 Cisco Systems, Inc. All rights reserved. Cisco PublicITE PC v4.0Chapter 1 1

OSI Transport Layer

Network Fundamentals – Chapter 4

ITE PC v4.0Chapter 1 2© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

OSI Transport Layerobjectives1. Roles of the Transport Layer

1. segmentation of data2. error detection3. Multiplexing of upper layer application using port numbers

2. The TCP protocol – Communicating with reliability (TCP Header)3. TCP Connection Establishment (TCP Three-Way Handshake)4. Managing TCP Sessions

1. reliability (sequencing and acknowledgements)2. In order TCP Segment Reassembly3. error correction -(TCP Retransmission)4. flow control ( window size)

5. TCP Session Termination ( 4 Way handshake)6. The UDP protocol – Communicating with Low overhead (UDP Header)7. TCP VS. UDP

ITE PC v4.0Chapter 1 3© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Transport Layer

TCP

UDP

ITE PC v4.0Chapter 1 4© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Main Purpose of the Transport Layer

Multiplexing of applications.

ITE PC v4.0Chapter 1 5© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Application Header + data

What is the protocol which implement transport layer ?

TCP Header UDP Header

or

TCP Header=20 bytesUDP Header=8 bytesUDP is lower overhead

ITE PC v4.0Chapter 1 6© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Transport Layer Functions• TCP/UDP FUNCTIONS.

1. Multiplexing of upper layer application using port numbers2. segmentation of data3. error detectionTCP Additional functions

1. Establishment of connection (3-way handshake)2. Management of connection

reliability (sequencing and acknowledgements) error correction flow control (Buffering, congestion avoidance,

windowing)3. Termination of connection (4-way handshake)

ITE PC v4.0Chapter 1 7© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP and UDP Identify the basic characteristics of the UDP and TCP

protocols

ITE PC v4.0Chapter 1 8© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Multiplexing of upper layer application using port numbers

Identifying the ApplicationsIn order to pass data streams to the proper applications, the Transport layer must identify the target application. To accomplish this, the Transport layer assigns an application an identifier. The TCP/IP protocols call this identifier a port number.

Why source port number & destination port number? The source port number is the number for this communication

associated with the originating application on the local host. The destination port number is the number for this communication

associated with the destination application on the remote host. A socket pair, consisting of the source and destination IP

addresses and port numbers, is also unique and identifies the conversation between the two hosts.

ITE PC v4.0Chapter 1 9© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Layer 4 Addressing

• Port Numbers :

• Port numbers are classified to

Well Known port (0-1023) it identifies different applications, ex:FTP(20,21), Telnet(23), SMTP(25), DNS(53), HTTP(80)

User defined port (1024-65535), it is given randomly by the operating system for each session initiated by the host

ITE PC v4.0Chapter 1 10© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

192.168.1.101

172.16.5.5

Destination Port

80

80

Source Port

49890

49888

Source Port

198.133.219.2549808

www.cisco.com

www.yahoo.com

66.13.29.25

80

PC1

PC2

ITE PC v4.0Chapter 1 11© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Port Numbers

ITE PC v4.0Chapter 1 12© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Note: When downloading a web document and its objects it is common that there will be several TCP sessions created.

netstat –n www.cisco.comwww.google.com

TCP or UDP Source Port

Destination IPDestination Port

Connection StateSource IP

ITE PC v4.0Chapter 1 13© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Segmentation and reassembly.

Describe the role of segments in the transport layer and the two principle ways segments can be marked for reassembly.

ITE PC v4.0Chapter 1 14© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP In order Reassembly Describe how TCP sequence numbers are used to

reconstruct the data stream with segments placed in the correct order

ITE PC v4.0Chapter 1 15© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

UDP out of order Datagram Reassembly Describe in detail the process specified by the UDP

protocol to reassemble PDUs at the destination device

ITE PC v4.0Chapter 1 16© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Error Detection TCP/UDP Checksum

ITE PC v4.0Chapter 1 17© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP

TCP Additional functions • Establishment of connection (3-way handshake)• Management of connection

– flow control (window size)– acknowledging of delivered segments– Retransmission of undelivered segments

• Termination of connection (4-way handshake)

ITE PC v4.0Chapter 1 18© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Connection Establishment When two hosts communicate using TCP, a connection

is established before data can be exchanged.

After the communication is completed, the sessions are closed and the connection is terminated.

To establish the connection, the hosts perform a three-way handshake.

Control bits in the TCP header indicate the progress and status of the connection.

ITE PC v4.0Chapter 1 19© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Connection Establishment and Termination Within the TCP segment header, there are six 1-bit

fields that contain control information used to manage the TCP processes. Those fields are: 1. URG - Urgent pointer field significant2. ACK - Acknowledgement field significant3. PSH - Push function4. RST - Reset the connection5. SYN - Synchronize sequence numbers6. FIN - No more data from sender

ITE PC v4.0Chapter 1 20© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Three-Way Handshake

ITE PC v4.0Chapter 1 21© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Three-Way HandshakeStep 1: A TCP client begins the three-way handshake by sending a segment with the SYN (control flag set, indicating an initial value in the sequence number field in the

header. The sequence number is the Initial Sequence Number (ISN), is randomly chosen

and is used to begin tracking the flow of data from the client to the server for this session.

Step 2: Server sends a segment back to the client with:

ACK flag set indicating that the Acknowledgment number is significant.The value of the acknowledgment number field is equal to the client initial sequence number plus 1.

SYN flag is set with its own random ISN for the Sequence numberStep 3: TCP client responds with a segment containing an ACK that is the response to the

TCP SYN sent by the server. The value in the acknowledgment number field contains one more than the initial

sequence number received from the server.

ITE PC v4.0Chapter 1 22© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Session Termination

Session termination

ITE PC v4.0Chapter 1 23© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Flow Control and Reliability To govern the flow of data between devices, TCP uses a peer-to-peer flow

control mechanism.

The receiving host's TCP layer reports a window size to the sending host's TCP layer.

This window size specifies the number of bytes, starting with the acknowledgment number, that the receiving host's TCP layer is currently prepared to receive.

Window size is included in every TCP segment sent from client or server starting with three-way handshake.

TCP is a full duplex service, client and server specify their own window sizes.

Client Window Size=5,000

Server Window

Size=10,000What’s meant by

window size

ITE PC v4.0Chapter 1 24© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Simple Acknowledgment

Window size = 1500

Sender Receiver

ITE PC v4.0Chapter 1 25© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Simple Acknowledgment

Window size = 1500

Sender Receiver

Send 1 Receive 1

ITE PC v4.0Chapter 1 26© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Simple Acknowledgment

Window size = 1500

Sender Receiver

Send 1 Receive 1

Receive ACK 2 Send ACK 2

ITE PC v4.0Chapter 1 27© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Simple Acknowledgment

Window size = 1500

Sender Receiver

Send 1 Receive 1

Receive ACK 2 Send ACK 2

Send 2Receive 2

ITE PC v4.0Chapter 1 28© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Simple Acknowledgment

Window size = 1500

Sender Receiver

Send 1 Receive 1

Receive ACK 2 Send ACK 2

Send 2Receive 2

Receive ACK 3Send ACK 3

ITE PC v4.0Chapter 1 29© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Simple Acknowledgment

Window size = 1500

Sender Receiver

Send 1 Receive 1

Receive ACK 2 Send ACK 2

Send 2Receive 2

Receive ACK 3Send ACK 3

Send 3Receive 3

ITE PC v4.0Chapter 1 30© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Window size = 1500

Sender Receiver

Send 1 Receive 1

Receive ACK 2 Send ACK 2

Send 2Receive 2

Receive ACK 3Send ACK 3

Send 3Receive 3

Receive ACK 4 Send ACK 4

TCP Simple Acknowledgment

ITE PC v4.0Chapter 1 31© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Windowing

Sender Receiver

Window size = 4500

ITE PC v4.0Chapter 1 32© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Windowing

Window size =4500Send 2

SenderReceiverWindow size = 4500

Send 1

Window size =4500Send 3

ITE PC v4.0Chapter 1 33© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Windowing

Window size =4500Send 2

SenderReceiverWindow size = 4500

Send 1

Window size =4500Send 3

ACK 3Window size = 3000

Packet 3 is

Dropped

ITE PC v4.0Chapter 1 34© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Windowing

Window size =4500Send 2

SenderReceiverWindow size = 4500

Send 1

Window size =4500Send 3

ACK 3Window size = 3000

Packet 3 is

DroppedWindow size =3000Send 3Window size =3000Send 4

ITE PC v4.0Chapter 1 35© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Windowing

Window size =4500Send 2

SenderReceiverWindow size = 4500

Send 1

Window size =4500Send 3

ACK 3Window size = 3000

Packet 3 is

DroppedWindow size =3000Send 3Window size =3000Send 4

ACK 5Window size = 3000

ITE PC v4.0Chapter 1 36© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Congestion Control- Minimizing Segment Loss Describe the mechanisms in TCP that manage the

interrelationship between window size, data loss and congestion during a session

ITE PC v4.0Chapter 1 37© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Retransmission Describe the retransmission.remedy for lost data

employed by TCP

ITE PC v4.0Chapter 1 38© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP Supporting Reliable Communication A Transport layer protocol can implement a method to

ensure reliable delivery of the data. At the Transport layer the three basic operations of reliability are:

•Tracking transmitted data•Acknowledging received data•Retransmitting any unacknowledged data

ITE PC v4.0Chapter 1 39© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

UDP- Low Overhead vs. Reliability

UDP is a simple protocol that provides the basic Transport layer functions. It much lower overhead than TCP, since it is not connection-oriented and does not provide the sophisticated retransmission, sequencing, and flow control mechanisms.

This does not mean that applications that use UDP are always unreliable. Although the total amount of UDP traffic found on a typical network is often

relatively low, key Application layer protocols that use UDP include:

(DNS) (SNMP) (DHCP) (RIP) (TFTP) Online games Some applications, such as online games or VoIP, can tolerate some loss

of some data. Some applications, such as DNS, will simply retry the request if they do

not receive a response, and therefore they do not need TCP to guarantee the message delivery.

The low overhead of UDP makes it very desirable for such applications.

ITE PC v4.0Chapter 1 40© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Applications Requirements Vary

Because different applications have different requirements, there are multiple Transport layer protocols.

ITE PC v4.0Chapter 1 41© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP and UDP UDP is a simple, connectionless protocol

Applications that use UDP include:–Domain Name System (DNS)–Video Streaming–Voice over IP (VoIP)

TCP is a connection-oriented protocol

Applications that use TCP are:–Web Browsers–E-mail –File Transfers

ITE PC v4.0Chapter 1 42© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

TCP vs. UDP TCP provides:

Reliable deliveryError checkingFlow controlCongestion controlOrdered delivery(Connection establishment)Applications:

HTTPFTPTelnetMSN messengerSMTP

UDP provides:Unreliable deliveryNo error checkingNo flow controlNo congestion controlNo ordered delivery

(No connection establishment)

ApplicationsDNS (usually)RTP (Real-Time Protocol)VoIP

Summary

ITE PC v4.0Chapter 1 43© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public

Transport Layer Functions• TCP/UDP FUNCTIONS.

1. Multiplexing of upper layer application using port numbers2. segmentation of data3. error detectionTCP Additional functions

1. Establishment of connection (3-way handshake)2. Management of connection

reliability (sequencing and acknowledgements) error correction flow control (Buffering, congestion avoidance,

windowing)3. Termination of connection (4-way handshake)

Summary

ITE PC v4.0Chapter 1 44© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public