copy tftp: flash:
Copies a file from a TFTP server to the router's flash memory, used to upgrade IOS images, restore configurations, or add files.
Definition: copy tftp: flash: is a Cisco IOS privileged exec command. Copies a file from a TFTP server to the router's flash memory, used to upgrade IOS images, restore configurations, or add files.
Overview
The 'copy tftp: flash:' command is a fundamental tool in Cisco IOS that allows a network engineer to transfer a file from a TFTP server directly to the router's flash memory. This operation is critical for upgrading or downgrading the IOS image, restoring a backup configuration, or adding new files such as web content or license files. The command operates in privileged EXEC mode (enable mode) and requires that the router has IP connectivity to a TFTP server.
The TFTP protocol is a simple, lightweight file transfer protocol that uses UDP port 69, making it fast but lacking security features like authentication or encryption. This command is often the first step in a software upgrade workflow: after copying the new IOS image to flash, the engineer configures the router to boot from the new image and reloads the device. It is also used to restore a startup configuration from a TFTP server after a catastrophic failure.
Alternatives include using FTP, HTTP, SCP, or USB flash, but TFTP remains popular due to its simplicity and wide support. The command does not affect the running configuration; it only modifies the contents of flash memory. The user must have sufficient flash space and must know the exact filename on the TFTP server.
The command prompts for the TFTP server IP address and the source filename, then the destination filename (defaulting to the same name). A common mistake is to forget that TFTP requires the file to be in the default TFTP directory on the server (often /tftpboot). The command provides progress indicators and a checksum verification upon completion.
Understanding this command is essential for CCNA and CCNP candidates as it is a core maintenance operation.
copy tftp: flash:When to Use This Command
- Upgrading the IOS image on a router by copying a new image from a TFTP server to flash.
- Restoring a backup configuration file from a TFTP server to flash for disaster recovery.
- Copying a new firmware file for a module (e.g., WLC) from a TFTP server to flash.
- Transferring a license file from a TFTP server to flash for activation.
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| source-url | tftp://<server-ip>/<filename> | Specifies the TFTP server IP address and the source filename. The server IP must be reachable via IP routing. The filename is case-sensitive and must match exactly. Common mistake: omitting the trailing slash or using an incorrect path. |
| destination-url | flash:<filename> | Specifies the destination in flash memory. If only 'flash:' is given, the router prompts for the filename. The filename can be different from the source. Ensure sufficient flash space; otherwise, the command fails. |
Command Examples
Basic IOS image upgrade
copy tftp: flash:Address or name of remote host []? 192.168.1.100 Source filename []? c2960-lanbasek9-mz.150-2.SE11.bin Destination filename [c2960-lanbasek9-mz.150-2.SE11.bin]? Accessing tftp://192.168.1.100/c2960-lanbasek9-mz.150-2.SE11.bin... Loading c2960-lanbasek9-mz.150-2.SE11.bin from 192.168.1.100 (via Vlan1): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! [OK - 12345678 bytes] 12345678 bytes copied in 45.123 secs (273456 bytes/sec)
Prompts for TFTP server IP (192.168.1.100), source filename (the IOS image), and destination filename (default same as source). The exclamation marks indicate successful data transfer. Output shows total bytes copied, time, and transfer rate.
Copying a configuration file with different destination name
copy tftp: flash:Address or name of remote host []? 10.0.0.5 Source filename []? running-config.backup Destination filename [running-config.backup]? startup-config.backup Accessing tftp://10.0.0.5/running-config.backup... Loading running-config.backup from 10.0.0.5 (via GigabitEthernet0/0): ! [OK - 2048 bytes] 2048 bytes copied in 0.123 secs (16650 bytes/sec)
Here the user specifies a different destination filename (startup-config.backup). The output confirms the file size (2048 bytes) and transfer rate. The single exclamation mark indicates a small file.
Understanding the Output
The output begins with prompts for the TFTP server address and filenames. After confirming, the router attempts to access the file via TFTP. Exclamation marks (!) indicate successful packet transfers; dots (.) indicate timeouts or retransmissions.
The final line shows total bytes copied, elapsed time, and transfer rate in bytes/sec. A successful copy ends with '[OK - <bytes>]'. If the file is large, many exclamation marks appear.
Watch for 'Timeout' or 'Error' messages indicating network issues or incorrect filename. The transfer rate helps gauge network performance; low rates may indicate congestion or server issues.
Configuration Scenarios
Upgrading IOS Image on a Branch Router
A branch router (R1) is running an outdated IOS version and needs to be upgraded to a newer version stored on a central TFTP server at 10.10.10.10.
Topology
R1(Gi0/0)---192.168.1.0/24---TFTP Server(10.10.10.10)Steps
- 1.Step 1: Verify connectivity to TFTP server: ping 10.10.10.10
- 2.Step 2: Check available flash space: show flash:
- 3.Step 3: Copy the new IOS image: copy tftp: flash:
- 4.Step 4: When prompted, enter TFTP server IP: 10.10.10.10
- 5.Step 5: Enter source filename: c2900-universalk9-mz.SPA.157-3.M8.bin
- 6.Step 6: Enter destination filename (press Enter to accept default): c2900-universalk9-mz.SPA.157-3.M8.bin
- 7.Step 7: Wait for transfer to complete and verify checksum.
- 8.Step 8: Configure boot system: (config)# boot system flash:c2900-universalk9-mz.SPA.157-3.M8.bin
- 9.Step 9: Save configuration: write memory
- 10.Step 10: Reload: reload
! After copy, configure boot variable Router# configure terminal Router(config)# boot system flash:c2900-universalk9-mz.SPA.157-3.M8.bin Router(config)# exit Router# write memory
Verify: Verify the new image is in flash: show flash: | include .bin. Also verify boot variable: show boot. After reload, check version: show version.
Watch out: Ensure the TFTP server is running and the file is in the default TFTP root directory. Also, the new IOS image must be compatible with the router's hardware and memory.
Restoring Startup Configuration from TFTP
A router's startup configuration has been corrupted. The engineer needs to restore a backup configuration file (backup-config.cfg) from a TFTP server at 192.168.1.100.
Topology
Router(Gi0/0)---192.168.1.0/24---TFTP Server(192.168.1.100)Steps
- 1.Step 1: Boot the router without startup config (or delete it): delete nvram:startup-config
- 2.Step 2: Reload the router (it will boot to setup mode, exit without saving).
- 3.Step 3: Enter privileged EXEC mode: enable
- 4.Step 4: Copy the backup config: copy tftp: startup-config
- 5.Step 5: Enter TFTP server IP: 192.168.1.100
- 6.Step 6: Enter source filename: backup-config.cfg
- 7.Step 7: Confirm destination filename (startup-config).
- 8.Step 8: After copy, reload the router to load the restored config: reload
! No configuration needed; the copy command directly writes to startup-config Router# copy tftp: startup-config Address or name of remote host []? 192.168.1.100 Source filename []? backup-config.cfg Destination filename [startup-config]? Accessing tftp://192.168.1.100/backup-config.cfg... Loading backup-config.cfg from 192.168.1.100 (via GigabitEthernet0/0): ! [OK - 1234 bytes] [OK]
Verify: After reload, verify the configuration: show running-config. Check that key interfaces and settings are present.
Watch out: The router must have basic IP connectivity (e.g., an IP on an interface) to reach the TFTP server. If the config is missing, the router may not have an IP configured; use the console to assign a temporary IP.
Troubleshooting with This Command
When using 'copy tftp: flash:' for troubleshooting, the primary focus is on ensuring successful file transfer. Healthy output shows a series of exclamation marks (!) indicating progress, followed by a checksum verification message like '[OK - 12345678 bytes]'. Problem indicators include timeout messages, 'Error opening tftp://...' (file not found or permission denied), or '%Error copying tftp://...' (network unreachable or server not responding).
Key fields to examine are the server IP address, filename, and the interface used. Common symptoms: 'Timeout' suggests the TFTP server is unreachable or blocked by a firewall; 'File not found' indicates the filename is incorrect or not in the TFTP root; 'No space on device' means flash is full. A step-by-step diagnostic flow: 1) Verify IP connectivity with ping to the TFTP server. 2) Confirm the TFTP server is running and the file exists in the correct directory. 3) Check flash space with 'show flash:'. 4) Ensure the router has a default route or specific route to the server. 5) If using a VLAN, verify the interface is up and has an IP. 6) Use 'debug ip packet' cautiously to see if packets are leaving the router.
Correlate with 'show ip route' to confirm routing. If the transfer fails mid-way, it could be due to network congestion or packet loss; consider using FTP or SCP for reliability. Also, some IOS versions require the 'file prompt quiet' command to suppress prompts in scripts.
The command's output can be redirected to a log for later analysis.
CCNA Exam Tips
CCNA exam tip 1: The command is executed in privileged EXEC mode (enable mode).
CCNA exam tip 2: You must have a TFTP server reachable from the router; the exam may test troubleshooting connectivity.
CCNA exam tip 3: The destination filename can be changed; if not, it defaults to the source filename.
CCNA exam tip 4: Ensure sufficient flash space before copying; use 'show flash:' to check.
Common Mistakes
Mistake 1: Forgetting to specify the correct TFTP server IP or filename, causing 'Timeout' errors.
Mistake 2: Not having enough flash memory, leading to 'Out of memory' or partial copy.
Mistake 3: Using the command in user EXEC mode instead of privileged EXEC mode.
copy tftp: flash: vs copy flash: tftp:
These two commands are inverses of each other, often confused because the source and destination arguments are reversed. One downloads a file to flash, the other uploads a file from flash.
| Aspect | copy tftp: flash: | copy flash: tftp: |
|---|---|---|
| Direction | Network to device (download) | Device to network (upload) |
| Impact on flash | Writes file to flash, may overwrite existing files | Reads file from flash; flash unchanged |
| Typical use | Upgrade IOS image or restore configuration | Backup IOS image or configuration |
| Requires TFTP server reachability | Yes | Yes |
| File size consideration | Often used for large IOS images (e.g., 100+ MB) | Can copy any file in flash |
| Risk of interruption | Higher risk; can corrupt flash if interrupted | Low risk; only reads from flash |
Use copy tftp: flash: when you need to upgrade the IOS image or restore a configuration file from a TFTP server to the router's flash memory.
Use copy flash: tftp: when you need to backup the current IOS image or configuration file to a TFTP server for safekeeping.
Platform Notes
In IOS-XE (e.g., Catalyst 9000 switches), the command syntax is identical: 'copy tftp: flash:'. However, IOS-XE often uses a different filesystem structure, such as 'flash:' or 'bootflash:'. The output format may include a progress bar instead of exclamation marks.
For NX-OS (e.g., Nexus switches), the equivalent command is 'copy tftp: bootflash:' or 'copy tftp: volatile:'. NX-OS also supports 'copy tftp: system:' for certain files. The syntax is similar but the destination filesystem names differ.
For ASA firewalls, the command is 'copy tftp: flash:' but the ASA uses a different file system; the command works in privileged mode. There are no significant differences between IOS 12.x, 15.x, and 16.x for this command, though newer versions may support additional options like 'vrf' to specify a VRF. The command exists in IOS-XR but with a different syntax: 'copy tftp: harddisk:' or 'copy tftp: disk0:'.
In IOS-XR, the command is 'copy tftp://<server>/<file> harddisk:/<file>'. Always consult the specific platform documentation for exact syntax.
Related Commands
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions