FTP (File Transfer Protocol) / TFTP (Trivial File Transfer Protocol) / NFS (Network File System)
Three models of file access
The three protocols differ in their working model:
· FTP transfers a file from A to B using two connections (control and data);
· TFTP downloads a file when a device has no OS or configuration yet (switch imaging, PXE);
· NFS mounts a remote directory as a local one and accesses data on demand when reading and writing, without transferring whole files.
Which protocol to use depends on which model is needed, not on performance.
FTP's two connections
FTP uses one control connection and one data connection.
· Active mode: the server connects to the client, which fails when the client is behind NAT or a firewall;
· Passive mode: the client connects to a random high port on the server, which works through client-side NAT but requires a whole port range to be open on the server's firewall.
When FTP logs in but cannot transfer files, the cause is usually that the data connection was not established.
Common misconceptions
SFTP is unrelated to FTP. SFTP is a subsystem of SSH; FTP with TLS encryption is called FTPS.
TFTP is not a simplified FTP. It runs over UDP, implements its own retransmission and has no authentication; it is meant for devices that have no OS or configuration yet.
NFS does not transfer whole files; it mounts a remote directory as a local one.