0% found this document useful (0 votes)
7 views46 pages

CN_Chapter4

Uploaded by

wik4apps
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views46 pages

CN_Chapter4

Uploaded by

wik4apps
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 46

OSI Transport Layer

IT305: Computer Networks – Chapter 4

1
Course Info
 Dr. Walid Khedr, Ph.D.
–Email: [email protected]
–Web: www.staff.zu.edu.eg/wkhedr
–Department of Information Technology

2
OSI Transport Layer
 This chapter presents the Transport layer of the
TCP/IP model of networking. The two most popular
Transport layer protocols, Transmission Control
Protocol (TCP) and User Datagram Protocol (UDP),
are also presented.
 There are 3 key concepts in this chapter:
1. The role of the Transport layer is to provide three main
functions: multiplexing, segmentation and reassembly, and
error checking.
2. Knowing how TCP and UDP operate and which popular
applications use each protocol
3. Ports provide a “tunnel” for data to get from the Transport
layer to the appropriate application

3
The Transport Layer
 The processes described in the OSI Transport layer
accept data from the Application layer and prepare it for
addressing at the Network layer.
 The Transport layer is responsible for the overall end-
to-end transfer of application data.

5
Functions of the Transport Layer
 The Transport layer also encompasses these
functions:
1. Enables multiple applications to communicate over the
network at the same time on a single device
2. Ensures that, if required, all the data is received reliably and
in order by the correct application
3. Employs error handling mechanisms

6
Purpose of the Transport Layer
 The Transport layer provides for the segmentation of
data and the control necessary to reassemble these
pieces into the various communication streams. Its
primary responsibilities to accomplish this are:
1. Tracking the individual communication between applications
on the source and destination hosts
2. Segmenting data and managing each piece
3. Reassembling the segments into streams of application data
4. Identifying the different applications
5. Perform flow control between end users
6. Enable error recovery
7. Initiating a session

7
Tracking Individual Communication
 Any host may have multiple applications that are
communicating across the network.
 It is the responsibility of the Transport layer to maintain
the multiple communication streams between these
applications.

8
Segmenting Data
 The Transport layer protocols describe services that
segment this data from the Application layer.
 Each piece of application data requires headers at the
Transport layer to indicate to which communication it is
associated.

9
Reassembling Segments
 At the receiving host, these individual pieces of data
must also be reconstructed into a complete data stream
that is useful to the Application layer.
 Because networks may provide multiple routes that can
have different transmission times, data can arrive in the
wrong order.
–By numbering and sequencing the segments, the Transport
layer can ensure that these segments are reassembled into the
proper order.

10
Identifying the Applications
 In 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.
 Each software process that needs to access the
network is assigned a port number unique in that host.

11
Flow Control
 Network hosts have limited resources, such as
bandwidth.
 When Transport layer is aware the resources are
overtaxed, it can request the sending application
reduce the rate of data flow.
 Flow control can prevent the loss of segments on the
network and avoid the need for retransmission.

12
Error Recovery
 The transport layer can ensure that all pieces reach
their destination by having the source device retransmit
any data that is lost (Reliable Delivery)

13
Initializing a Session
 The Transport layer can provide connection orientation
by creating a sessions between the applications.
 These connections prepare the applications to
communicate with each other before any data is
transmitted.

14
Supporting Reliable Communication
 Different applications have different requirements for
their data, and therefore different Transport protocols
have been developed to meet these requirements.
 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

15
Supporting Reliable Communication
 These reliability processes place additional overhead
on the network resources due to the acknowledgement,
tracking, and retransmission.
 To support these reliability operations, more data is
exchanged between the sending and receiving hosts.
–The Transport layer of the receiving host must also track the
data as it is received and acknowledge the receipt of the data.

16
Determining the Need for Reliability
 At the Transport layer, there are protocols that specify
