Lecture 5 - Transport Layer Network1
Lecture 5 - Transport Layer Network1
Module Objectives
Module Title: Transport Layer
Module Objective: Compare the operations of transport layer protocols in supporting end-to-
end communication.
Topic Title Topic Objective
Transportation of Data Explain the purpose of the transport layer in managing the transportation of
data in end-to-end communication.
Reliability and Flow Control Explain how TCP protocol data units are transmitted and acknowledged to
guarantee delivery.
UDP Communication Compare the operations of transport layer protocols in supporting end-to-end
communication.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2
Transportation of Data
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 3
Transportation of Data
Role of the Transport Layer
Responsible for
establishing a temporary
communication session
between two applications
and delivering data
between them.
Process-to-Process
Communication
Link between the
application layer and the
lower layers that are
responsible for network
transmission.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 4
Transportation of Data
Transport Layer Responsibilities
Tracking the Conversation -
flowing between a source and a
destination application.
Segmentation - Divides the data
into segments that are easier to
manage and transport. Header
used for reassembly is used for
tracking.
Identifying the Application -
Ensures that even with multiple
applications running on a device,
all applications receive the
correct data via port numbers.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 5
Transportation of Data
Conversation Multiplexing
Sending some types of data (for
example, a streaming video) across a
network, as one complete
communication stream, can consume all
of the available bandwidth.
This will then prevent other
communications from occurring at the
same time.
It would also make error recovery and
retransmission of damaged data difficult.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 7
Transportation of Data
TCP With TCP, there are three basic operations
of reliability:
1. Numbering and tracking data segments
transmitted to a specific host from a
specific application
2. Acknowledging received data
3. Retransmitting any unacknowledged data
after a certain period of time
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 8
Transportation of Data
TCP (Cont.)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 9
Transportation of Data
TCP (Cont.)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 10
Transportation of Data
UDP
While the TCP reliability functions provide more robust Use UDP for less overhead and to
communication between applications, they also incur reduce possible delays.
additional overhead and possible delays in transmission.
Adding overhead to ensure reliability for some applications Best-effort delivery (unreliable)
could reduce the usefulness of the application and can No acknowledgment
even be detrimental.
In such cases, UDP is a better transport protocol. Similar to a non-registered letter
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 11
Transportation of Data
The Right Transport Layer Protocol for the Right Application
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 13
TCP Overview
TCP Features
Establishing a Session
• Connection-oriented protocol
• Ensures the application is ready to receive the
data
• Negotiate the amount of traffic that can be
forwarded at a given time
Reliable Delivery
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 17
TCP Overview
TCP Header
Sequence Number
Sequence numbers are assigned in the
header of each packet.
Represents the first data byte of the TCP
segment.
During session setup, an initial sequence
number (ISN) is set - represents the
starting value of the bytes.
As data is transmitted during the session,
the sequence number is incremented by
the number of bytes that have been
transmitted.
Missing segments can then be identified.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 18
TCP Overview
TCP Header
Sequence Number
Suppose that the data stream consists of a file consisting of 500,000 bytes, that the MTU is 1,000
bytes, and that the first byte of the data stream is numbered zero:
The first segment gets assigned sequence number 0, the second segment gets assigned sequence
number 1000, the third segment gets assigned sequence number 2000, and so on.
Each sequence number is inserted in the sequence number field in the header of the appropriate TCP
segment.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 19
TCP Overview
TCP Header
Sequence Number
Example
• Suppose a TCP connection is transferring a file of 5,000 bytes. The first byte
is numbered 10,001.What are the sequence numbers for each segment if
data are sent in five segments, each carrying 1,000 bytes?
Solution
• The following shows the sequence number for each segment:
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 20
TCP Overview
TCP Header
Acknowledgment Number
A 32-bit field used to indicate that data has been received and the nextt byte
expected from the source.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 21
TCP Overview
TCP Header
Acknowledgement Number
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 22
TCP Overview
TCP Header
Making Conversations Reliable
6 Bits
0 = OFF
1 = ON
• URG – if urgent data is issued.
• FIN – no more data from sender. © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 23
TCP Overview
TCP Header
Push Function
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 25
TCP Overview
TCP Header
Urgent Flag
• The URG flag is used to inform a receiving station that certain data within a segment is urgent
and should be prioritized.
• If the URG flag is set, the receiving station evaluates the urgent pointer, a 16-bit field in the
TCP header.
• This pointer indicates how much of the data in the segment, counting from the first byte, is
urgent. © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 26
TCP Overview
TCP Header
Connection Reset
URG ACK PSH RST SYN FIN
TCP at one end may deny a connection request, may abort an existing
connection, or may terminate an idle connection.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 28
Port Numbers
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 29
Port Numbers
Multiple Separate Communications
TCP and UDP transport layer protocols use port numbers to manage multiple,
simultaneous conversations.
The source port number is associated with the originating application on the local host
whereas the destination port number is associated with the destination application on the
remote host.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 30
TCP and UDP Overview
Port Numbers
Source Port
• Originating application
port that is dynamically
generated by sending
device
• Example: Each
separate HTTP
conversation is tracked
based on the source
ports.
Destination Port
• Tell the destination what
service is being
requested
• Example: Port 80 web
services are being
requested © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 31
TCP and UDP Overview
Socket Pairs
Source and destination
port placed in segment
Segments
encapsulated in IP
packet
IP and port number =
socket
Example:
192.168.1.7:80
Sockets enable
multiple processes to
be distinguished
Source port acts as a
return address © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 32
TCP and UDP Overview
Port Number Groups
Port Group Number Range Description
•These port numbers are reserved for common or popular services and applications
Well-known such as web browsers, email clients, and remote access clients.
0 to 1,023
Ports •Defined well-known ports for common server applications enables clients to easily
identify the associated service required.
•These port numbers are assigned by IANA to a requesting entity to use with
specific processes or applications.
•These processes are primarily individual applications that a user has chosen to
Registered
1,024 to 49,151 install, rather than common applications that would receive a well-known port
Ports
number.
•For example, Cisco has registered port 1812 for its RADIUS server authentication
process.
Well
Known
Port
Numbers
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 34
TCP and UDP Overview
The netstat Command
Network utility that
can be used to verify
connections
By default, will
attempt to resolve IP
addresses to domain
names and port
numbers to well-
known applications
-n option used to
display IPs and ports
in numerical form
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 35
TCP Communication Process
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 36
TCP Communication Process Each application process
running on a server is
TCP Server Process configured to use a port
number.
An individual server cannot
have two services assigned to
the same port number within
the same transport layer
services.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 37
TCP Communication Process
TCP Server Process (Cont.)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 40
TCP Communication Process
Video Demonstration - TCP 3-Way Handshake
SYN
SYN, ACK
ACK
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 41
TCP Communication Process
TCP Session Termination
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 43
Reliability and Flow Control
TCP Flow Control – Window Size and Acknowledgments
In the figure, the
source is transmitting
1,460 bytes of data
within each segment.
Window size agreed
on during 3-way
handshake.
Typically, PC B will not
wait for 10,000 bytes
before sending an
acknowledgment.
PC A can adjust its
send window as it
receives
acknowledgments
from PC B. © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 44
Reliability and Flow Control
TCP Reliability- Guaranteed and Ordered Delivery
o Go-Back-N.
o Selective repeat © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 46
Reliability and Flow Control
TCP Reliability – Data Loss and Retransmission
o Go-Back-N.
o Selective repeat
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 47
Reliability and Flow Control
TCP Reliability – Data Loss and Retransmission
Go-Back-N Example
Packets 0, 1, 2, and 3 are sent.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 50
Reliability and Flow Control
TCP Flow Control – Congestion Avoidance
Congestion causes
retransmission of lost
TCP segments
Retransmission of
segments can make the
congestion worse
To avoid and control
congestion, TCP employs
several congestion
handling mechanisms,
timers, and algorithms
Example: Reduce the
number of bytes it sends
before receiving an
acknowledgment
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 51
Congestion Control
Congestion in a network may occur if the load on the
network(the number of packets sent to the network) is The sender has two pieces of
greater than the capacity of the network (the number of information:
packets a network can handle).
the receiver-advertised window
Congestion control refers to the mechanisms and size
techniques to control the congestion and keep the load
and the congestion window size
below the capacity.
(cwnd).
Congestion happens in any system that involves
The actual size of the window is the
waiting.
minimum of these two:
Congestion in a network or internetwork occurs
because routers and switches have queues (buffers
that hold the packets before and after processing).
The packet is put in the appropriate output queue and
waits its turn to be sent.
These queues are finite, so it is possible for more
packets to arrive at a router than the router can buffer.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 52
Congestion Policy
1. Slow start, exponential increase
1
cwnd
RTT
2
cwnd
RTT
4
cwnd
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 53
Congestion Policy
2. Congestion Avoidance: Additive Increase
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 54
Congestion Detection: Multiplicative Decrease
Most TCP implementations have two reactions:
1. If a time-out occurs, there is a stronger possibility of congestion; a segment has probably been
dropped in the network and there is no news about the following sent segments. In this case TCP
reacts strongly:
a) It sets the value of the threshold to half of the current window size.
b) It reduces cwnd back to one segment.
c) It starts the slow start phase again.
2. If three duplicate ACKs are received, there is a weaker possibility of congestion; a segment may have
been dropped but some segments after that have arrived safely since three duplicate ACKs are received. This is
called fast transmission and fast recovery.
In this case, TCP has a weaker reaction as shown below:
a) It sets the value of the threshold to half of the current window size.
b) It sets cwnd to the value of the threshold (some implementations add three segment sizes to the
threshold).
c) It starts the congestion avoidance phase © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 55
UDP Overview and Communication
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 56
UDP Overview
UDP Features
Source Port A 16-bit field used to identify the source application by port number.
Destination Port A 16-bit field used to identify the destination application by port number.
Length A 16-bit field that indicates the length of the UDP datagram header.
Checksum A 16-bit field used for error checking of the datagram header and data.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 58
UDP Overview
Multiple Separate Communications
Users expect to
simultaneously
receive and
send email, view
websites and
make a VoIP
phone call
TCP and UDP
manage multiple
conversations
by using unique
identifiers called
port numbers.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 59
UDP Communication
UDP Low Overhead versus Reliability
UDP not
connection-
oriented
No
retransmission,
sequencing,
and flow
control
Functions not
provided by the
transport layer
implemented
elsewhere
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 60
UDP Communication
UDP Datagram Reassembly
UDP
reassembles
data in order
received and
forwards to
application
Application
must identify
the proper
sequence
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 62
UDP Communication
UDP Client Processes
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 66
Quiz
What is the Size of the UDP Packet Header in the Transport Layer?
a) 8 bytes
b) 16 bytes
c) 20 bytes
d) 12 bytes
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 67