46
Introduction to Networks v5.1 Chapter 9: Transport Layer Instructor Name: Touch Ra 1,May 2016

Itnv51 Stundent-ppt Ch9

Embed Size (px)

Citation preview

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 1/46

Introduction to Networks v5.1

Chapter 9:

Transport Layer

Instructor Name: Touch Ra

1,May 2016

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 2/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 2

9.0 Introduction

9.1 Transport Layer Protocols

9.2 TCP and UDP

9.3 Summary

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 3/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 3

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 4/46

Cisco Public© 2013 Cisco and/or its affiliates. All rights reserved. 4

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 5/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 5

• The transport layer isresponsible for establishing a

temporary communicationsession between twoapplications and deliveringdata between them.

• The transport layer providesservices, such as:

o Connection-oriented datastream support

o Reliability

o Flow control

o Multiplexing

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 6/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 6

Track Individual Conversations

By tracking each individual

conversation flowing between asource application and a destinationapplication separately. 

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 7/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 7

Segment Data andReassemble Segments

By dividing the data intosegments that are easier tomanage and transport.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 8/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 8

Identify the Applications

By ensuring even when

multiple applications arerunning on a device, allapplications receive thecorrect data.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 9/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 9

• Segmenting the data intosmaller chunks enables manydifferent communications,from many different users, tobe interleaved (multiplexed)on the same network.

• The transport layer adds a

header that contains binarydata to identify each segmentof data and to enable varioustransport layer protocols to

perform different functions inthe management of datacommunication.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 10/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 10

• The transport layer is also responsible for managing reliability.

• Some applications may not require reliability. Transport layer requirements vary fromapplication to application.

• TCP/IP suite provides two transportlayer protocols, Transmission ControlProtocol (TCP) and User DatagramProtocol (UDP).

• IP uses these transport protocols toenable hosts to communicate andtransfer data.

• TCP is considered a reliable,full-featured transport layer protocol,

which allows for packet data deliveryconfirmation.

• In contrast, UDP is a very simpletransport layer protocol that does notprovide any reliability.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 11/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 11

• TCP transport is reliable because it supports packet deliveryconfirmation.

• There are three basic operations that enable reliability with TCP:o Numbering and tracking data segments transmitted to a specific

host from a specific application

o  Acknowledging received data

o Retransmitting any unacknowledgeddata after a certain period of time

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 12/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 12

• Some applications do notrequire reliability. Reliabilityincurs additional overhead andpossible delays in transmission.

•  Adding overhead to ensure

reliability for some applicationscould reduce the usefulness ofthe application and can even bedetrimental.

• If reliability is not required,UDP is a better transportprotocol.

• UDP provides the basicfunctions for delivering datasegments between theappropriate applications,with very little overhead anddata checking.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 13/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 13

• TCP is a better choice for:

•  Applications whose segments must arrive in a very specific sequence to beprocessed successfully.

•  Application in which all data must be fully received before any is considereduseful.

•  Applications requiring TCP include: Databases, Web browsers, Email clients.

• UDP is a better choice for applications that can tolerate some data loss duringtransmission, but delays in transmission are unacceptable.

•  Applications using UDP include:

• Live audio streaming

• live video streaming

• Voice over IP (VoIP)

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 14/46

Cisco Public© 2013 Cisco and/or its affiliates. All rights reserved. 14

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 15/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 15

• In addition to supporting the basic functions of data segmentation andreassembly, TCP provides the following services:

o Establishing a Session

o Reliable Delivery

o Same-Order Delivery

o Flow Control

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 16/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 16

• TCP is a stateful protocol. It keeps track of the state of the communicationsession by recording which information it has sent and which information hasbeen acknowledged.

• Each TCP segment has 20 bytesof overhead in the headerencapsulating the applicationlayer data, as shown in thisimage.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 17/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 17

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 18/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 18

• UDP is a stateless protocol. Neither the sender or the receiver is obligated tokeep track of the state of the communication session.

• Reliability must be handled by the application.• Live video and voice applications must quickly deliver data and can tolerate

some data loss; they are perfectly suited to UDP.

• The pieces of communication in UDP are called datagrams.

