ppsx presentation
Download
Report
Transcript ppsx presentation
The transport layer in the
TCP/IP - OSI models
Laurent Babout
Introduction
• In this lecture, you will learn:
– The purpose of the transport layer
– Its functionality
– How the protocol adapts to the application
data
2
Roles of the transport layer
• Purpose
– Tracking individual conversation (controlling
conversation)
– Identifying the Applications
– Segmenting Data / Reassembling segments
– Adapt to data requirements
Source: cisco CCNA Exploration 4.0
3
Roles of the transport layer (ct’d)
• Example: a PC is connected to the network that is
simultaneously dealing with a variety of applications, e.g.
sending and receiving emails, browsing the web,
conducting VoIP phone calls.
• Each app. has its own requirements:
– Data have to be redirected to the right application
– Email and web contents must be complete, but delays are
acceptable
– Live calls are requested (limited delays), but missing parts can
be acceptable
• Simultaneous and concurrent applications
– To ensure simultaneous applications, dividing data into small
parts (pieces or conversations) is foreseen (in accordance with
Transport layer protocols)
– Need also a way to reassemble the conversations
The solution: adding headers to the conversations. This header
contains fields of bits. The values enable the Transport layer
protocols to perform different functions.
4
Role #1:Controlling the conversations
• 4 main principles of the protocol (more details later
on)
– Establish session between end devices
• Communication between applications
– Reliable delivery
• Retransmission of corrupted or lost data to the destination
– Same order delivery
• Numbering and sequencing the segments for reassembling in proper
order
– Flow control
• Regulation of the amount of data transmitted to avoid overflow, loss
of segments and the need for retransmission
5
Role #1:Controlling the conversations (ct’d)
• Reliable communication
– Tracking transmitted data
– Acknowledge received data
– retransmitting any unacknowledged data
• However, the degree of reliability depends on
the application/data
– Trade-off between
reliability and
network capacity
– Different required
protocols properties
Source: cisco CCNA Exploration 4.0
6
Role #1:Controlling the conversations (ct’d)
• Adapt protocol to the conversation
• Two “most popular” protocols with different properties
– TCP: Transmission Control Protocol
– UDP: User Datagram Protocol
TCP
UDP
• Connection-oriented protocol
• Simple, connectionless protocol
•20 bytes of overhead
•8 bytes of overhead
• Main functions: same order delivery,
reliable delivery, flow control
• Datagram sent as “Best effort”
• Main applications:
• Web browsers
• E-mail
• File transfers
• Main applications:
• Domain Name System (DNS)
• Video streaming
• Voice over IP (VoIP)
7
Role #1:Controlling the conversations (ct’d)
TCP protocol
Bit(0)
Bit(15) Bit(16)
Destination port (16)
20 bytes
Source port (16)
Bit(31)
Sequence number (32)
Acknowledgement number (32)
Header length(4) Reserved(6) Flags (6)
Window (16)
Checksum (16)
Urgent (16)
Options (0 to 32 if any)
APPLICATION LAYER DATA (size varies)
UDP protocol
Bit(15) Bit(16)
Source port (16)
Destination port (16)
Length (16)
Checksum (16)
APPLICATION LAYER DATA (size varies)
See more details later on…
Bit(31)
8 bytes
Bit(0)
8
Role #2: Identifying the application
- port addressing
• TCP/UDP keep track of communicating apps
• In segment/datagram header, 1st 4 bytes refer to source and
destination ports
• Client/server are sequentially associated to
source/destination protocols during communication
• Port values have different meaning, correspond to different
types of conversations
• Assignment differ for client and server
– client: random port number, usually above 1023
– server: static assignment (port daemon service)
•
•
•
•
port 80 http
Port 110 POP3
Port 21 telnet
…
9
Role #2: Identifying the application port addressing (ct’d)
• 3 different domains for port addressing
– 0 to 1023: well-known (contact) ports
– 1024 to 49151: registered ports / dynamic ports
– 49152 to ?????:
65535 private and/or dynamic ports
• Client ports dynamically assigned from 2nd and
3rd domain (depend on operating system)
• Well-known services and apps in 1st domain
• User processes and apps. in 2nd domain
• Exhaustive list of well-known / registered ports:
http://www.iana.org/assignments/port-numbers.
10
Role #2: port addressing (ct’d)
TCP
Well-known
ports
21
22
23
25
80
110
443
FTP
SSH
Telnet
SMTP
HTTP
POP3
HTTPS
Register
ports
1863 MSN Mess.
8080 Alternate HTTP
UDP
TCP/UDP
69 TFTP
520 RIP
53 DNS
161 SNMP
531 AOL chat
2000 CiscoSCCP 1433 MS SQL
5060 SIP(VoIP)
2948 WAP
11
Role #2: port addressing (ct’d)
• Check active connection and port used
– Netstat: simplistic description
Destination port
Connection state
Protocol used Source port
C:\>netstat
Active Connections
Proto Local Address
Foreign Address
State
TCP img2008:3848
zly.kis.p.lodz.pl:22
ESTABLISHED
TCP img2008:3894
fra07s07-in-f104.1e100.net:http
ESTABLISHED
TCP img2008:4310
symbianversion.mobilevoip.com:httpESTABLISHED
– WireShark: advanced network protocol analyser
Protocol used
Source port (2 bytes)
d774 ≡ 55156
8 bytes (Hex)
12
Role #3: Segmenting and
Reassembling the data - divide and
conquer
• Why segmenting large data?
– Impractical to send data in 1 piece (network blocked
during transmission)
– Error handling (everything is lost)
– Problem with Network memory buffer
– Data transfer overflow
• Dividing data into pieces ensures
– Data transmitted within limits of media
– Data multiplexing
• TCP and UDP handles differently segmentation
13
Role #3: divide and conquer (ct’d)
The transport layer divides
the data into pieces and
adds a header for delivery
over the network
UDP:
• Faster transfer than TCP
• No control of data order:
reassembling may be in
different order than
segmenting
TCP:
• Sequence number,
reassemble segments
in same order as transmitted
• Slower transfer than UDP
UDP Header contains:
• Source port
• Destination port
• Sequencing for same order
delivery
• Acknowledgement of
received segments
•Flow control and congestion
management
14
Source: cisco CCNA Exploration 4.0
UDP Header contains:
• Source port
• Destination port
Role #3: divide and conquer (ct’d)
15
A closer look to TCP
Bit(0)
Source port (16)
Bit(15) Bit(16)
Last octet of sequence
Sequence number (32)
Bit(31)
Destination port (16)
Next octet expected by receiver
Acknowledgement number (32)
Header length(4) Reserved(6) Flags (6)
Window (16)
Checksum (16)
Urgent (16)
Used in session management and in
Options (0 to 32 if any)
the treatment of segments
APPLICATION LAYER DATA (size varies)
Value of dynamic window – how
many octet can be sent before waiting
for acknowledgement
Used for errors – check the header
and data
16
TCP – making conversations reliable
• Connection-orientated session
– Before data are sent, Transport layer creates
connection
– After session established, destination sends
acknowledgment to the source for the
received segments
– If source receives ack., OK. Otherwise, data
resent
– Connection terminated
17
Connection – the 3-way-handshake
• 1st step: client sends server a segment with SYN
(synchronization) flag
• Sequence value set to 0 (default)
18
Connection – the 3-way-handshake
(ct’d)
• 2nd step: server acknowledges reception (ACK
flag) and send request (SYN flag) to client
• ACKse=SEQcl+1, SEQse=0
19
Connection – the 3-way-handshake
(ct’d)
• 3rd step: client responds with acknowledgment
flag
• ACKcl=SEQse+1
20
Connection –
the 3-way handshake
(ct’d)
• To conclude, we can compare the 3-way
handshake to a phone conversation
• Hi, do you hear me (SYN 1)
• Yes, I hear you. (ACK1)
• And you, do you hear me (SYN 2)
• Yes. I hear you too (ACK 2)
(conversation starts)
21
Termination: the 4-way handshake
A
1
B
Send FIN
FIN received
Send ACK 2
ACK received
Send FIN
3
FIN received
4
Send ACK
ACK received
Two 2-way handshakes. Can be initiated by any 2 hosts (i.e. client or server).
Why?
The operation is complete: the server terminates the conversation. OR, the
client cancel the operation: the client terminates the conversation.
22
TCP - segment reassembly
• When service sends data using TCP, segments may arrive to
destination out of order
• Sequence number from the header used for that
• Session starts, an initial sequence number (ISN) is set
• This number is incremented by the number of bytes being
transferred in a segment
• So, each segment is unique. Missing segments can be identified as
well
• How does it work to reassemble?
–
–
–
–
TCP places segments in buffer
Reordered in the proper sequence number order
Passed to the application layer
Segments held if arrived with noncontiguous sequence numbers
23
TCP - segment reassembly (ct’d)
• Schematic representation
Source: cisco CCNA Exploration 4.0
24
TCP – confirming segments receipt
• One of TCP’s function: make sure that segments reach
destination
• Sequence and acknowledgment numbers used for that
• Sender ack. number: fixed number (e.g. 1)
• Receiver seq. number = Sender ack. Number
• Receiver ack. Number=Sender seq. number+length(segment)
Source: cisco CCNA Exploration 4.0
25
TCP – confirming segments receipt(ct’d)
• Wireshark view
Segment sent by server
Fixed ack. number during segment transmission
Acknowledgment of reception by client
Next starting octet expected
26
TCP – congestion control
• Flow control
– Window size in TCP header determines the number of bites sent
before an ack. is expected
– The ack. Number is the number of the next expected byte
Source: cisco CCNA Exploration 4.0
27
TCP – congestion control (ct’d)
• Reducing window size
– If congestion at the destination occurs because size of segment
too large, window size is reduced
– Size typically reduced by 2
– New size send as part of an acknowledgment
Source: cisco CCNA Exploration 4.0
28
A closer look at UDP
• Simple transport protocol providing basic layer functions
• Connection-less, no data retransmission, no sequencing,
no flow control as TCP
• Simpler does not mean unreliable. Just need
reajustment elsewhere than in the transport layer if
required
• Examples of Application layer protocols which use UDP
–
–
–
–
–
Domain Name System (DNS)
Simple Network Management Protocol (SNMP)
Dynamic Host Configuration Protocol (DHCP)
Routing Information Protocol (RIP)
Online games (can accept loss of data)
29
UDP – datagram reassembly
• Connection-less: No session established, no
acknowledgement
• The data is reassembled in the order it arrives at destination
Source: cisco CCNA Exploration 4.0
30
UDP – processes and request
• Server process
– Like TCP-based apps, UDP-based server apps are
assigned Well-known or Registered port
• Client process
– Like TCP-based apps, UDP-based client apps are
assigned randomly
– Use as source port for the conversation
• During conversation, both ports are
interchanged in the source/destination fields of
the header
31