methods for either reliable or best-effort delivery.
–In the context of networking, best-effort delivery is referred to
as unreliable, because there is no acknowledgement that the
data is received at the destination.
 Applications, such as databases, web pages, and e-
mail, require that all of the sent data arrive at the
destination in its original condition, in order for the data
to be useful.
 Other applications are more tolerant of the loss of small
amounts of data. For example, if one or two segments
of a video stream fail to arrive, it would only create a
momentary disruption in the stream.
17
TCP and UDP
 The two most common Transport layer protocols of
TCP/IP protocol suite are Transmission Control
Protocol (TCP) and User Datagram Protocol (UDP).
 Both protocols manage the communication of multiple
applications.
 The differences between the two are the specific
functions that each protocol implements.

19
User Datagram Protocol (UDP)
 UDP is a simple, connectionless protocol, described in
RFC 768.
 It has the advantage of providing for low overhead data
delivery.
 The pieces of communication in UDP are called
datagrams.
 These datagrams are sent as "best effort" by this
Transport layer protocol.
 Applications that use UDP include:
–Domain Name System (DNS)
–Video Streaming
–Voice over IP (VoIP)

20
Transmission Control Protocol (TCP)
 TCP is a connection-oriented protocol, described in RFC 793.
 TCP incurs additional overhead to gain functions.
 Additional functions specified by TCP are the same order delivery,
reliable delivery, and flow control.
 Each TCP segment has 20 bytes of overhead in the header
encapsulating the Application layer data, whereas each UDP
segment only has 8 bytes of overhead.
 Applications that use TCP are:
–Web Browsers
–E-mail
–File Transfers

21
Port Addressing: Identifying the Conversations

 The TCP and UDP based services keep track of the


various applications that are communicating.
 Both TCP and UDP have header fields that can
uniquely identify these applications.
–These unique identifiers are the port numbers.
 In the header of each segment or datagram, there is a
source and destination port.
 Port numbers are assigned in various ways, depending
on whether the message is a request or a response

22
Port Addressing: Identifying the Conversations

 When a client application sends a request to a server


application, the destination port contained in the header
is the port number that is assigned to the service
daemon running on the remote host.
–The client software must know what port number is associated
with the server process on the remote host.
 The source port in a segment or datagram header of a
client request is randomly generated.
–This port number acts like a return address for the requesting
application.
–The Transport layer keeps track of this port and the application
that initiated the request so that when a response is returned, it
can be forwarded to the correct application.

23
Port Addressing: a socket
 The combination of the Transport layer port number
and the Network layer IP address assigned to the host
uniquely identifies a particular process running on a
specific host device.
 For example, an HTTP web page request being sent to
a web server (port 80) running on a host with a Layer 3
IPv4 address of 192.168.1.20 would be destined to
socket 192.168.1.20:80.

24
The IANA assigns port numbers (F4.1.5.3)
 Well known ports (Numbers 0 to 1023)
 Registered Ports (Numbers 1024 to 49151)
 Dynamic or Private Ports (Numbers 49152 to 65535)
 The Internet Assigned Numbers Authority (IANA)
assigns port numbers.
 Netstat is an important network utility that can be used
to verify those connections. Netstat lists:
–the protocol in use,
–the local address and port number,
–the foreign address and port number,
–the state of the connection.

25
TCP-Making Conversations Reliable
 The key distinction between TCP and UDP is reliability.
 The reliability of TCP communication is performed
using connection-oriented sessions. (3 way
handshake)
–Before a host using TCP sends data to another host, the
Transport layer initiates a process to create a connection with
the destination.
–This process ensures that each host is aware of and prepared
for the communication.

26
TCP-Making Conversations Reliable (F4.2.1.1)
 After a session has been established (3 way
handshake), the destination sends acknowledgements
to the source for the segments that it receives.
–As the source receives an acknowledgement, it knows that the
data has been successfully delivered and can quit tracking that
data.
 If the source does not receive an acknowledgement
