Octet

Compare TFTP, FTP, SCP and SFTP. Which do you use to move images and configs to network devices?

Show the answer

Say this first

TFTP is UDP 69 with no authentication and no encryption, sending one 512-byte block at a time: simple enough for boot ROMs, PXE and IP phones, but slow and insecure. FTP uses TCP 21 for control plus a separate data connection, with credentials in clear text. SCP and SFTP both run over SSH on TCP 22, so they are authenticated and encrypted. SCP only copies files, while SFTP is a full file protocol with listing, resume and rename. For network devices I use SCP or HTTPS and keep TFTP for boot-time cases that have nothing else.

Go deeper

ProtocolTransportAuthenticationEncryptionNotes
TFTPUDP 69, then ephemeral portsnonenonelock-step 512-byte blocks by default
FTPTCP 21 control; data from port 20 (active) or to a server port (passive)user and password in clearnone (FTPS adds TLS)two connections, painful through NAT
SCPSSH, TCP 22SSHyescopy only
SFTPSSH subsystem, TCP 22SSHyesnot FTP over SSH, a separate protocol

TFTP limits

The server answers from a new ephemeral port, so stateful firewalls need a TFTP helper. Block numbers are 16 bits, so with 512-byte blocks a file over about 32 MB fails unless both ends support the blocksize option (RFC 2348) or block number rollover.

SCP on IOS

Cisco IOS
ip ssh version 2
aaa new-model
aaa authentication login default local
aaa authorization exec default local
ip scp server enable

Pull an image from a server:

Cisco IOS
R1# copy scp://admin@10.0.0.5/isr4400-universalk9.17.09.04a.SPA.bin bootflash:
R1# verify /md5 bootflash:isr4400-universalk9.17.09.04a.SPA.bin

Compare the hash with the one the vendor publishes before you boot it.

OpenSSH 9.0 and later run the SFTP protocol under the scp command by default. To push a file to a device that only has an SCP server, use scp -O for the legacy protocol.

Traps

  • Saying SFTP is FTP over SSL. That is FTPS. SFTP is part of SSH.
  • Assuming TFTP can move a file of any size.
How did you do?Book 9.1 Traditional Applications