Network Bytes · Episode 81 · CCNA 4.9
"TFTP and FTP: backing up configs"
Before you change a router, copy its configuration file to a server. TFTP is the simple self-serve way (no login, UDP, small acknowledged chunks); FTP adds a login, runs over TCP and lets you manage files. Neither is encrypted, so SCP or SFTP is the safer choice on untrusted networks.
Why back up a config?
A router's settings live in its running configuration. One wrong command can cut off a whole office, so before you change anything you save a copy somewhere safe: a file server on the network. If the change goes badly, you copy the old file back. Think of it as dropping a box at a storage counter. There are two classic counters for that box: TFTP and FTP.
TFTP: the self-serve counter
TFTP (Trivial File Transfer Protocol) keeps things as simple as possible:
- No login. Anyone who can reach the server can send or fetch a file, and there is no directory listing.
- UDP, with requests sent to server port 69.
- Lock-step chunks. The file travels in data blocks of 512 bytes. The sender waits for an acknowledgment (an "OK") after each block before sending the next one. A block shorter than 512 bytes tells the receiver the file is finished.
Because UDP itself does not guarantee delivery, TFTP builds its own reliability with those per-block acknowledgments. Small and simple is exactly why routers, switches and IP phones have used it for decades.
FTP: the staffed counter
FTP (File Transfer Protocol) is the fuller service:
- It asks for a username and password (some servers allow an "anonymous" login).
- It runs over TCP: a control connection on port 21, plus separate data connections for the files (port 20 in active mode, a server-chosen port in passive mode).
- It lets you list, rename and delete files, not just send and fetch them.
One command on a Cisco router
`` Router# copy running-config tftp: ``
The router then asks for the server's address and a file name, and sends the file. copy running-config ftp: works the same way with FTP credentials. To restore, you copy in the other direction, for example copy tftp: running-config.
Both are plain text
Neither TFTP nor FTP encrypts anything. Your configuration, and with FTP even the password, crosses the network as readable text. On untrusted networks use a secure option instead: SCP or SFTP, which both run over SSH.
Try it yourself
In Cisco Packet Tracer (free with a Cisco Networking Academy account), connect a router and a Server through a switch and give them addresses in the same subnet. On the Server, open Services > TFTP and check that it is on. On the router run copy running-config tftp:, enter the server's address and accept the file name. Then look at the Server's TFTP file list and find your saved config. Bonus: change the router's hostname, then copy the file back with copy tftp: running-config and watch the old hostname return.
Good to know
- TFTP is defined in RFC 1350: UDP, server port 69, no login or directory listing, 512-byte data blocks, each acknowledged before the next is sent.
- If a file is an exact multiple of 512 bytes, TFTP sends one extra empty block so the receiver knows the file has ended.
- The blocksize option (RFC 2348) lets TFTP negotiate bigger blocks; this episode sticks to the classic 512 bytes.
- FTP is defined in RFC 959: TCP control connection on port 21, separate data connections, USER and PASS commands, and file listing and management.
- SCP and SFTP run over SSH (see EP55, SSH vs Telnet) and encrypt both the login and the file.
For CCNA learners
CCNA exam topic 4.9 asks you to describe the capabilities and functions of TFTP and FTP in the network. Know the contrast: TFTP = UDP 69, no authentication, no listing, simple lock-step transfer; FTP = TCP 21 (control) and 20 (active data), username and password, file management. Know that neither is encrypted, and recognise copy running-config tftp: and copy running-config ftp:.
Answer to the comment question
3 chunks. 512 + 512 = 1,024 bytes, which leaves 1,300 − 1,024 = 276 bytes for a third chunk. Because that last chunk is shorter than 512 bytes, it also tells the server the file is complete, so no extra block is needed.
Test your knowledge
Quick quiz: "TFTP and FTP: backing up configs"
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- IETF, "RFC 1350, The TFTP Protocol (Revision 2)": TFTP over UDP, port 69, no login, 512-byte data blocks each acknowledged before the next
- IETF, "RFC 959, File Transfer Protocol (FTP)": TCP control connection on port 21, data connections, USER and PASS, file listing and management
- Cisco, "CCNA 200-301 v1.1 exam topics": 4.9 describe the capabilities and functions of TFTP/FTP in the network
Video transcript
Before you change a router, how do you save a copy of its settings somewhere safe?
You copy its configuration file to a server. Think of dropping a box at a storage counter.
TFTP is the self-serve counter. No login. It uses UDP and sends five hundred twelve byte chunks, waiting for an OK after each.
FTP is the staffed counter. It asks for a username and password, runs over TCP, and lets you list and manage files.
On a Cisco router, one command sends it: copy running-config tftp. But both are unencrypted, so on untrusted networks, use a secure option.
A config file is one thousand three hundred bytes. TFTP sends five hundred twelve bytes per chunk. How many chunks? Comment your answer below!
That's your byte.
More from Network Bytes
- EP79"On-premises vs cloud"
- EP80"Floating static routes"
- EP82"Inter-VLAN routing: router on a stick"
- EP83"DHCP relay: ip helper-address"