• These datagrams are sentas best-effort by thetransport layer protocol.

• UDP has a low overhead

of 8 bytes.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 19/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 19

• The transport layer must separate and manage multiplecommunications with different transport requirements.

• Different applications are sending and receiving data over the networksimultaneously.

• Unique header values allow TCP and UDP to manage these multipleand simultaneous conversations by identifying these applications.

• These unique identifiersare the port numbers.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 20/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 20

• Source Port

o The source port number is dynamically chosen by the sending device toidentify a conversation between two devices.

o  An HTTP client usually sends multiple HTTP requests to a web server atthe same time. Each separate HTTP conversation is tracked based on thesource ports.

• Destination Port

o Used to identify an applicationor service running in the server.

o  A server can offer more than oneservice at the same time, offering

a web service on port 80 andFTP on port 21 simultaneously.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 21/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 21

• The combination of the source IP address and source port number, or thedestination IP address and destination port number, is known as a socket.

• The socket is used to identify the server and service being requested by theclient.

• Two sockets combine to form a socket pair: (192.168.1.5:1099, 192.168.1.7:80)

• Sockets enable multiple processes

running on a client and multipleconnections to a server process tobe distinguished from each other.

• The source port number acts as areturn address for the requesting

application.

• It is the transport layer’s job to keepstrack of active sockets.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 22/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 22

The Internet AssignedNumbers Authority(IANA) is the standardsbody responsible forassigning various

addressing standards,including port numbers.

Port Numbers

Well-Known Port Numbers

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 23/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 23

• Unexplained TCP connections can indicate a major security threat.

• Netstat is an important network utility that can be used to verify the activeconnections in a host.

• Use netstat to list the protocols in use, the local address and port numbers, theforeign address and port numbers, and the connection state.

• By default, the netstat command will attempt to resolve IP addresses to domain

names and port numbers to well-known applications.• The -n option can be used to

display IP addresses and portnumbers in their numerical form.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 24/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 24

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 25/46

Cisco Public© 2013 Cisco and/or its affiliates. All rights reserved. 25

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 26/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 26

• Each application process running on the server uses a port number.

•  An individual server cannot have two services assigned to the same

port number within the same transport layer service.

•  An active server application assigned to a specific port is considered tobe open.

•  Any incoming client request addressed to an open port is accepted and

processed by the server application bound to that port.

• There can be many ports open simultaneously on a server, one for eachactive server application.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 27/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 27

 A TCP connection is established in three steps:

1. The initiating client requests a client-to-server communication

session with the server.

2. The server acknowledges the client-to-server communicationsession and requests a server-to-clientcommunication session.

3. The initiating client acknowledgesthe server-to-client communicationsession.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 28/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 28

The FIN TCP flag is used to terminate a TCP connection.

1. When the client has no more data to send in the stream, it sends a

segment with the FIN flag set.2. The server sends an ACK to acknowledge the receipt of the FIN to

terminate the session from client to server.

3. The server sends a FIN to the client to

terminate the server-to-client session.

4. The client responds with an ACK toacknowledge the FIN from the server.

5. When all segments have beenacknowledged, the session is closed.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 29/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 29

The three-way handshake:

• Establishes that the destination device is present on the network.

• Verifies that the destination device has an active service and is acceptingrequests on the destination port number that the initiating client intends to use

• Informs the destination device that the source client intends to establish acommunication session on that port number.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 30/46

Cisco Public© 2013 Cisco and/or its affiliates. All rights reserved. 30

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 31/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 31

• TCP segments use sequence numbers to uniquely identify and acknowledgeeach segment, keep track of segment order, and indicate how to reassembleand reorder received segments.

•  An initial sequence number (ISN) is randomly chosen during the TCP sessionsetup. The ISN is then incremented by the number of transmitted bytes.

• The receiving TCP process buffersthe segment data until all data is

received and reassembled.

• Segments received out of orderare held for later processing.

• The data is delivered to the

application layer only when it hasbeen completely received andreassembled.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 32/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 32

• TCP is designed to confirm that each segment reached its destination.

• TCP session setup ensures the destination is not only reachable, but readyto receive data.

