Download Chapter3 Transport Layer1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Asynchronous Transfer Mode wikipedia , lookup

Computer network wikipedia , lookup

CAN bus wikipedia , lookup

Airborne Networking wikipedia , lookup

TCP congestion control wikipedia , lookup

Deep packet inspection wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Parallel port wikipedia , lookup

Network tap wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

IEEE 1355 wikipedia , lookup

Internet protocol suite wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

UniPro protocol stack wikipedia , lookup

Transcript
Transport Layer
CS 381
2/16/2017
2-1
Chapter 3: Transport Layer
Goals:
•
Understand principles behind transport layer
services:
•
•
•
•
•
Multiplexing, demultiplexing
Reliable data transfer
Flow control
Congestion control
Learn about Internet transport layer
protocols:
• UDP: connectionless transport
• TCP: connection-oriented reliable transport
• TCP: flow and congestion control
Transport Layer 3-2
Chapter 3 outline
3.1 transport-layer services
3.2 multiplexing and demultiplexing
3.3 connectionless transport: UDP
3.4 principles of reliable data transfer
3.5 connection-oriented transport: TCP
 segment structure
 reliable data transfer
 flow control
 connection management
3.6 principles of congestion control
3.7 TCP congestion control
Transport Layer 3-3
Transport services and protocols
•
Provides logical communication
between app processes
running on different hosts
application
transport
network
data link
physical
• As if hosts are directly connected
•
Transport protocols run in
end systems
• Send side: breaks app messages
into segments, passes to
network layer
• Rcv side: reassembles segments
into messages, passes to app
layer
application
transport
network
data link
physical
Transport Layer 3-4
Transport vs. network layer
•
Network layer:
• Communication between hosts
• IP
•
Transport layer:
• Communication between processes running on end
systems
• TCP, UDP
• Relies on, enhances, network layer services
Transport Layer 3-5
Internet transport-layer protocols
•
TCP: reliable, in-order delivery
• Congestion control
• Flow control
• Connection setup
•
UDP: unreliable, unordered
delivery
• No-frills extension of “best-effort”
• Connectionless, unreliable
• UDP only offers process-to-process
communication and error checking
•
Services not available:
application
transport
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
application
transport
network
data link
physical
• Delay guarantees
• Bandwidth guarantees
Transport Layer 3-6
Chapter 3 outline
3.1 transport-layer services
3.2 multiplexing and demultiplexing
3.3 connectionless transport: UDP
3.4 principles of reliable data transfer
3.5 connection-oriented transport: TCP
 segment structure
 reliable data transfer
 flow control
 connection management
3.6 principles of congestion control
3.7 TCP congestion control
Transport Layer 3-7
Multiplexing and demultiplexing
•
At sending host:
• Transport layer encapsulates data from application layer process
•
At destination host:
• Transport layer delivers data to the appropriate process
•
Example:
• Your desktop is connected to two Websites, using SSH to
connect to a remote server, and checking email
• Desktop has four network aware processes running
•
When the desktop transport layer receives data
from the network, it must direct data to one of
Transport Layer 3-8
those four processes
Multiplexing/demultiplexing
Sender multiplexing:
handles data from multiple
sockets, add transport header
(later used for demultiplexing)
Receiver demultiplexing:
use header info to deliver
received segments to correct
socket
application
application
P1
P2
application
P3
transport
P4
transport
network
transport
network
link
network
physical
link
link
physical
socket
process
physical
Transport Layer 3-9
How demultiplexing works
•
IP datagrams
• Each datagram has source IP address,
destination IP address
• Each datagram carries one transportlayer segment
• Each segment has source, destination
port number
32 bits
source port #
dest port #
other header fields
• 16 bit, 0 – 65535 range for port numbers
•
host uses IP addresses & port
numbers to direct segment to
appropriate socket
application
data
(payload)
TCP/UDP segment format
Transport Layer 3-10
Connectionless demultiplexing
Recall: created socket
has host-local port #:
•
• 12345
•
When creating datagram
to send into UDP socket,
must specify
• destination IP address
• destination port #
•
When host receives
UDP segment:
• Checks destination port
# in segment
• Directs UDP segment to
socket with that port #
NOTE:
Datagrams with same
destination port #, but different
source IP addresses and/or
source port numbers will be
directed to same socket on
destination host
Problem?
Transport Layer 3-11
Connectionless demux: example
Server socket with
port number 6428
Client socket with
port number 9157
Client socket with
port number 5775
application
application
application
P1
P3
P4
transport
transport
transport
network
network
link
network
link
physical
link
physical
physical
source port: 6428
dest port: 9157
source port: 9157
dest port: 6428
source port: ?
dest port: ?
source port: ?
dest port: ?
Transport Layer 3-12
Connection-oriented demux
•
TCP socket identified by 4-tuple:
•
•
•
•
•
Source IP address
Source port number
Destination IP address
Destination port number
Demux:
• Receiver uses all four values to direct segment to appropriate
socket
•
Two arriving TCP segments with different source
IP addresses or source port numbers will be
directed to different sockets.
Transport Layer 3-13
Connection-oriented demux
•
Server host may support many simultaneous
TCP sockets:
• Each socket identified by its own 4-tuple
•
Web servers have different sockets for each
connecting client
• Non-persistent HTTP will have different socket
for each request
Transport Layer 3-14
Connection-oriented demux: example
application
application
P4
P5
application
P6
P3
P3
P2
transport
network
network
link
network
link
physical
link
physical
host: IP
address A
transport
transport
server: IP
address B
source IP,port: B,80
dest IP,port: A,9157
source IP,port: A,9157
dest IP, port: B,80
three segments, all destined to IP address: B,
dest port: 80 are demultiplexed to different sockets
physical
source IP,port: C,5775
dest IP,port: B,80
host: IP
address C
source IP,port: C,9157
dest IP,port: B,80
Transport Layer 3-15
Connection-oriented demux: example
threaded server
application
application
P3
application
P4
P3
P2
transport
network
network
link
network
link
physical
link
physical
host: IP
address A
transport
transport
server: IP
address B
source IP,port: B,80
dest IP,port: A,9157
source IP,port: A,9157
dest IP, port: B,80
physical
source IP,port: C,5775
dest IP,port: B,80
host: IP
address C
source IP,port: C,9157
dest IP,port: B,80
Transport Layer 3-16
Chapter 3 outline
3.1 transport-layer services
3.2 multiplexing and demultiplexing
3.3 connectionless transport: UDP
3.4 principles of reliable data transfer
3.5 connection-oriented transport: TCP
 segment structure
 reliable data transfer
 flow control
 connection management