within a predetermined amount of time, it retransmits
that data to the destination.
–There is also additional overhead on the individual hosts
created by the necessity to keep track of which segments are
awaiting acknowledgement and by the retransmission process.

27
TCP Segment Structure

28
TCP Connection Establishment and Termination
 When two hosts communicate using TCP:
–A connection is established before data can be exchanged.
–The host tracks each data segment within a session and exchanges
information about what data is received.
–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.
–Establishes that the destination device is present on the network
–Verifies that the destination device has an active service and is
accepting requests on the destination port number that the initiating
client intends to use for the session
–Informs the destination device that the source client intends to
establish a communication session on that port number

30
TCP Connection Establishment

31
TCP Connection Termination

32
TCP three-Way Handshake - Step 1
 Using the Wireshark outputs, you can examine the operation of the
TCP 3-way handshake.
 A TCP client begins the 3-way handshake by sending a
segment with the SYN (Synchronize Sequence
Number) control flag set, indicating an initial value in
the sequence number field in the header.
–This initial value for the sequence number, known as 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.

 As shown in the figure, output from a protocol analyzer


shows the SYN control flag and the relative sequence
number.
–The SYN control flag is set and the relative sequence number is at 0.

33
TCP three-Way Handshake - Step 2
 TCP server needs to acknowledge the receipt of the SYN from the
client to establish the session from the client.
–The server sends a segment back to the client with the ACK flag set
indicating that the Acknowledgment number is significant.
 The value of acknowledgment number is the initial sequence
number plus 1.
 Server must also initiate the response from the server to the client.
–To start this session, the server uses the SYN flag in the same way
that the client did.
–It sets the SYN flag in the header to establish a session from server to
the client.
–The SYN flag indicates that the initial value of the sequence number
field is in the header.

34
TCP three-Way Handshake - Step 3
 Finally, the TCP client responds with a segment
containing an ACK that is the response to the TCP SYN
sent by the server.
–There is no user data in this segment.
–The value in the acknowledgment number field contains one
more than the initial sequence number received from the
server.
 Once both sessions are established between client and
server, all additional segments exchanged in this
communication will have the ACK flag set.

35
TCP Session Termination
 To end TCP session, a two-way handshake is used, consisting of a
FIN and an ACK segment.
 Therefore, to terminate a single conversation supported by TCP, four
exchanges are needed to end both sessions:
–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 to acknowledge the FIN from the
server.
 It is also possible to terminate the connection by a three-way
handshake.
–When the client has no more data to send, it sends a FIN to the server. If
the server also has no more data to send, it can reply with both the FIN
and ACK flags set, combining two steps into one. The client replies with an
ACK.

36
TCP Segment Reassembly
 When services send data using TCP, segments may arrive at their
destination out of order.
–For the original message to be understood by the recipient, and reassembled
into the original order, sequence numbers are assigned in the header of each
packet.
 During setup, an initial sequence number (ISN) is set.
–This ISN represents the starting value for the bytes that will be transmitted to
the receiving application.
–As data is transmitted, the sequence number is incremented by the number of
bytes that have been transmitted.
–This enables each segment to be uniquely identified and acknowledged.
–Missing segments can be identified.
 The receiving TCP process places the data from a segment into a
receiving buffer.
–Any segments that arrive with noncontiguous sequence numbers are held for
later processing.
–Then, when the segments with the missing bytes arrive, these segments are
processed.

37
TCP Acknowledgement with Windowing

39
TCP Acknowledgement with Windowing
 Looking at this example, if the sending host had to wait for
acknowledgement of the receipt of each 10 bytes, the network
would have a lot of overhead.
–To reduce the overhead of these acknowledgements,
multiple segments of data can be sent before and
acknowledged with a single TCP message.
–This acknowledgement contains an acknowledgement
number based on the total number of bytes received.
 For example, starting with a sequence number of 2000, if 10
