ppt - Courses

Download Report

Transcript ppt - Courses

Introduction to Computer
Networks
CMPE 150
Fall 2005
Lecture 26
CMPE 150- Introduction to Computer Networks
1
Announcements
• Homework 5 posted.
– Due, Mon, 12.05.
• There will be a lab this week.
– Wed session will be looonger!
• Final exam: December 7th. 4-7pm
– In class.
– Closed books/notes.
• Course evaluation.
– Last day of class.
• CE 151 will be offered in Winter 06!
CMPE 150- Introduction to Computer Networks
2
Today
• Transport Layer!
– Chapter 6 of Tanenbaum.
CMPE 150- Introduction to Computer Networks
3
The Transport Layer
• End-to-end.
– Communication from source to destination host.
– Only hosts run transport-level protocols.
– Under user’s control as opposed to network layer which
is controlled/owned by carrier.
CMPE 150- Introduction to Computer Networks
4
The Transport Service
• Service provided to application layer.
• Transport entity: process that implements the
transport protocol running on a host.
– Typically at OS kernel, or user-level process.
CMPE 150- Introduction to Computer Networks
5
The Transport Layer
Source host
Destination host
Application
Layer
Transport
address
Transport
Entity
Network
Layer
Network
Address
Application
Layer
Application/
transport
interface
TPDU
Transport/
network
interface
TPDU = Transport Protocol Data Unit
CMPE 150- Introduction to Computer Networks
Transport
Entity
Network
Layer
6
Types of Transport Services
• Connection-less versus connection-oriented.
• Connection-less service: no logical
connections, no flow or error control.
• Connection-oriented:
– Based on logical connections: connection setup, data
transfer, connection teardown.
– Flow and error control.
CMPE 150- Introduction to Computer Networks
7
Transport Protocol Issues:
Addressing
• Address of the transport-level entity.
• TSAP: transport service access point
(analogous to NSAP).
–
–
–
–
Internet TSAP: (IP address, local port).
Internet NSAP: IP address.
There may be multiple TSAPs on one host.
Typically, only one NSAP.
CMPE 150- Introduction to Computer Networks
8
Addressing: Example
• TSAPs, NSAPs and transport connections.
CMPE 150- Introduction to Computer Networks
9
Finding Services
• Well-known TSAP.
– Time-of-day server has been using TSAP 1522
forever so every users know it.
CMPE 150- Introduction to Computer Networks
10
Finding Services Alternative
• Name or directory service.
– Name server listens to well-known TSAP.
– User sends service name and name server
responds with service’s TSAP.
– New services need to register with name server.
CMPE 150- Introduction to Computer Networks
11
The Internet Transport Layer
• Two main protocols:
– TCP: Transmission Control Protocol.
– UDP: User Datagram Protocol.
CMPE 150- Introduction to Computer Networks
12
UDP
CMPE 150- Introduction to Computer Networks
13
UDP
•
•
•
•
•
RFC 768.
No connection establishment.
No reliability.
No ordering.
No flow- or congestion control.
CMPE 150- Introduction to Computer Networks
14
The UDP Header
• 8 bytes.
• Optional checksum.
CMPE 150- Introduction to Computer Networks
15
TCP
CMPE 150- Introduction to Computer Networks
16
Transmission Control Protocol
• RFCs 793, 1122, and 1323.
• Reliable end-to-end.
• Expects unreliable network.
CMPE 150- Introduction to Computer Networks
17
The TCP Service Model
• Ports below 1024 are reserved.
• Some assigned ports (for more look at
www.iana.org).
Port
21
23
25
69
79
80
110
119
Protocol
FTP
Telnet
SMTP
TFTP
Finger
HTTP
POP-3
NNTP
CMPE 150- Introduction to Computer Networks
Use
File transfer
Remote login
E-mail
Trivial File Transfer Protocol
Lookup info about a user
World Wide Web
Remote e-mail access
USENET news
18
TCP Connections
• Point-to-point.
• Full duplex.
• Byte stream.
CMPE 150- Introduction to Computer Networks
19
The TCP Service Model (2)
• (a) Four 512-byte segments sent as separate IP
datagrams.
• (b) The 2048 bytes of data delivered to the
application in a single READ CALL.
CMPE 150- Introduction to Computer Networks
20
TCP Segment
• Header:
– 20 bytes mandatory.
– Options.
• Payload:
– Up to (64 Kbytes – 20 -20) of data.
CMPE 150- Introduction to Computer Networks
21
The TCP Header
CMPE 150- Introduction to Computer Networks
22
Connection Establishment
CMPE 150- Introduction to Computer Networks
23
Three-Way Handshake
• Solves the problem of getting 2 sides to agree
on initial sequence number.
1
2
CR (seq=x)
CR: connection
request.
ACK(seq=y,ACK=x)
DATA(seq=x, ACK=y)
CMPE 150- Introduction to Computer Networks
24
Delayed Duplicates
2
1
*
CR(seq=x)
ACK(seq=y, ACK=x)
REJECT(ACK=y)
CMPE 150- Introduction to Computer Networks
. Old duplicate CR.
. The ACK from host 2 tries
to verify if host 1 was trying to
open a new connection with
seq=x.
. Host 1 rejects host 2’s attempt
to establish.
Host 2 realizes it was a duplicate
CR and aborts connection.
25
Delayed Duplicates
2
1
*
CR(seq=x)
. Old duplicate CR and ACK
to connection accepted.
ACK(seq=y, ACK=x)
DATA(seq=x,
ACK=z)
REJECT(ACK=y)
CMPE 150- Introduction to Computer Networks
26
TCP Connection Establishment
6-31
CMPE 150- Introduction to Computer Networks
27
Sequence Numbers versus
Time 1
Seq.
#’s
. Linear relation between time
and initial sequence number.
Time
CMPE 150- Introduction to Computer Networks
28
Connection Release
• Asymmetric release: telephone system.
– When one party hangs up, connection breaks.
– May cause data loss.
• Symmetric release:
– Treats connection as 2 separate unidirectional
connections.
– Requires each to be released separately.
CMPE 150- Introduction to Computer Networks
29
Symmetric Release
• How to determine when all data has been sent
and connection could be released?
• 2-army problem:
Blue army 1
Blue army 2
. White army larger
than either blue armies.
White army
. Blue army together is
larger.
. If each blue army attacks, it’ll be defeated. They win if attack together.
CMPE 150- Introduction to Computer Networks
30
2-Army Problem
• To synchronize attack, they must use
messengers that need to cross valley:
unreliable.
• Is there a protocol that allows blue army to
win? No.
– Blue army 1 sends message to blue army 2.
– Blue army 2 sends ACK back.
– Blue army 2 is not sure whether ACK was
received.
CMPE 150- Introduction to Computer Networks
31
2-Army Problem (Cont’d)
• Use 2-way handshake.
– Blue army 1 ACKs back but it’ll never know if the ACK
was received.
• Applying to connection release:
– Neither side is prepared to disconnect until convinced
other side is prepared to disconnect.
– In practice, hosts are willing to take risks.
CMPE 150- Introduction to Computer Networks
32
Connection Release Protocol
Send DR+
start timer
DR
DR
Release
connection
Send
ACK
DR: disconnection
request.
Send DR+
start timer
ACK
CMPE 150- Introduction to Computer Networks
Release
connection
33
Connection Release: Scenario
1
Send DR+
start timer
DR
DR
Release
connection
Send
ACK
DR: disconnection
request.
Send DR+
start timer
ACK
CMPE 150- Introduction to Computer Networks
Timeout:
Release
connection
34
Connection Release: Scenario
2
Send DR+
start timer
DR: disconnection
request.
DR
DR
Timeout:
send DR+
start timer
Send DR+
start timer
DR
Send DR+
start timer
DR
ACK
CMPE 150- Introduction to Computer Networks
Release
connection
35
TCP Connection Release
• Each side released independently.
– TCP segment with FIN bit set.
– Means that side has no more data to send.
• When both sides have shutdown, connection
is released,
CMPE 150- Introduction to Computer Networks
36
TCP Connection Release
FIN
FIN ACK
FIN
FIN ACK
Timers to avoid 2-army problem.
CMPE 150- Introduction to Computer Networks
37