3.6 principles of congestion control
3.7 TCP congestion control
Transport Layer 3-17
Designing a bare-bones transport protocol
Sending host:
• Take msg from application and pass directly to network
layer
Receiving host:
• Take msg from network layer and pass directly to
application
Is this enough for a transport layer protocol?
• Not quite
• Transport layer needs multiplexing/demultiplexing for
passing information from network layer to correct
application process
• Port numbers needed
UDP header:
• Source/Destination port #, segment length, checksum
• Total header size: 8 bytes
Transport Layer 3-18
UDP: User Datagram Protocol [RFC 768]
•
UDP Introduction from RFC 768
• Developed: 1980
UDP is defined to make available a datagram mode of
packet-switched computer communication in the
environment of an interconnected set of computer
networks. This protocol assumes that the Internet
Protocol (IP) is used as the underlying protocol.
This protocol provides a procedure for applications
to send messages to other applications with a
minimum of protocol mechanism. The protocol is
transaction oriented, and delivery and duplicate
protection are not guaranteed.
Transport Layer 3-19
UDP: User Datagram Protocol [RFC 768]
•
•
•
“no frills,” “bare bones” Internet transport
protocol
“best effort” service, UDP segments may be:
• Lost
• Delayed
• Delivered out-of-order to app
Connectionless:
• No handshaking between UDP sender,
receiver
• Each UDP segment handled independently
of others
Transport Layer 3-20
UDP: User Datagram Protocol [RFC 768]
•
UDP use:
• Streaming multimedia apps (loss tolerant, rate sensitive)
• DNS
• SNMP
•
Reliable transfer over UDP:
• Add reliability at application layer
• Application-specific error recovery!
• Why would anyone do this? TCP already handles
error recovery in the Transport layer…
Transport Layer 3-21
UDP: segment header
length, in bytes of UDP
segment, including header
32 bits
source port #
length
dest port #
checksum
application
data
(payload)
UDP segment format
UDP functions limited to:
• Addressing
• The only strictly necessary
role of a transport protocol
• Error checking
• May be disabled for
performance
Transport Layer 3-22
User Datagram Protocol
Why UDP?
•
•
•
No connection establishment (which
can add delay)
Simple: no connection state at
sender, receiver
Small header size
• 8 bytes
•
•
No congestion control: UDP can
blast away as fast as desired
Tradeoff:
• Simple design but not reliable
Transport Layer 3-23
Unregulated send rate
UDP has no sending rate limitations
• No throttling due to congestion and flow
control mechanisms
• No retransmissions
Extremely important features for multimedia
applications
Transport Layer 3-24
UDP checksum
Goal:
Detect “errors” (e.g., flipped bits) in transmitted
segment
Sender:
•
•
•
Treat segment contents, including header fields, as
sequence of 16-bit integers
Checksum: addition (one’s complement sum) of segment
contents
Sender puts checksum value into UDP checksum field
Transport Layer 3-25
UDP checksum
Receiver:
•
Compute checksum of received segment
• Add segment contents and compare with UDP checksum field
•
Check if computed checksum equals checksum
field value:
• NO - error detected
• YES - no error detected.
• But maybe errors nonetheless? More later ….
Transport Layer 3-26
Internet checksum: example
Example: add two 16-bit integers
1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
Note: when adding numbers, a carryout from the
most significant bit needs to be added to the result
Transport Layer 3-27
UDP checksum
•
So, why would UDP provide error checking when
many link layer protocols (like Ethernet) also
provide error checking?
• Not every link protocol provides error checking
• Bit errors could be introduced while stored in routers/switches
• Transport layer error detection must be implemented on the end
systems.
•
Note: Even though UDP provides error checking,
it provides no support for recovering from an error.
• Receiver just simply drops the damaged segment
• Or pass the damaged segment to the app layer with a warning
Transport Layer 3-28
Conclusion: UDP
•
User Datagram Protocol (UDP):
•
•
•
•
•
•
Provides an unreliable datagram service
Packets may be lost or delivered out of order
No buffer at sender or receiver
Unreliable, but fast
Application must deal with lost or corrupt packets
Goals of UDP:
• Process identification
• Port numbers as demux key
• Minimal support beyond network layer protocol, IP
•
When to use UDP:
• Reduce the requirement of computing resources
• Error handling is provided by the application layer
• Transmission of real-time packets
Transport Layer 3-29
Chapter 3 outline
3.1 transport-layer services
3.2 multiplexing and demultiplexing
3.3 connectionless transport: UDP
3.4 principles of reliable data transfer
3.5 connection-oriented transport: TCP
 segment structure
 reliable data transfer
 flow control
 connection management
3.6 principles of congestion control
3.7 TCP congestion control
Transport Layer 3-30