Using FTP to Manage System Images

This module contains information about using FTP to manage Cisco system images.

Image Copying from Flash Memory to an FTP Server

The FTP protocol requires a client to send a remote username and password on each FTP request to a server. When you copy a configuration file from the router to a server using FTP, the Cisco IOS software sends the first valid username it encounters in the following list:

  1. The username specified in the copy privileged EXEC command, if a username is specified.

  2. The username set by the ipftpusername global configuration command, if the command is configured.

  3. Anonymous.

The router sends the first valid password it encounters in the following list:

  1. The password specified in the copy privileged EXEC command, if a password is specified.

  2. The password set by the ipftppassword global configuration command, if the command is configured.

The router forms a password username @routername .domain . The variable username is the username associated with the current session, routername is the configured hostname, and domain is the domain of the router.

The username and password must be associated with an account on the FTP server. If you are writing to the server, the FTP server must be properly configured to accept the FTP write request from the user on the router.

If the server has a directory structure, the configuration file or image is written to or copied from the directory associated with the username on the server. For example, if the system image resides in the home directory of a user on the server, specify that user’s name as the remote username.

Refer to the documentation for your FTP server for more information.

Use the ipftpusername and ipftppassword commands to specify a username and password for all copies. Include the username in the copy command if you want to specify a username for that copy operation only.

Image Copy from an FTP Server to a Flash Memory File System

You can copy a system image from an FTP server to a flash memory file system.

FTP Username and Password

The FTP protocol requires a client to send a remote username and password on each FTP request to a server. When you copy a configuration file from the router to a server using FTP, the Cisco IOS software sends the first valid username it encounters in the following list:

  1. The username specified in the copy privileged EXEC command, if a username is specified.

  2. The username set by the ipftpusername global configuration command, if the command is configured.

  3. Anonymous.

The router sends the first valid password it encounters in the following list:

  1. The password specified in the copy privileged EXEC command, if a password is specified.

  2. The password set by the ip ftp password command, if the command is configured.

The router forms a password username @routername .domain . The variable username is the username associated with the current session, routername is the configured host name, and domain is the domain of the router.

The username and password must be associated with an account on the FTP server. If you are writing to the server, the FTP server must be properly configured to accept the FTP write request from the user on the router.

If the server has a directory structure, the configuration file or image is written to or copied from the directory associated with the username on the server. For example, if the system image resides in the home directory of a user on the server, specify that user’s name as the remote username.

Refer to the documentation for your FTP server for more information.

Use the ip ftp username and ip ftp password commands to specify a username and password for all copies. Include the username in the copy command if you want to specify a username for that copy operation only.

Copying an Image from Flash Memory to an FTP Server

To copy a system image to an FTP network server, complete the tasks in this section:

Procedure


Step 1

enable

Example:


Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:


Router# configure terminal

(Optional) Enters global configuration mode. This step is required only if you override the default remote username or password (see Steps 2 and 3).

Step 3

ip ftp username username

Example:


Router(config)# ip ftp username user1

(Optional) Changes the default remote username.

Step 4

ip ftp password password

Example:


Router(config)# ip ftp password guessme

(Optional) Changes the default password.

Step 5

end

Example:


Router(config)# end

(Optional) Exits global configuration mode. This step is required only if you override the default remote username or password (see Steps 2 and 3).

Step 6

show flash-filesystem :

Example:


Router# show flash:

(Optional) Displays the system image file in the specified flash directory. If you do not already know it, note the exact spelling of the system image filename in flash memory.

Step 7

