Describe the capabilities and function of TFTP/FTP in the network
Purpose of FTP/TFTP
- FTP and TFTP are industry standard protocols used to transfer files over a network
- Both use a client-server model
- clients can use FTP or TFTP to copy files from a server
- clients can use FTP or TFTP to copy files to a server
- Network engineers used FTP/TFTP to upgrade operating systems of network devices such as routers, switches, etc.
- Use FTP/TFTP to download newer version of Cisco IOS from a server then reboot the device with the new IOS image
TFTP
TFTP Functions
- Trivial File transfer protocol (TFTP) was first standardized in 1981
- Lightweight and Simple ( only allows client to copy a file to/or from a server
- Released after FTP
- No authentication
- No encryption (plain text)
- Meant for controlled environment only
- Listens on UDP port 69
- Does not no provide reliability due to UDP(connectionless)
- Re-transmission and reliability built-in feature( at least it does the job)
TFTP Reliability
- Every TFTP data message is acknowledged
- if the client is transferring a file to the server, the server will send Ack messages
- if the server is transferring a file to the client, the client will send Ack messages
- TFTP uses lock-step communication(in the case of a failure, retransmission of data can happen)
TFTP Connections
TFTP file transfers have three phases:
- Connection
- TFTP client sens a request to the server, and the server responds back initializing the connection.
- Data transfer
- The client and server exchange TFTP messages. One sends data and the other sends acknowledgements.
- Connection termination
- After the last data message has been sent, a final acknowledgement is sent to terminate the connection.
Transfer Identifier(TID)
- When the client sends the first message to the server, the destination port is UDP 69 and the source is a random ephemeral port
- The ephemeral port is called a Transfer Identifier or TID and identifies the data transfer
- The server then also selects a random TID to use as the source port when it replies, NOT 69
- When the client sends the next message, the destination port will be the server’s TID, NOT 69
FTP
FTP Functions
- File Transfer Protocol or FTP
- Standardized in 1971
- Uses TCP port 20 and 21
- Username & passwords are used for authentication
- No encryption
- FTPS is an upgrade of FTP
- SSH File Transfer Protocol (SFTP) is a new protocol with greater security
- Transfer files, navigate file directories, add/remove/list files
- FTP commands used to perform above operations on a file
FTP Control Connections
FTP uses two types of connections:
- FTP control connection
- uses TCP port 21
- established and used to send FTP commands and replies
- FTP data connections
- When files or data are to be transferred, separate FTP data connections are established and terminated as needed
FTP Data Connections
Active Mode
- Default method of establishing FTP data connections is ACTIVE MODE, in which the server initiates the TCP connection
Passive Mode
- In PASSIVE MODE, the client initiates the data connection. This is often necessary when the client is behind a firewall, which could block incoming connection from the serve
FTP vs TFTP
FTP | TFTP |
---|---|
Uses TCP port 20 for data and 21 for control for a connection-based communication | Uses UDP port 69 for connectionless communications (although a basic form of ‘connection’ is used within the protocol itself) |
Client can use FTP commands to perform various actions, not just copy files | Clients can only copy files to or from the server |
Username and password authentication | No authentication |
Complex | Simpler |