TFTP, FTP, SFTP and SCP
There are various File Transfer Protocols. The most used one is FTP. Beside FTP, there are different protocol that is more fast or more secure. In this lesson, we will learn these File Transfer Protocols : TFTP, FTP, SFTP and SCP. We will compare these protocols and we will se FTP vs SFTP, FTP vs TFTP and FTP vs SCP with a compate table.
FTP (File Transfer Protocol)
FTP (File Transfer Protocol) is a Connection Oriented protocol that is used to transfer files between host devices and servers.
This type of transfer is used for unsenstivite data, because the security is not important for FTP. Althought it is not a real secure protocol, it supports Authentication. But there is no Encryption in FTP transfer.
FTP is a slow protocol. File transfer is done slowly with FTP.
FTP Uses TCP Port 20 and TCP Port 21.
Below, you can find the comparison sheet for ftp vs sftp, ftp vs tftp and ftp vs scp.
TFTP (Trivial File Transfer Protocol)
TFTP (Trivial File Transfer Protocol) is the simpler file transfer protocol than FTP. It is a Connectionless protocol. It is rarely used.
TFTP is an insecure protocol because it do not have even an Authentication mechanism. It is not secured but a fast file tranfer protocol. There is also no Encryption in TFTP Transfers.
TFTP Uses UDP Port 69.
SFTP (SSH File Transfer Protocol)
SFTP (SSH File Transfer Protocol) is a Connection Oriented and slow, but secured file transfer protocol. Before transfering files with SFTP, authentication over SSH must be done. It also uses Encryption. SFTP is ideal for senstivite data.
SFTP Uses TCP Port 22.
Here, before the file transfer, client identification is verified and then a secure connection is established between client and server. The file transfer is done over this connection.
Below, you can find a comparison table for ftp vs sftp.
SCP (Secure Copy Protocol)
SCP (Secure Copy Protocol) is also a Connection Oriented protocol, secure like SFTP and additionally fast protocol. SCP relies on also Secure Shell (SSH). It is used for sensitive and rapid file transfer. Authentication and Encryption is used.
SCP Uses TCP Port 22 like SFTP.
FTP vs TFTP, FTP vs SFTP, FTP vs SCP
Here, we will compare these four File Transfer Protocols. Below, you can find ftp vs sftp, ftp vs tftp and ftp vs scp comparison table.
FTP Configuration On Cisco
By default, FTP Client is enabled on Cisco Routers. But to use this FTP client, we should create an account. Because, FTP need authentication at the beginning.
To create an FTP client acount on a Cisco Router, we will use “ip ftp username” and “ip ftp password” commands.
Router # configure terminal
Router (config) # ip ftp username ipcisco
Router (config) # ip ftp password abc123
After this configuration, our FTP Client is ready. We can transfer files with this account. Let’s make an example. Think about that; You will do an image upgrade at night and you should load the new image file o the router from FTP Server. Normally, the preparation of this type night works is done before the night.
To copy the image file, we will use “copy ftp flash” command. After running this command, the router ask us three questions:
- IP Address of the Remote Host
- Source File Name
- Destination File Name
IP Address of the Remote Host is the IP Address of the FTP Server. Here, we will use 192.168.1.1. Source File name is the image file that resisdes in remote FTP Server. We will use xyz.bin file. Destination file name is the name of the file in its new location, on router. We will use abc.bin as the new file name of this image.
Router # copy ftp flash
Address or name of remote host ? 192.168.1.1
Source filename ? xyz.bin
Destination filename [abc.bin]?
[OK – 7485248 bytes]
7485248 bytes copied in 14.08 secs (531622 bytes/sec)
Let’s verify our file transfer on router flash with “show flash” command.
Router # show flash:
Directory of flash:/
1 -rw- 7485248 xyz.bin
We can also send files from the router to the remote FTP Server. This time we will use the “ftp” keyword at the end of the command. Because it is the destination. For example “copy running-config ftp” command, send the configuration in the NVRAM at that moment to the FTP server.
SFTP Configuration On Cisco
SFTP is the more secure file tranfer protocol than FTP. It is based on SSH protocol. On Cisco routers, we should configure SFTP Client before file transfer.
To configure SFTP on a Cisco Router, firstly, we should use “ip ssh source-interface” command. With this commnad we define the source ip address of the SSH Session.
Router # configure terminal
Router (config) # ip ssh source-interface gigabitethernet 1/1/1
After this configuration, we can take files from SFTP Server or send files to it.
We can do SFTP file tranfer in two different ways. We can both write the whole command with username, password and file location and we can also write this according to the router quesrtions. Below, we will write all the required fileds in one command.
Router # copy sftp://user:[email protected] //filepath ios-file-system:file
Router # copy sftp://ipcisco:[email protected] //xyz.bin ios-file-system:abc.bin
Or we can use the below command and then answer the questions one by one:
Router # copy sftp: ios-file-system:
To follow the SFTP processes on router, we can also open debug for SFTP with “debug ip sftp” command.
Router # debug ip sftp