The copy command uploads and downloads files to and from the switch. You can also use the copy command to manage the dual images (active and backup) on the file system. Upload and download files from a server using FTP, TFTP, Xmodem, Ymodem, and Zmodem. If FTP is used, a password is required.
SFTP and SCP are available as additional transfer methods if the software package supports secure management. CLI- based file transfers using the HTTP and HTTPS protocols are supported on selected platforms where a native wget utility is available.
| Format | copy source destination [source option] [{verify | noverify}][checkcert | nocheckcert] |
| Mode | Privileged EXEC |
Replace the source and destination parameters with the options in Table 1. For the url source or destination, use one of the following values:
{xmodem | tftp://ipaddr|hostname|ip6address|hostname/filepath/filename [noval] | sftp|scp://username@ipaddr | ipv6address/filepath/filename | ftp://user@ipaddress | hostname/filepath/filename | http://{user@}ipaddr|hostname/filepath/filename | https://{user@}ipaddr|hostname/filepath/filename}
The optional source option parameters specify the source-interface or source IP address for the copy command. The selected source-interface IP address is to be used for filling the IP header of management protocol packets (SCP, SFTP and TFTP). This allows security devices (firewalls) to identify the source packets coming from the specific switch. If a source-interface is not specified, the primary IP address of the originating (outbound) interface is used as source address. When the user selects the source interface for SCP, SFTP, TFTP applications, it (re)bind the interface source IP address with the server. The source interface is not supported for HTTP/HTTPS protocols.
The verify | noverify options are only available if the image/configuration verify options feature is enabled (see file verify). verify specifies that digital signature verification will be performed for the specified downloaded image or configuration file. noverify specifies that no verification will be performed.
For HTTPS transfers, the [checkcert | nocheckcert] options are available to enable or disable server certificate validation. This option is valid only for HTTPS file transfer. If no option is specified, default action is applied for HTTPS file transfer.
The keyword ias-users supports the downloading of the IAS user database file. When the IAS users file is downloaded, the switch IAS user's database is replaced with the users and its attributes available in the downloaded file. In the command copy url ias-users, for url one of the following is used for IAS users file:
{ { tftp://<ipaddr | hostname> | <ipv6address | hostname> /<filepath>/<filename> } | { sftp | scp://<username>@<ipaddress>/<filepath>/<filename>} }
The maximum length for the file path is 160 characters, and the maximum length for the file name is 31 characters.
For FTP, TFTP, SFTP, and SCP, the ipaddr|hostname parameter is the IP address or host name of the server, filepath is the path to the file, and filename is the name of the file you want to upload or download. For SFTP and SCP, the username parameter is the username for logging into the remote server via SSH.
ip6address is also a valid parameter for routing packages that support IPv6.
For platforms that include stacking, use the optional [unit unit id] parameter (when available) to specify the stack member to use as the source for the item to copy. If no unit is specified, the item is copied from the stack master.
To copy OpenFlow SSL certificates to the switch using TFTP or XMODEM, using only the following options pertinent to the OpenFlow SSL certificates.
| Format | copy [<mode/file>] nvram:{openflow-ssl-ca-cert | openflow-ssl-cert | openflow-ssl- priv-key} |
| Mode | Privileged EXEC |
Remember to upload the existing configuration file off the switch prior to loading a new release image in order to make a backup.
| Source | Destination | Description |
|---|---|---|
| nvram:application:sourcefilename | url | Filename of source application file. |
| nvram:backup-config | nvram:startup-config | Copies the backup configuration to the startup configuration. |
| nvram:clibanner | url | Copies the CLI banner to a server. |
| nvram: core-dump [unit unit id] | tftp://<ipaddress|hostname>/<filepath>/<filename> | ftp://<user>@<ipaddr|hostname>/<path>/<filename> | scp://<user>@<ipaddr|hostname>/<path>/<filename> | sftp://<user>@<ipaddr|hostname>/<path>/<filename>} | Uploads the core dump file on the local system to an external TFTP/ FTP/SCP/SFTP server. |
| nvram:cpupktcapture.pcap [unit unit id] | url | Uploads CPU packets capture file. |
| nvram:crash-log | url | Copies the crash log to a server. |
| nvram:errorlog | url | Copies the error log file to a server. |
| nvram:factory-defaults | url | Uploads factory defaults file. |
| nvram:fastpath.cfg | url | Uploads the binary config file to a server. |
| nvram:log | url | Copies the log file to a server. |
| nvram:operational-log [unit unit id] | url | Copies the operational log file to a server. |
| nvram:script scriptname | url | Copies a specified configuration script file to a server. |
| nvram:startup-config | nvram:backup-config | Copies the startup configuration to the backup configuration. |
| nvram:startup-config | url | Copies the startup configuration to a server. |
| nvram:startup-log [unit unit id] | url | Uploads the startup log file. |
| nvram: tech-support [unit unit id] | url | Uploads the system and configuration information for technical support. |
| nvram:traplog | url | Copies the trap log file to a server. |
| system:running-config | url | Accepts the url for upload operation. Uploads running-config using {xmodem l ymodem l zmodem l tftp://<ipaddresslhostname>/<filepath>/<filename>l ftp://<user>@<ipaddrlhostname>/<path>/<filename> l scp://<user>@<ipaddrlhostname>/<path>/<filename> l sftp://<user>@<ipaddrlhostname>/<path>/<filename>} |
| system:running-config | nvram:startup-config | Saves the running configuration to NVRAM. |
| system:running-config | nvram:factory-defaults | Saves the running configuration to NVRAM to the factory-defaults file. |
| system:image | url | Saves the system image to a server. |
| tftp:// <ipaddress>/<filename> | system:packet.pcap | Copies a PCAP file into RAM. The PCAP file is used to inject packets into the silicon for tracing the packets. |
| url | nvram:application destfilename | Destination file name for the application file. |
| url | nvram:ca-root index | Downloads the CA certificate file to the boot persistent directory and uses the index number name the downloaded file to CAindex.pem. |
| url | nvram:ca-root-certs | Downloads root CA certificate file(s) to the boot persistent root-certificates directory. The root CA certificates can be used by the native wget utility for HTTPS server certificate validation during the file download operation via HTTPS from the copy command. |
| url | nvram:clibanner | Downloads the CLI banner to the system. |
| url | nvram:client-key index | Downloads the client key file to the (boot persistent directory and uses the index number name the downloaded file to CAindex.key. |
| url | nvram:client-ssl-cert 1-8 | Downloads the client certificate to the boot persistent directory and uses the index number to name the downloaded file to CAindex.pem. |
| url | nvram:fastpath.cfg | Downloads the binary config file to the system. |
| url | nvram:publickey-config | Downloads the Public Key for Configuration Script validation. |
| url | nvram:publickey-image | Downloads Public Key for Image validation. |
| url | nvram:script destfilename | Downloads a configuration script file to the system. During the download of a configuration script, the copy command validates the script. In case of any error, the command lists all the lines at the end of the validation process and prompts you to confirm before copying the script file. |
| url | nvram:script destfilename noval | When you use this option, the copy command will not validate the downloaded script file. An example of the CLI command follows: |
| (Routing) #copy tftp://1.1.1.1/file.scr nvram:script file.scr noval | ||
| url | nvram:sshkey-dsa | Downloads an SSH key file. For more information, see Secure Shell Commands. |
| url | nvram:sshkey-rsa1 | Downloads an SSH key file. |
| url | nvram:sshkey-rsa2 | Downloads an SSH key file. |
| url | nvram:sslpem-dhweak | Downloads an HTTP secure-server certificate. |
| url | nvram:sslpem-dhstrong | Downloads an HTTP secure-server certificate. |
| url | nvram:sslpem-root | Downloads an HTTP secure-server certificate. For more information, see Hypertext Transfer Protocol Commands. |
| url | nvram:sslpem-server | Downloads an HTTP secure-server certificate. |
| url | nvram:startup-config | Downloads the startup configuration file to the system. |
| url | ias-users | Downloads an IAS users database file to the system. When the IAS users file is downloaded, the switch IAS user's database is replaced with the users and their attributes available in the downloaded file. |
| url | nvram:tech-support-cmds | Downloads the file containing list of commands to be displayed using the show tech-support command. |
| url | {active | backup} | Download an image from the remote server to either image. In a stacking environment, the downloaded image is distributed to the stack nodes. |
| {active | backup} | url | Upload either image to the remote server. |
| active | backup | Copy the active image to the backup image. |
| backup | active | Copy the backup image to the active image. |
| {active | backup} | unit://unit/{active | backup} | Copy an image from the management node to a given node in a Stack. Use the unit parameter to specify the node to which the image should be copied. |
| {active | backup} | unit://*/{active | backup} | Copy an image from the management node to all of the nodes in a Stack. |
Example: The following shows an example of downloading and applying ias users file.
(Routing) #copy tftp://10.131.17.104/aaa_users.txt ias-users Mode........................................... TFTP Set Server IP.................................. 10.131.17.104 Path........................................... ./ Filename....................................... aaa_users.txt Data Type...................................... IAS Users Management access will be blocked for the duration of the transfer Are you sure you want to start? (y/n) y File transfer operation completed successfully. Validating and updating the users to the IAS users database. Updated IAS users database successfully. (Routing) #
Example: The following shows an example of the command to copy running config to a remote system URL for upload operation.
(Routing) #copy system:running-config tftp://10.89.105.143/run-cfg Mode........................................... TFTP Set Server IP.................................. 10.89.105.143 Path........................................... ./ Filename....................................... run-cfg Data Type...................................... Text Configuration Source Filename................................ running-config Management access will be blocked for the duration of the transfer Are you sure you want to start? (y/n) y File transfer in progress. Management access will be blocked for the duration of the transfer. Please wait... File transfer operation completed successfully. (Routing)#