8/2/2019 12 - File Transfer - Comer
1/25
PART XXV
APPLICATIONS:FILE TRANSFER AND ACCESS
(FTP, TFTP, NFS)
Internetworking With TCP/IP vol 1 -- Part 25 1 2005
8/2/2019 12 - File Transfer - Comer
2/25
On-Line File Sharing
d
Always a popular applicationd
Two basic paradigms
Whole-file copying
Piecewise file access
d Piecewise access mechanism
Opaque: application uses special facilities to access
remote file
Transparent: application uses same facilities to accesslocal and remote files
Internetworking With TCP/IP vol 1 -- Part 25 2 2005
8/2/2019 12 - File Transfer - Comer
3/25
File Transfer
d
Whole file copyingd
Client
Contacts server
Specifies file
Specifies transfer direction
Server
Maintains set of files on local disk
Waits for contact
Honors request from client
Internetworking With TCP/IP vol 1 -- Part 25 3 2005
8/2/2019 12 - File Transfer - Comer
4/25
File Transfer Protocol (FTP)
dMajor TCP/IP protocol for whole-file copying
dUses TCP for transport
dFeatures
Interactive access
Format specification (ASCII or EBCDIC)
Authentication control (login and password)
Internetworking With TCP/IP vol 1 -- Part 25 4 2005
8/2/2019 12 - File Transfer - Comer
5/25
FTP Process Model
TCP/IPinternet
operatingsystem
datatransfer
controlprocess
operatingsystem
controlprocess
datatransfer
server systemclient system
client dataconnection
client controlconnection
server controlconnection
server dataconnection
d Separate processes handle
Interaction with user
Individual transfer requests
Internetworking With TCP/IP vol 1 -- Part 25 5 2005
8/2/2019 12 - File Transfer - Comer
6/25
FTPs Use of TCP Connections
Data transfer connections and the data transfer processes that
use them can be created dynamically when needed, but the
control connection persists throughout a session. Once the
control connection disappears, the session is terminated and the
software at both ends terminates all data transfer processes.
Internetworking With TCP/IP vol 1 -- Part 25 6 2005
8/2/2019 12 - File Transfer - Comer
7/25
Control Connection Vs. Data Connection
dFor data transfer, client side becomes server and server side
becomes client
d Client
Creates process to handle data transfer
Allocates port and sends number to server over control
connection
Process waits for contact
d
Server Receives request
Creates process to handle data transfer
Process contacts client-side
Internetworking With TCP/IP vol 1 -- Part 25 7 2005
8/2/2019 12 - File Transfer - Comer
8/25
32AA 2009-2010
performances Il client apre la connessione TCP di controllo con il server; apertaIl client apre la connessione TCP di controllo con il server; aperta
la connessione, invia la richiesta di trasferimento del file su questola connessione, invia la richiesta di trasferimento del file su questocanale.canale.
s Il server quindi apre una separata connessione TCP per trasferirviIl server quindi apre una separata connessione TCP per trasferirviil file.il file.
s Per aprire ogni connessione si richiede un round-trip time di 1Per aprire ogni connessione si richiede un round-trip time di 1
RTT.RTT.x 1/2 RTT perch la richiesta giunga al server, e un altro1/2 RTT perch la richiesta giunga al server, e un altro
1/2 RTT perch la risposta torni indietro, oltre al tempo di1/2 RTT perch la risposta torni indietro, oltre al tempo ditrasmissione del file.trasmissione del file.
s Tempo complessivo per una transazione FTP:Tempo complessivo per una transazione FTP:
1 RTT control-channel OPEN1 RTT control-channel OPEN
0.5 RTT send request on control-channel0.5 RTT send request on control-channel
1 RTT file-channel OPEN1 RTT file-channel OPEN
0.5 RTT file starts to arrive on file-channel0.5 RTT file starts to arrive on file-channel
Ftrans time to transmit the fileFtrans time to transmit the file
----------------
33RTT + Ftrans = time to get the first file in FTPRTT + Ftrans = time to get the first file in FTP
8/2/2019 12 - File Transfer - Comer
9/25
35AA 2009-2010
modello grafico-temporale
s consente di evidenziare, in termini di pacchetti inviati, leconsente di evidenziare, in termini di pacchetti inviati, lecaratteristiche del:caratteristiche del:
1.1. protocollo applicativoprotocollo applicativo
2.2. protocollo di trasportoprotocollo di trasporto
1.1. connesso vs non connessoconnesso vs non connesso
3.3. meccanismi di trasmissionemeccanismi di trasmissione
1.1. slowstartslowstart vs trasmissionevs trasmissione voracevorace
calcolo del troughput in termini di RTTcalcolo del troughput in termini di RTT
8/2/2019 12 - File Transfer - Comer
10/25
33AA 2009-2010
Schema trasferimento primo file
InIn rossorosso le interazionile interazionicon il control channelcon il control channel
ininblublu quelle sul canalequelle sul canale
per il trasferimento fileper il trasferimento file
slow start ...slow start ...
8/2/2019 12 - File Transfer - Comer
11/25
34AA 2009-2010
Schema trasferimento file seguente
Il control channel (inIl control channel (in rossorosso)) gi aperto. Il server ricevuta gi aperto. Il server ricevuta
la richiesta apre il canale per illa richiesta apre il canale per il
trasferimento (intrasferimento (inblublu))
0.5 RTT send request on control-channel
1 RTT file-channel OPEN
0.5 RTT file starts to arrive on file-channel
Ftrans time to transmit the file
--------
2 RTT + Ftrans = time to get subsequent files
slow start ...slow start ...
8/2/2019 12 - File Transfer - Comer
12/25
Question For Discussion
dWhat special relationship is required between FTP and
NAT?
Internetworking With TCP/IP vol 1 -- Part 25 8 2005
8/2/2019 12 - File Transfer - Comer
13/25
Interactive Use Of FTP
dInitially a command-line interface
User invokes client and specifies remote server
User logs in and enters password
User issues series of requests
User closes connection
dCurrently
Most FTP initiated through browser
User enters URL or clicks on link
Browser uses FTP to contact remote server and obtainlist of files
User selects file for download
Internetworking With TCP/IP vol 1 -- Part 25 9 2005
8/2/2019 12 - File Transfer - Comer
14/25
Anonymous FTP
dLogin anonymous
dPassword guest
dUsed for open FTP site (where all files are publicly
available
d Typically used by browsers
Internetworking With TCP/IP vol 1 -- Part 25 10 2005
8/2/2019 12 - File Transfer - Comer
15/25
Secure File Transfer Protocols
dSecure Sockets Layer FTP (SSL-FTP)
Uses secure sockets layer technology
All transfers are confidential
dSecure File Transfer Program (sftp)
Almost nothing in common with FTP
Uses ssh tunnel
d Secure Copy (scp)
Derivative of Unix remote copy (rcp)
Uses ssh tunnel
Internetworking With TCP/IP vol 1 -- Part 25 11 2005
8/2/2019 12 - File Transfer - Comer
16/25
Trivial File Transfer Protocol (TFTP)
dAlternative to FTP
dWhole-file copying
dNot as much functionality as FTP
dCode is much smaller
d Intended for use on Local Area Network
d Runs over UDP
d Diskless machine can use to obtain image at bootstrap
Internetworking With TCP/IP vol 1 -- Part 25 12 2005
8/2/2019 12 - File Transfer - Comer
17/25
TFTP Packet Types
READ REQ. (1) FILENAME 0 MODE 02-octet opcode n octets 1 octet n octets 1 octet
WRITE REQ. (2) FILENAME 0 MODE 0
2-octet opcode n octets 1 octet n octets 1 octet
DATA (3) BLOCK # DATA OCTETS...
2-octet opcode 2 octets up to 512 octets
ACK (4) BLOCK #
2-octet opcode 2 octets
ERROR (5) ERROR CODE ERROR MESSAGE 0
2-octet opcode 2 octets n octets 1 octet
Internetworking With TCP/IP vol 1 -- Part 25 13 2005
8/2/2019 12 - File Transfer - Comer
18/25
TFTP Retransmission
dSymmetric (both sides implement timeout and
retransmission)
d Data block is request for ACK
d ACK is request for next data block
Internetworking With TCP/IP vol 1 -- Part 25 14 2005
8/2/2019 12 - File Transfer - Comer
19/25
Sorcerers Apprentice Bug
dConsequence of symmetric retransmission
dDuplicate packet is perceived as second request, which
generates another transmission
d Duplicate response triggers duplicate packets from the other
end
dCycle continues
Internetworking With TCP/IP vol 1 -- Part 25 15 2005
8/2/2019 12 - File Transfer - Comer
20/25
37AA 2009-2010
ritrasmissione simmetrica?
sorcerers apprentice bugsorcerers apprentice bug
8/2/2019 12 - File Transfer - Comer
21/25
Network File System (NFS)
dProtocol for file access, not copying
dDeveloped by Sun Microsystems, now part of TCP/IP
standards
d Transparent (application cannot tell that file is remote)
Internetworking With TCP/IP vol 1 -- Part 25 16 2005
8/2/2019 12 - File Transfer - Comer
22/25
NFS Implementation
application
localfile
system
local
disk
NFSclient
network connectionto NFS server
local / remote decision
Internetworking With TCP/IP vol 1 -- Part 25 17 2005
8/2/2019 12 - File Transfer - Comer
23/25
Remote Procedure Call (RPC)
dAlso developed by Sun Microsystems, now part of TCP/IP
standards
d Used in implementation of NFS
d Relies on eXternal Data Representation (XDR) standard for
conversion of data items between heterogeneous computers
Internetworking With TCP/IP vol 1 -- Part 25 18 2005
8/2/2019 12 - File Transfer - Comer
24/25
Summary
dTwo paradigms for remote file sharing
Whole file copying
Piecewise file access
dFile Transfer Protocol (FTP)
Standard protocol for file copying
Separate TCP connection for each data transfer
Client and server roles reversed for data connection
d Examples of secure alternatives to FTP
SSL-FTP, sftp, and scp
Internetworking With TCP/IP vol 1 -- Part 25 19 2005
8/2/2019 12 - File Transfer - Comer
25/25
Summary
(continued)
d Trivial File Transfer Protocol (TFTP)
Alternative to FTP that uses UDP
Symmetric retransmission scheme
Packet duplication can result in Sorcerers Apprentice
problem
d Network File System (NFS)
Standard protocol for piecewise file access
Uses RPC and XDR
Internetworking With TCP/IP vol 1 -- Part 25 20 2005