copy flash-filesystem : filename ftp: [[[// [username [: password ]@ ]location ]/ directory ]/ filename ]

Example:


Router# copy slot0:1:your-ios ftp://myuser:mypass@172.23.1.129/dirt/sysadmin/your-ios

Copies the image to the FTP server.

Note

 

After you have issued the copy privileged EXEC command, you may be prompted for additional information or for confirmation of the action. The prompting will depend on how much information you provide in the copy command and the current setting of the fileprompt global configuration command.


Examples

The following example uses the showslot1:privileged EXEC command to display the name of the system image file in the second PCMCIA slot, and copies the file (test) to an FTP server:


Router# show slot1:
-#- ED --type-- --crc--- -seek-- nlen -length- -----date/time------ name
1   .. 1        46A11866 2036C   4    746      May 16 1995 16:24:37 test
Router# copy slot1:test ftp://thisuser:thatpass@172.16.13.110/test
writing test!!!!...
successful ftp write.

In this example, the file named your-ios is copied from partition 1 of the flash memory PC card in slot 0 to the TFTP server at 172.23.1.129. The file will be saved with the name your-ios in the dirt/sysadmin directory relative to the directory of the remote username.


Router# show slot0: partition 1
PCMCIA Slot0 flash directory, partition 1:
File  Length   Name/status
  1   1711088 your-ios 
[1711152 bytes used, 2483152 available, 4194304 total]
Router# copy slot0:1:your-ios ftp://myuser:mypass@172.23.1.129/dirt/sysadmin/your-ios
Verifying checksum for 'your-ios' (file # 1)...  OK
Copy 'your-ios' from Flash to server
  as 'dirt/sysadmin/ios-2'? [yes/no] yes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Upload to server done
Flash device copy took 00:00:23 [hh:mm:ss]

Copying from an FTP Server to Flash Memory

To copy a system image from an FTP server to a flash memory file system, complete the tasks in this section:

Procedure


Step 1

enable

Example:


Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

show flash-filesystem :

Example:


Router# show flash:

(Optional) Displays the system image filename in Flash memory. Use this command to verify the url-path of the file and the exact spelling of the system image filename for use in the next command.

Step 3

copy flash-url tftp :[[[// location ]/ directory ]/ filename ]

Example:


Router# copy slot0:1:your-ios tftp://172.23.1.129/dirt/sysadmin/your-ios

Copies the system image from Flash memory to a TFTP server. Specify the file location and filename as the flash-url argument.

Note

 

After you have issued the copy privileged EXEC command, you may be prompted for additional information or for confirmation of the action. The prompting will depend on how much information you provide in the copy command and the current setting of the fileprompt global configuration command.

Step 4

configure terminal

Example:


Router# configure terminal

(Optional) Enters global configuration mode from the terminal. This step is required only if you want to override the default remote username or password (see Steps 3 and 4).

Step 5

ip ftp username username

Example:


Router(config)# ip ftp username netuser1

(Optional) Changes the default remote username.

Step 6

ip ftp password password

Example:


Router(config)# ip ftp password guessme

(Optional) Changes the default password.

Step 7

end

Example:


Router(config)# end

(Optional) Exits global configuration mode. This step is required only if you override the default remote username or password (see Steps 3 and 4).

Step 8

copy ftp: [[[// [username [: password ]@ ]location ] / directory ]/ filename ] flash-filesystem: [filename ]

Example:


Router# copy ftp://myuser:mypass@theserver/tftpboot/sub3/c7200-js-mz slot1:c7200-js-mz

Copies the configuration file from a network server to running memory or the startup configuration using rcp.

Note

 

After you have issued the copy privileged EXEC command, you may be prompted for additional information or for confirmation of the action. The prompting will depend on how much information you provide in the copy command and the current setting of the fileprompt global configuration command.


Examples

The following example illustrates how to use the reload command to reload the software on the router on the current day at 7:30 p.m.:


Router# reload at 19:30
Reload scheduled for 19:30:00 UTC Wed Jun 5 1996 (in 2 hours and 25 minutes)
Proceed with reload? [confirm]

The following example illustrates how to use the reload command to reload the software on the router at a future time:


Router# reload at 02:00 jun 20
Reload scheduled for 02:00:00 UTC Thu Jun 20 1996 (in 344 hours and 53 minutes)
Proceed with reload? [confirm]