• The TCP process on the destination host acknowledges the data it hasreceived from the source application.

• TCP allows for the retransmission of missed segments.

• TCP ensures all segments are properly re-ordered upon receipt.

• TCP session termination allows for parties to gracefully end a TCP sessionwhen no data is to be transferred (FIN flag).

•  A TCP endpoint can abruptly terminate a session if necessary (RST flag).

• The video on page 9.2.2.2 covers TCP Sequence Numbers and Acknowledgements.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 33/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 33

• TCP provides methods of managing segment losses.

•  Among these methods is a mechanism to retransmit segments for

unacknowledged data.• The video on page 9.2.2.3 covers TCP retransmission.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 34/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 34

• TCP provides mechanisms for flow control.

• Flow control ensures the TCP endpoints can receive and process data reliably.

• TCP handles flow control by adjusting the rate of data flow between source anddestination for a given session.

• TCP flow control function relies on a16-bit TCP header field called theWindow size. The window size is thenumber of bytes that the destinationdevice of a TCP session can acceptand process at one time.

• TCP source and destination agree on

the initial window size when the TCPsession is established

• TCP endpoints can adjust the windowsize during a session if necessary.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 35/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 35

• Network congestion usually results in discarded packets.

• Undelivered TCP segments trigger re-transmission. TCP segmentretransmission can make the congestion even worse.

• The source can estimate a certain level of network congestion by looking at therate at which TCP segments are sent but not acknowledged.

• The source can reduce the number ofbytes it sends before receiving an

acknowledgement upon congestiondetection.

• The source reduces the number ofunacknowledged bytes it sends and not

the window size, which is determined bythe destination.

• The destination is usually unaware of thenetwork congestion and sees no need tosuggest a new window size.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 36/46

Cisco Public© 2013 Cisco and/or its affiliates. All rights reserved. 36

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 37/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 37

• UDP is a simple protocol.

• UDP provides the basic transport layer functions.

• UDP has much lower overhead than TCP.

• UDP is not connection-oriented and does not offer the sophisticatedretransmission, sequencing, and flow control mechanisms.

•  Applications running UDP can still use reliability, but it must be implemented in

the application layer.

• However, UDP is not inferior.It is designed to be simplerand faster than TCP at the

expense of reliability.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 38/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 38

• UDP does not track sequence numbers the way TCP does.

• UDP has no way to reorder the datagrams into their transmission order.

• UDP simply reassemblesthe data in the order in whichit was received.

• The application must identify

the proper sequence, ifnecessary.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 39/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 39

• UDP-based server applications are also assigned well-known orregistered port numbers.

• UDP applications and services running on a server accept UDP clientrequests.

• Requests received on a specific port are forwarded to the properapplication based on port numbers.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 40/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 40

• UDP client-server communication is also initiated by a client application.

• The UDP client process dynamically selects a port number and uses

this as the source port.• The destination port is usually the well-known or registered port number

assigned to the server process.

• The same source-destination pair of ports is used in the header of all

datagrams used in the transaction.

• Data returning to the client from the server uses a flipped source anddestination port numbers in the datagram header.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 41/46

Cisco Public© 2013 Cisco and/or its affiliates. All rights reserved. 41

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 42/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 42

• TCP handles all transport layer related tasks.

• This frees the application from having to manage any of these tasks.

•  Applications can simply send the data stream to the transport layer anduse the services of TCP.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 43/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 43

There are three types of applications that are best suited for UDP:

• Live video and multimedia applications - Can tolerate some data loss,but require little or no delay. Examples include VoIP and live streaming

video.

• Simple request and reply applications - Applications with simpletransactions where a host sends a request and may or may not receive areply. Examples include DNS and DHCP.

• Applications that handle reliabilitythemselves - Unidirectionalcommunications where flow control,error detection, acknowledgements,and error recovery is not required orcan be handled by the application.Examples include SNMP and TFTP.

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 44/46

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Public 44

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 45/46

Cisco Public© 2013 Cisco and/or its affiliates. All rights reserved. 45

7/26/2019 Itnv51 Stundent-ppt Ch9

http://slidepdf.com/reader/full/itnv51-stundent-ppt-ch9 46/46

Thank you.