segments of 1000 bytes each were received, an
acknowledgement number of 12001 would be returned to the
source.
 The amount of data that a source can transmit before an
acknowledgement must be received is called window size
40
TCP Retransmission (F4.3.3.1)
 No matter how well designed a network is, data loss will
occasionally occur.
–TCP provides methods of managing segment losses.
–These is a mechanism to retransmit segments with unacknowledged
data.
 A destination host service using TCP usually only acknowledges
data for contiguous sequence bytes.
–For example, if segments with sequence numbers 1500 to 3000 and
3400 to 3500 were received, the acknowledgement number would be
3001.
–Because segments numbers 3001 to 3399 have not been received.
 When TCP at the source host has not received an
acknowledgement after a predetermined amount of time, it will go
back to the last acknowledgement number that it received and
retransmit data from that point forward.
 Hosts today may also employ an optional feature called Selective
Acknowledgements.

41
TCP Congestion Control – flow control
 TCP also provides mechanisms for flow control.
–Flow control assists the reliability of TCP transmission by
adjusting the effective rate of data flow between the two
services.
–When the source is informed that the specified amount of data
in the segments is received, it can continue sending more data.
 This Window Size field in the TCP header specifies the
amount of data that can be transmitted before an
acknowledgement must be received.
–The initial window size is determined during the session
startup via the three-way handshake.

42
TCP Congestion Control – flow control
 See the figure for a
simplified representation of
window size and
acknowledgements.
–In this example, the initial
window size for a TCP session
represented is set to 3000
bytes.
–When the sender has
transmitted 3000 bytes, it waits
for an acknowledgement before
transmitting more segments.
–Once the sender has received
this acknowledgement, the
sender can transmit an
additional 3000 bytes.

43
TCP Congestion Control – flow control
 During the delay in receiving the acknowledgement, the
sender will not be sending any additional segments for
this session.
–In periods when the network is congested or the resources of
the receiving host are strained, the delay may increase. As this
delay grows longer, the effective transmission rate of the data
for this session decreases.
–The slowdown in data rate helps reduce the resource
contention.
 If the receiver indicates a window size of 0, then the
sender cannot send any more bytes until the receiver
sends a packet with a window size greater than 0.

44
TCP Congestion Control – Reducing Window Size

 Another way to control the


data flow is to use
dynamic window sizes.
–When network resources
are constrained, TCP can
reduce the window size to
require that received
segments be acknowledged
more frequently.
–This effectively slows down
the rate of transmission
because the source waits for
data to be acknowledged
more frequently.

45
UDP – Low Overhead vs. Reliability
 UDP is a simple protocol that provides the basic
Transport layer functions.
–It is not connection-oriented
–It does not provide retransmission, sequencing, and flow
control.
 This does not mean that applications that use UDP are
always unreliable.
–It simply means that these functions are not provided by the
Transport layer protocol and must be implemented elsewhere if
required.

46
UDP – Low Overhead vs. Reliability
 key Application layer protocols that use UDP include:
–Domain Name System (DNS)
–Simple Network Management Protocol (SNMP)
–Dynamic Host Configuration Protocol (DHCP)
–Routing Information Protocol (RIP)
–Trivial File Transfer Protocol (TFTP)
–Online games
 If these applications used TCP, they may experience
large delays while TCP detects data loss and
retransmits data.
–These delays would be more detrimental to the application
than small data losses.

47
UDP – Low Overhead vs. Reliability
 Because UDP is connectionless, sessions are not
established before communication takes place as they
are with TCP.
 Many applications that use UDP send small amounts of
data that can fit in one segment.
–However, some applications will send larger amounts of data
that must be split into multiple segments.
–When multiple datagrams are sent to a destination, they may
take different paths and arrive in the wrong order.
–UDP does not keep track of sequence numbers.
–UDP has no way to reorder the datagrams into their
transmission order. See the figure.

48
Summary

51
52

You might also like