Chapter 4
Transport Layer
Overview
Explain the role of Transport Layer protocols and
services in supporting communications across data
networks
Analyze the application and operation of TCP
mechanisms that support reliability
Analyze the application and operation of TCP
2
Analyze the application and operation of TCP
mechanisms that support reassembly and manage data
loss.
Analyze the operation of UDP to support communicate
between two processes on end devices
Transport Layer Overview
Transport Layer
TCP UDP
4
Transport Layer:
Responsible for creating and maintaining a logical connection
between the endpoints
What are the two protocols at the transport layer?
TCP – Transmission Control Protocol
UDP – User Datagram Protocol
Transport Layer Role and Services
Major functions of the transport layer and the role it plays
in data networks
– Tracking the individual communication between
applications on the source and destination hosts.
– Segmenting data and managing each piece.
–
Reassembling
the segments into streams of application
5
–
Reassembling
the segments into streams of application
data.
– Identifying the different applications
TCP Header UDP Header
What is the application
PDU called?
6
Application
Header + data
or
PDU: Segment
PDU: Data
What is the transport
PDU called?
Transport Layer
www.cisco.com
TCP Segment
7
Primary responsibilities:
Tracking the individual communication between applications
Who is the client? Which application? Which process?
Identifying the different applications (HTTP, FTP, etc.)
Segmenting data
Managing each segment
Reassembling the segments
TCP Segment
TCP Segment
TCP Segment
What two protocols are at the Transport Layer?
segment
segment
8
TCP
UDP
IP is a best-effort delivery service. What does that mean?
No guarantees
Best-effort service
“Unreliable service”
TCP/UDP is responsible for extending IP’s delivery service between two
end systems.
TCP vs. UDP
TCP provides:
Reliable delivery
Error checking
Flow control
UDP provides:
Unreliable delivery
No error checking
No flow control
Why would any application use UDP?
What is the “cost” of all this reliability
and flow control of TCP?
Streaming media, real-time multiplayer
games and voice over IP (VoIP)
applications that do not require
reliability mechanisms and may even
be hindered by them.
9
Flow control
Congestion control
Ordered delivery
Connection establishment
Applications:
HTTP
FTP
Telnet
MSN messenger
No flow control
No congestion control
No ordered delivery
No connection establishment
Applications
DNS (usually)
SMTP
DHCP
RTP (Real-Time Protocol)
VoIP
TCP
TCP
TCP
HTTP
HTTP
FTP
SMTP
Cabrillo
Web
Server
ISP’s
10
A single client may have multiple transport connections with multiple
servers.
Notice that TCP is a connection-oriented service (two-way arrow)
between the hosts, whereas UDP is a connectionless service (one-way
arrow) . (later)
TCP
TCP
TCP
TCP
UDP
UDP
ISP’s
Email
and FTP
Server
Port Numbers: TCP and UDP
0 15
16 31
16-bit Source Port Number
16-bit Destination Port Number
32
-
bit Sequence Number
TCP Header
UDP Header
12
Both TCP and UDP use ports (or sockets) numbers to pass information to the
upper layers.
32
-
bit Sequence Number
32 bit Acknowledgement Number
4-bit Header
Length
6-bit
(Reserved)
U
R
G
A
C
K
P
S
H
R
S
T
S
Y
N
F
I
N
16-bit Window Size
16-bit TCP Checksum
16-bit Urgent Pointer
Options (if any)
Data (if any)
HTTP is Port 80
The application this TCP
segment came from.
The application this TCP
segment is going to.
13
The application this TCP
segment came from.
The application this TCP
segment is going to.
Application
Header + data
Port numbers are used to
by the sender to tell the
receiver which network
application it should use
for the “Data”.
Port Number
14
Application
Header + data
Port numbers are used by
the receiver so it knows
which application it should
send the “Data” to.
Port Number
/>15
The Internet Assigned Numbers Authority (IANA) assigns port
numbers.
16
Well Known Ports (Numbers 0 to 1023)
Reserved for common services and
applications
Client: TCP destination port
Server: TCP source port
Well Known or Registered
Port Number
Well Known or Registered
Port Number
Well Known or Registered
Port Number
17
Port Number
Well Known or Registered
Port Number
Registered Ports (Numbers 1024 to 49151)
Assigned to user processes or
applications.
Non-common applications.
Client: TCP destination port
Server: TCP source port
May also be used as dynamic or private
port (next).
Well Known or Registered
Private/Dynamic Port
Well Known or Registered
Private/Dynamic Port
18
Dynamic or Private Ports (Numbers 49152 to 65535)
Also known as Ephemeral Ports
Usually assigned dynamically to client applications when initiating a
connection.
Client: TCP source port
Server: TCP destination port
May also include the range of Registered Ports (Numbers 1024 to
49151)
Well Known or Registered
Port Number
Private/Dynamic Port
Number
Well Known or Registered
Port Number
Private/Dynamic Port
Number
Client Server
Telnet
19
Client TCP Header
0 15
16 31
16-bit Source Port Number
16-bit Destination Port Number
32-bit Sequence Number
32 bit Acknowledgement Number
4-bit Header
Length
6-bit
(Reserved)
U
R
G
A
C
K
P
S
H
R
S
T
S
Y
N
F
I
N
16-bit Window Size
16-bit TCP Checksum
16-bit Urgent Pointer
Options (if any)
Data (if any)
231028
Data for Telnet
20
Client sends TCP segment with:
Destination Port: 23 (Well known port number)
Source Port: 1028 (Dynamic Port assigned by client)
Data for Telnet
Client Server
Server TCP Header
0 15
16 31
16-bit Source Port Number
16-bit Destination Port Number
32-bit Sequence Number
32 bit Acknowledgement Number
4-bit Header
Length
6-bit
(Reserved)
U
R
G
A
C
K
P
S
H
R
S
T
S
Y
N
F
I
N
16-bit Window Size
16-bit TCP Checksum
16-bit Urgent Pointer
Options (if any)
Data (if any)
102823
Data for Telnet
21
Server responds with TCP segment with:
Destination Port: 1028 (Dynamic Port assigned by client)
Source Port: 23 (Well known port number)
Client Server
22
Notice the difference in how source and destination port numbers are
used with clients and servers:
Client (initiating Telnet service):
Destination Port = 23 (telnet)
Source Port = 1028 (dynamically assigned)
Server (responding to Telnet service):
Destination Port = 1028 (source port of client)
Source Port = 23 (telnet)
4989049888
23
Same client to same server - Two different HTTP sessions
Client: Same destination port
Client: Different source ports to uniquely identify this web session.
4989049888
24
C:\Users\rigrazia>netstat -n
Active Connections
Proto Local Address Foreign Address State
TCP 192.168.1.101:49888 198.133.219.25:80 TIME_WAIT
TCP 192.168.1.101:49890 198.133.219.25:80 TIME_WAIT
C:\Users\rigrazia>
TCP
or
UDP
Source Port
Destination IP
Destination Port
Connection State
Source IP
192.168.1.101
172.16.5.5
Destination
Port
80
80
80
Source
Port
49890
Source
198.133.219.25
49888
25
What makes each connection unique? How does the server know
which source port 49888 is who?
Connection defined by the pair of numbers:
Source IP address, Source port (From Client to Server)
Destination IP address, Destination port (From Server to
Client)
Different connections can use the same destination port on server
host as long as the source ports or source IPs are different.
172.16.5.5
49888
Source
Port
www.cisco.com