|
|
This chapter describes how to load and maintain configuration files. Configuration files contain commands entered to customize the function of the Cisco IOS software.
To benefit most from the instructions and organization of this chapter, your router must contain a minimal configuration that allows you to interact with the system software. You can create a basic configuration file using the setup command facility. See the user guide for your hardware platform for more information on using setup at first-time startup. See the "Using Configuration Tools" chapter in this document for information on using setup after first-time startup.
For a complete description of the configuration file commands in this chapter, refer to the "Configuration File Commands" chapter in the Release 12.1 Cisco IOS Configuration Fundamentals Command Reference. To locate documentation of other commands that appear in this chapter, use the command reference master index or search online.
![]() |
Note One or more of the commands that previously appeared in this chapter have been replaced by new commands. Table 13 maps the old commands to their replacements. The old commands continue to perform their normal functions in the current release, but support for these commands will cease in a future release. |
| Old Command | New Command |
|---|---|
configure network copy rcp running-config copy tftp running-config | copy ftp: system:running-config copy rcp: system:running-config copy tftp: system:running-config |
configure overwrite-network copy rcp startup-config copy tftp startup-config | copy ftp: nvram:startup-config copy rcp: nvram:startup-config copy tftp: nvram:startup-config |
show configuration show startup-config | more nvram:startup-config |
write erase erase startup-config | erase nvram: |
write memory copy running-config startup-config | copy system:running-config nvram:startup-config |
write network copy running-config rcp copy running-config tftp | copy system:running-config ftp: copy system:running-config rcp: copy system:running-config tftp: |
write terminal show running-config | more system:running-config |
To load and maintain configuration files needed for startup, complete any of the tasks in the following sections:
![]() |
Note These tasks assume you have a minimal configuration that you want to modify. |
Use the following commands in EXEC mode to display information about configuration files:
| Command | Purpose | |
|---|---|---|
Step 1 | show bootvar | List the contents of the BOOT environment variable, the name of the configuration file pointed to by the CONFIG_FILE environment variable, and the contents of the BOOTLDR environment variable. |
Step 2 | more file-url | List the configuration information stored in a specified file. |
Step 3 | more system:running-config | List the configuration information in running memory. |
Step 4 | more nvram:startup-config | List the startup configuration information. On all platforms except the Class A Flash file system platforms, the startup configuration is usually NVRAM. On the Class A Flash file system platforms, the CONFIG_FILE environment variable points to the startup configuration. The CONFIG_FILE variable defaults to NVRAM. |
Configuration files contain the commands the router uses to customize the function of the Cisco IOS software. The setup command facility helps you create a basic configuration file. However, you can manually change the configuration by typing commands in a configuration mode.
Startup configuration files are used during system startup to configure the software. Running configuration files contain the current configuration of the software. The two configuration files can be different. For example, you may want to change the configuration for a short time period rather than permanently. In this case, you would change the running configuration using the configure terminal command but not save the configuration using the copy system:running-config nvram:startup-config command.
To change the running configuration, use the configure terminal command, as described in the "Configuring Cisco IOS from the Terminal" section. To change the startup-config, you can either save the running configuration file to the startup configuration using the copy system:running-config nvram:startup-config command (which is also described in the "Configuring Cisco IOS from the Terminal" section) or copy commands from a file server to the startup configuration without affecting the running configuration (refer to the "Copying Configuration Files from a Network Server to the Router" section).
The configuration files are stored in the following places:
To enter configuration mode, enter the configure command at the privileged EXEC prompt. The Cisco IOS software responds with the following prompt asking you to specify the terminal, memory, or a file stored on a network server (network) as the source of configuration commands:
Configuring from terminal, memory, or network [terminal]?
Configuring from the terminal allows you to enter configuration commands at the command line. Refer to the "Configuring Cisco IOS from the Terminal" section for details. Configuring from memory reexecutes the commands in the startup configuration file. See the "Reexecuting the Configuration Commands in Startup Configuration" section for more details. Configuring from the network allows you to load and execute configuration commands over the network. See the "Copying Configuration Files from a Network Server to the Router" section for more details.
The Cisco IOS software accepts one configuration command per line. You can enter as many configuration commands as you want.
You can add comments to a configuration file describing the commands you have entered. Precede a comment with an exclamation point (!). Because comments are not stored in NVRAM or in the active copy of the configuration file, comments do not appear when you list the active configuration with the more system:running-config EXEC command. Also, when the startup configuration is NVRAM, comments do not show up when you list the startup configuration with the more nvram:startup-config EXEC command. Comments are stripped out of the configuration file when it is loaded onto the router. However, you can list the comments in configuration files stored on an FTP, rcp, or TFTP server.
When you configure the software from the terminal, the software executes the commands you enter at the system prompts. To configure the software from the terminal, use the following commands:
| Command | Purpose | |
|---|---|---|
Step 1 | configure terminal | Enters global configuration mode and select the terminal option. |
Step 2 | Enter the necessary configuration commands. The Cisco IOS documentation set describes configuration commands organized by technology. | |
Step 3 | end or press Ctrl-Z (^Z) | Exits global configuration mode. |
Step 4 | copy system:running-config nvram:startup-config | Saves the configuration file to your startup configuration. On most platforms, this step saves the configuration to NVRAM. On the Class A Flash file system platforms, this step saves the configuration to the location specified by the CONFIG_FILE environment variable. The CONFIG_FILE variable defaults to NVRAM. |
In the following example, the router-prompt name of the router is configured. The comment line, indicated by the exclimation mark (!), does not execute any command.
Router# configure terminal Router(config)# hostname new_name new_name(config)# end new_name# copy system:running-config nvram:startup-config
When the startup configuration is NVRAM, it stores the current configuration information in text format as configuration commands, recording only nondefault settings. The memory is checksummed to guard against corrupted data.
![]() |
Caution Some specific commands might not get saved to NVRAM. You will have to enter these commands again if you reboot the machine. These commands are noted in the documentation. We recommend that you keep a listing of these settings so you can quickly reconfigure your router after rebooting. |
You can copy configuration files from the router to a file server using FTP, rcp, or TFTP. You might do this task to back up a current configuration file to a server before changing its contents, thereby allowing you to later restore the original configuration file from the server. The following sections describe these tasks:
The protocol you use depends on which type of server you are using. The FTP and rcp transport mechanisms provide faster performance and more reliable delivery of data than TFTP. These improvements are possible because FTP and rcp are built on and use the Transmission Control Protocol/Internet Protocol (TCP/IP) stack, which is connection-oriented.
In some implementations of TFTP, you must create a dummy file on the TFTP server and give it read, write, and execute permissions before copying a file over it. Refer to your TFTP documentation for more information.
To store configuration information on a TFTP network server, use the following commands in the EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | copy system:running-config tftp:[[[//location]/directory]/filename] or copy nvram:startup-config tftp:[[[//location]/directory]/filename] | Specifies that the running or startup configuration file be stored on a network server. |
Step 2 | Reply to any router prompts for additional information or confirmation. The prompting will depending on how much information you provide in the copy command and the current setting of the file prompt command. |
The following example copies a configuration file from a router to a TFTP server:
Tokyo# copy system:running-config tftp://172.16.2.155/tokyo-confg Write file tokyo-confg on host 172.16.2.155? [confirm] y # Writing tokyo-confg!!! [OK]
You can copy a configuration file from the router to an rcp server.
If you copy the configuration file to a personal computer used as a file server, the computer must support rsh.
The rcp protocol requires a client to send a remote username on each rcp request to a server. When you copy a configuration file from the router to a server using rcp, the Cisco IOS software sends the first valid username in the following list:
1. The username specified in the copy command, if a username is specified.
2. The username set by the ip rcmd remote-username command, if the command is configured.
3. The remote username associated with the current TTY (terminal) process. For example, if the user is connected to the router through Telnet and was authenticated through the username command, the router software sends the Telnet username as the remote username.
4. The router host name.
For the rcp copy request to execute successfully, an account must be defined on the network server for the remote username. If the server has a directory structure, the configuration file or image is written to or copied from the directory associated with the remote username on the server. For example, if the system image resides in the home directory of a user on the server, you can specify that user's name as the remote username.
Use the ip rcmd remote-username command to specify a username for all copies. Include the username in the copy command if you want to specify a username for that copy operation only.
If you are writing to the server, the rcp server must be properly configured to accept the rcp write request from the user on the router. For UNIX systems, you must add an entry to the .rhosts file for the remote user on the rcp server. For example, suppose the router contains the following configuration lines:
hostname Rtr1 ip rcmd remote-username User0
If the router's IP address translates to Router1.company.com, then the .rhosts file for User0 on the rcp server should contain the following line:
Router1.company.com Rtr1
Refer to the documentation for your rcp server for more details.
To copy a startup configuration file or a running configuration file from the router to an rcp server, use the following commands, beginning in privileged EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | configure terminal | Enters configuration mode from the terminal. This step is required only if you override the default remote username (see Step 2). |
Step 2 | ip rcmd remote-username username | Changes the default remote username. |
Step 3 | end | Exits configuration mode. This step is required only if you override the default remote username (see Step 2). |
Step 4 | copy system:running-config rcp:[[[//[username@]location]/directory]/filename] or copy nvram:startup-config rcp:[[[//[username@]location]/directory]/filename] | Specifies that the router's running configuration be stored on an rcp server. or Specifies that the router's startup configuration file be stored on an rcp server. |
Step 5 | Reply to any router prompts for additional information or confirmation. The prompting will depending on how much information you provide in the copy command and the current setting of the file prompt command. |
The following example copies the running configuration file named rtr2-confg to the netadmin1 directory on the remote host with an IP address of 172.16.101.101:
Router# copy system:running-config rcp://netadmin1@172.16.101.101/Rtr2-confg Write file rtr2-confg on host 172.16.101.101?[confirm] Building configuration...[OK] Connected to 172.16.101.101 Router#
Rtr2# configure terminal Rtr2(config)# ip rcmd remote-username netadmin2 Rtr2(config)# end Rtr2# copy nvram:startup-config rcp: Remote host[]? 172.16.101.101 Name of configuration file to write [rtr2-confg]? Write file rtr2-confg on host 172.16.101.101?[confirm] ![OK]
You can copy a configuration file from the router 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 in the following list:
1. The username specified in the copy command, if a username is specified.
2. The username set by the ip ftp username command, if the command is configured.
3. Anonymous.
The router sends the first valid password in the following list:
1. The password specified in the copy command, if a password is specified.
2. The password set by the ip ftp password command, if the command is configured.
3. 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 details.
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.
To copy a startup configuration file or a running configuration file from the router to an FTP server, use the following commands beginning in privileged EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | configure terminal | (Optional) Enter configuration mode from the terminal. This step is required only if you override the default remote username or password (see Steps 2 and 3). |
Step 2 | ip ftp username username | (Optional) Change the default remote username. |
Step 3 | ip ftp password password | (Optional) Change the default password. |
Step 4 | end | (Optional) Exit configuration mode. This step is required only if you override the default remote username or password (see Steps 2 and 3). |
Step 5 | copy system:running-config ftp:[[[//[username[:password]@]location] or copy nvram:startup-config ftp:[[[//[username[:password]@]location] | Specify that the router's running configuration or startup configuration file be stored on an FTP server. |
Step 6 |
| Reply to any router prompts for additional information or confirmation. The prompting will depending on how much information you provide in the copy command and the current setting of the file prompt command. |
The following example copies the running configuration file named rtr2-confg to the netadmin1 directory on the remote host with an IP address of 172.16.101.101:
Router# copy system:running-config ftp://netadmin1:mypass@172.16.101.101/Rtr2-confg Write file rtr2-confg on host 172.16.101.101?[confirm] Building configuration...[OK] Connected to 172.16.101.101 Router#
Rtr2# configure terminal Rtr2(config)# ip ftp username netadmin2 Rtr2(config)# ip ftp password mypass Rtr2(config)# end Rtr2# copy nvram:startup-config rcp: Remote host[]? 172.16.101.101 Name of configuration file to write [rtr2-confg]? Write file rtr2-confg on host 172.16.101.101?[confirm] ![OK]
You can copy configuration files from a TFTP, rcp, or FTP server to the running configuration or startup configuration of the router. You may want to do this for one of the following reasons:
The copy {ftp: | rcp: | tftp:} system:running-config command loads the configuration files into the router as if you were typing the commands in at the command line. The router does not erase the existing running configuration before adding the commands. If a command in the copied configuration file replaces a command in the existing configuration file, the existing command will be erased. For example, if the copied configuration file contains a different IP address in a particular command than the existing configuration, the IP address in the copied configuration will be used. However, some commands in the existing configuration may not be replaced or negated. In this case, the resulting configuration file will be a mixture of the existing configuration file and the copied configuration file, with the copied configuration file having precedence.
In order to restore a configuration file to an exact copy of a file stored on a server, you need to copy the configuration file directly to the startup configuration (using the copy {ftp: | rcp: | tftp:} nvram:startup-config command) and reload the router.
The following sections describe these tasks:
The protocol you use depends on which type of server you are using. The FTP and rcp transport mechanisms provide faster performance and more reliable delivery of data than TFTP. These improvements are possible because the FTP and rcp transport mechanisms are built on and use the Transmission Control Protocol/Internet Protocol (TCP/IP) stack, which is connection-oriented.
To copy a configuration file from a TFTP server to the router, use the following commands in EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | copy tftp:[[[//location]/directory]/filename] system:running-config or copy tftp:[[[//location]/directory]/filename] nvram:startup-config | Copy a file from a TFTP server to the router. |
Step 2 | Reply to any router prompts for additional information or confirmation. The prompting will depending on how much information you provide in the copy command and the current setting of the file prompt command. |
In the following example, the software is configured from the file tokyo-config at IP address 172.16.2.155:
Router1# copy tftp://172.16.2.155/tokyo-confg system:running-config Configure using tokyo-confg from 172.16.2.155? [confirm] y Booting tokyo-confg from 172.16.2.155:!!! [OK - 874/16000 bytes]
You can copy configuration files from an rcp server to the router.
If you copy the configuration file to a personal computer used as a file server, the computer must support rsh.
The rcp protocol requires a client to send a remote username on each rcp request to a server. When you copy a configuration file from the router to a server using rcp, the Cisco IOS software sends the first valid username in the following list:
1. The username specified in the copy command, if a username is specified.
2. The username set by the ip rcmd remote-username command, if the command is configured.
3. The remote username associated with the current TTY (terminal) process. For example, if the user is connected to the router through Telnet and was authenticated through the username command, the router software sends the Telnet username as the remote username.
4. The router host name.
For the rcp copy request to execute successfully, an account must be defined on the network server for the remote username. If the server has a directory structure, the configuration file or image is written to or copied from the directory associated with the remote 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.
To copy a configuration file from an rcp server to the running configuration or startup configuration, use the following commands beginning in privileged EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | configure terminal | (Optional) Enter configuration mode from the terminal. This step is required only if you override the default remote username (see Step 2). |
Step 2 | ip rcmd remote-username username | (Optional) Specify the remote username. |
Step 3 | end | (Optional) Exit configuration mode. This step is required only if you override the default remote username (see Step 2). |
Step 4 | copy rcp:[[[//[username@]location]/directory]/filename] system:running-config or copy rcp:[[[//[username@]location]/directory]/filename] nvram:startup-config | Using rcp, copy the configuration file from a network server to running memory or the startup configuration. |
Step 5 | Reply to any router prompts for additional information or confirmation. The prompting will depending on how much information you provide in the copy command and the current setting of the file prompt command. |
Router# copy rcp://netadmin1@172.16.101.101/host1-confg system:running-config Configure using host1-confg from 172.16.101.101? [confirm] Connected to 172.16.101.101 Loading 1112 byte file host1-confg:![OK] Router# %SYS-5-CONFIG: Configured from host1-config by rcp from 172.16.101.101
Rtr2# configure terminal Rtr2(config)# ip rcmd remote-username netadmin1 Rtr2(config)# end Rtr2# copy rcp: nvram:startup-config Address of remote host [255.255.255.255]? 172.16.101.101 Name of configuration file[rtr2-confg]? host2-confg Configure using host2-confg from 172.16.101.101?[confirm] Connected to 172.16.101.101 Loading 1112 byte file host2-confg:![OK] [OK] Rtr2# %SYS-5-CONFIG_NV:Non-volatile store configured from host2-config by rcp from 172.16.101.101
You can copy configuration files from an FTP server to the router.
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 in the following list:
1. The username specified in the copy command, if a username is specified.
2. The username set by the ip ftp username command, if the command is configured.
3. Anonymous.
The router sends the first valid password in the following list:
1. The password specified in the copy command, if a password is specified.
2. The password set by the ip ftp password command, if the command is configured.
3. 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 details.
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.
To copy a configuration file from an FTP server to the running configuration or startup configuration, use the following commands beginning in privileged EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | configure terminal | (Optional) Enter configuration mode from the terminal. This step is required only if you override the default remote username or password (see Steps 2 and 3). |
Step 2 | ip ftp username username | (Optional) Change the default remote username. |
Step 3 | ip ftp password password | (Optional) Change the default password. |
Step 4 | end | (Optional) Exit configuration mode. This step is required only if you override the default remote username or password (see Steps 2 and 3). |
Step 5 | copy ftp:[[[//[username[:password]@]location] or copy ftp:[[[//[username[:password]@]location] | Using FTP, copy the configuration file from a network server to running memory or the startup configuration. |
Step 6 | Reply to any router prompts for additional information or confirmation. The prompting will depending on how much information you provide in the copy command and the current setting of the file prompt command. |
Router# copy rcp://netadmin1:mypass@172.16.101.101/host1-confg system:running-config Configure using host1-confg from 172.16.101.101? [confirm] Connected to 172.16.101.101 Loading 1112 byte file host1-confg:![OK] Router# %SYS-5-CONFIG: Configured from host1-config by ftp from 172.16.101.101
Rtr2# configure terminal Rtr2(config)# ip ftp username netadmin1 Rtr2(config)# ip ftp password mypass Rtr2(config)# end Rtr2# copy ftp: nvram:startup-config Address of remote host [255.255.255.255]? 172.16.101.101 Name of configuration file[rtr2-confg]? host2-confg Configure using host2-confg from 172.16.101.101?[confirm] Connected to 172.16.101.101 Loading 1112 byte file host2-confg:![OK] [OK] Rtr2# %SYS-5-CONFIG_NV:Non-volatile store configured from host2-config by ftp from 172.16.101.101
To maintain a configuration file that exceeds size of NVRAM, perform one of the tasks in the following sections:
The service compress-config global configuration command specifies that the configuration file is to be stored compressed in NVRAM. Once the configuration file has been compressed, the router functions normally. When the system is booted, it recognizes that the configuration file is compressed, expands it, and proceeds normally. The more nvram:startup-config EXEC command expands the configuration before displaying it.
To compress configuration files, use the following commands beginning in global configuration mode:
| Command | Purpose | |
|---|---|---|
Step 1 | Refer to the appropriate hardware installation and maintenance publication. | Verify that your system's ROMs support file compression. If not, you can install new ROMs that support file compression. |
Step 2 | service compress-config | Specify that the configuration file is to be compressed. |
Step 3 | end | Exit global configuration mode. |
Step 4 | Use FTP, rcp, or TFTP to copy the new configuration. If you try to load a configuration that is more than three times larger than the NVRAM size, the following error message is displayed: "[buffer overflow - file-size/buffer-size bytes]." or configure terminal | Enter the new configuration. |
Step 5 | copy system:running-config nvram:startup-config | When you have finished changing the running-configuration, save the new configuration. |
The size of the configuration must not exceed three times the NVRAM size. For a 128 KB size NVRAM, the largest expanded configuration file size is 384 KB.
The service compress-config command works only if you have Cisco IOS Software Release 10 boot ROMs or later. Installing new ROMs is a one-time operation and is necessary only if you do not already have Cisco IOS Release 10 in ROM. If the boot ROMs do not recognize a compressed configuration, the following message is displayed:
Boot ROMs do not support NVRAM compression Config NOT written to NVRAM
The example below compresses a 129 KB configuration file to 11 KB.
Router# configure terminal Router(config)# service compress-config Router(config)# end Router# copy tftp://172.16.2.15/tokyo-confg system:running-config Configure using tokyo-confg from 172.16.2.155? [confirm] y Booting tokyo-confg from 172.16.2.155:!!! [OK - 874/16000 bytes] Router# copy system:running-config nvram:startup-config Building configuration... Compressing configuration from 129648 bytes to 11077 bytes [OK]
On Class A Flash file system routers, you can store the startup configuration in Flash memory by setting the environment variable CONFIG_FILE to a file in internal Flash memory or Flash memory in a PCMCIA slot.
To store the startup configuration in Flash memory, use the following commands beginning in privileged EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | copy nvram:startup-config flash-filesystem:filename | Copy the current startup configuration to the new location to create the configuration file. |
Step 2 | configure terminal | Enter global configuration mode. |
Step 3 | boot buffersize bytes | The buffer that holds the configuration file is usually the size of NVRAM. Larger configurations need larger buffers. Change the size of the buffer that holds the configuration commands. |
Step 4 | boot config flash-filesystem:filename | Specify that the startup configuration file is to be stored in Flash memory by setting the CONFIG_FILE variable. |
Step 5 | end | Exit global configuration mode. |
Step 6 | Use FTP, rcp, or TFTP to copy the new configuration. If you try to load a configuration that is more than three times larger than the NVRAM size, the following error message is displayed: "[buffer overflow - file-size/buffer-size bytes]." or configure terminal | Enter the new configuration. |
Step 7 | copy system:running-config nvram:startup-config | When you have finished changing the running-configuration, save the new configuration. |
Refer to the "Specifying the CONFIG_FILE Environment Variable on Class A Flash File Systems" section for more information.
The following example stores the configuration file in slot 0:
Router# copy nvram:startup-config slot0:router-config Router# configure terminal Router(config)# boot buffersize 129000 Router(config)# boot config slot0:router-config Router(config)# end Router# copy system:running-config nvram:startup-config
Care must be taken when editing or changing a large configuration. Flash memory space is used every time a copy system:running-config nvram:startup-config is issued. Because file management for Flash memory, such as optimizing free space, is not done automatically, you must pay close attention to available Flash memory. Use the squeeze command to reclaim used space. Cisco recommends that you use a large-capacity Flash card of at least 20 MB.
You can also store large configurations on FTP, rcp, or TFTP servers and download them at system startup. To use a network server to store large configurations, use the following commands, beginning in privileged EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | copy system:running-config {ftp: | rcp: | tftp:} | Save the running configuration to an FTP, rcp, or TFTP server. |
Step 2 | configure terminal | Enter global configuration mode. |
Step 3 | boot buffersize bytes | The buffer that holds the configuration file is usually the size of NVRAM. Larger configurations need larger buffers. Change the size of the buffer that holds the configuration commands. |
Step 4 | boot network {ftp:[[[//[username[:password]@]location] /directory]/filename] | rcp:[[[//[username@]location]/directory]/ filename] | tftp:[[[//location]/directory]/filename]} | Specify that the startup configuration file is to be loaded from the network server at startup. |
Step 5 | service config | Enable the router to download configuration files at system startup. |
Step 6 | end | Exit global configuration mode. |
Step 7 | copy system:running-config nvram:startup-config | Save the configuration. |
Refer to the "Copying Configuration Files from the Router to a Network Server" and "Configuring the Router to Download Configuration Files" sections for more information on these commands.
On many platforms, you can copy configuration files from one Flash memory device, such as internal Flash memory or a Flash memory card in a PCMCIA slot, to other locations. You can also copy configuration files from an FTP, rcp, or TFTP server to Flash memory.
To copy a configuration file from Flash memory directly to your startup configuration in NVRAM or your running configuration, enter one of the following commands in EXEC mode:
| Command | Purpose |
|---|---|
copy filesystem:[partition-number:][filename] nvram:startup-config | Load a configuration file directly into NVRAM. |
copy filesystem:[partition-number:][filename] system:running-config | Copy a configuration file to your running configuration. |
The following example copies the file ios-upgrade-1 from partition 4 of the Flash memory PC Card in slot 0 to the router's startup configurations.
Router# copy slot0:4:ios-upgrade-1 nvram:startup-config
Copy 'ios-upgrade-1' from flash device
as 'startup-config' ? [yes/no] yes
[OK]
On platforms with multiple Flash memory file systems, you can copy files from one Flash memory file system, such as internal Flash memory or a Flash memory card in a PCMCIA slot, to another Flash memory file system. Copying files to different Flash memory file systems lets you create backup copies of working configurations and duplicate configurations for other routers.
To copy a configuration file between Flash memory file systems, use the following commands in EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | show source-filesystem: | Display the layout and contents of Flash memory to verify the file name. |
Step 2 | copy source-filesystem:[partition-number:][filename] dest-filesystem:[partition-number:][filename] | Copy a configuration file between Flash memory devices. |
Step 3 | verify dest-filesystem:[partition-number:][filename] | Verify the checksum of the file you copied. |
![]() |
Note The source device and the destination device cannot be the same. For example, the command copy slot1: slot1: is invalid. |
The following example copies the file running-config from partition 1 of internal Flash memory to partition 1 of slot 1 on a Cisco 3600 series router. In this example, the source partition is not specified, so the router prompts for the partition number.
Router# copy flash: slot1: System flash Partition Size Used Free Bank-Size State Copy Mode 1 4096K 3070K 1025K 4096K Read/Write Direct 2 16384K 1671K 14712K 8192K Read/Write Direct [Type ?<no> for partition directory; ? for full directory; q to abort] Which partition? [default = 1] System flash directory, partition 1: File Length Name/status 1 3142748 dirt/network/mars-test/c3600-j-mz.latest 2 850 running-config [3143728 bytes used, 1050576 available, 4194304 total] PCMCIA Slot1 flash directory: File Length Name/status 1 1711088 dirt/gate/c3600-i-mz 2 850 running-config [1712068 bytes used, 2482236 available, 4194304 total] Source file name? running-config Destination file name [running-config]? Verifying checksum for 'running-config' (file # 2)... OK Erase flash device before writing? [confirm] Flash contains files. Are you sure you want to erase? [confirm] Copy 'running-config' from flash: device as 'running-config' into slot1: device WITH erase? [yes/no] yes Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased ! [OK - 850/4194304 bytes] Flash device copy took 00:00:30 [hh:mm:ss] Verifying checksum... OK (0x16)
To copy a configuration file from an FTP server to a Flash memory device, use the following commands in privileged EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | configure terminal | (Optional) Enter configuration mode from the terminal. This step is required only if you override the default remote username or password (see Steps 2 and 3). |
Step 2 | ip ftp username username | (Optional) Specify the remote username. |
Step 3 | ip ftp password password | (Optional) Specify the remote password. |
Step 4 | end | (Optional) Exit configuration mode. This step is required only if you override the default remote username (see Steps 2 and 3). |
Step 5 | copy ftp:[[[//[username:password@]location] | Use FTP, copy the configuration file from a network server to the Flash memory device. |
Step 6 | Reply to any router prompts for additional information or confirmation. The prompting will depending on how much information you provide in the copy command and the current setting of the file prompt command. |
To copy a configuration file from an rcp server to a Flash memory device, use the following commands in privileged EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | configure terminal | (Optional) Enter configuration mode from the terminal. This step is required only if you override the default remote username (see Step2). |
Step 2 | ip rcmd remote-username username | (Optional) Specify the remote username. |
Step 3 | end | (Optional) Exit configuration mode. This step is required only if you override the default remote username (see Step 2). |
Step 4 | copy rcp:[[[//[username@]location]/directory]/filename] flash-filesystem:[partition-number:][filename] | Using rcp, copy the configuration file from a network server to the Flash memory device. |
Step 5 | Reply to any router prompts for additional information or confirmation. The prompting will depending on how much information you provide in the copy command and the current setting of the file prompt command. |
To copy a configuration file from a TFTP server to the router, use the following commands from EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | copy tftp:[[[//location]/directory]/filename] flash-filesystem:[partition-number:][filename] | Copy the file from a TFTP server to the Flash memory device. |
Step 2 | Reply to any router prompts for additional information or confirmation. The prompting will depending on how much information you provide in the copy command and the current setting of the file prompt command. |
Router# copy tftp:router-config slot0:new-config
To reexecute the commands located in the startup configuration, use the following command in privileged EXEC mode:
| Command | Purpose |
|---|---|
configure memory | Reexecute the configuration commands located in the startup configuration. |
You can clear the configuration information from the startup configuration. If you reboot the router with no startup configuration, the router will enter the setup facility so that you can configure the router from scratch.
To clear the contents of your startup configuration, use the following command in EXEC mode:
| Command | Purpose |
|---|---|
erase nvram: | Clear the contents of your startup configuration. |
For all platforms except the Class A Flash file system platforms, this command erases NVRAM. The startup configuration file cannot be restored once it has been deleted.
On Class A Flash file system platforms, when you use the erase startup-config command, the router erases or deletes the configuration pointed to by CONFIG_FILE environment variable. If this variable points to NVRAM, the router erases NVRAM. If the CONFIG_FILE environment variable specifies a Flash memory device and configuration filename, the router deletes the configuration file. That is, the router marks the file as "deleted," rather than erasing it. This feature allows you to recover a "deleted" file.
To delete a saved configuration from a specific Flash device, use the following command in EXEC mode:
| Command | Purpose |
|---|---|
delete flash-filesystem:filename | Deletes a specified configuration file on a specified Flash device. |
On Class A and B Flash file systems, when you delete a specific file in Flash memory, the system marks the file as deleted, allowing you to later recover a "deleted" file using the undelete command. Erased files cannot be recovered. To permanently erase the configuration file, use the squeeze command.
On Class C Flash file systems, you cannot recover a file that has been deleted.
If you attempt to erase or delete the configuration file specified by the CONFIG_FILE environment variable, the system prompts you to confirm the deletion.
The following example deletes the myconfig file from a Flash memory card inserted in slot 0:
Router# delete slot0:myconfig
Normally, the router uses the startup configuration file in NVRAM or the Flash file system specified by the CONFIG_FILE environment variable (Class A Flash file systems only) at startup. See the "Specifying the CONFIG_FILE Environment Variable on Class A Flash File Systems" section for details on setting the CONFIG_FILE variable.
You can also configure the router to automatically request and receive two configuration files from the network server at startup. See the "Configuring the Router to Download Configuration Files" section for details.
On Class A Flash file systems, you can configure the Cisco IOS software to load the startup configuration file specified by the CONFIG_FILE environment variable. The CONFIG_FILE variable defaults to NVRAM. To change the CONFIG_FILE variable, use the following commands beginning in EXEC mode:
| Command | Purpose | |
|---|---|---|
Step 1 | copy [flash-url | ftp-url | rcp-url | tftp-url | system:running-config | nvram:startup-config] dest-flash-url | Copy the configuration file to the Flash file system from which the router will load the file upon restart. |
Step 2 | configure terminal | Enter configuration mode from the terminal. |
Step 3 | boot config dest-flash-url | Set the CONFIG_FILE environment variable. This step modifies the runtime CONFIG_FILE environment variable. |
Step 4 | end | Exit configuration mode. |
Step 5 | copy system:running-config nvram:startup-config | Save this runtime CONFIG_FILE environment variable to your startup configuration. |
Step 6 | show bootvar | Optionally, verify the contents of the CONFIG_FILE environment variable. |
After you specify a location for the startup configuration file, nvram:startup-config is aliased to the new location of the startup configuration file. The more nvram:startup-config command will display the startup configuration, regardless of its location. The erase nvram:startup-config command will erase the contents of NVRAM and delete the file pointed to by the CONFIG_FILE environment variable.
When you save the configuration using the copy system:running-config nvram:startup-config command, the router saves a complete version of the configuration file to the location specified by the CONFIG_FILE environment variable and a distilled version to NVRAM. A distilled version is one that does not contain access list information. If NVRAM contains a complete configuration file, the router prompts you to confirm your overwrite of the complete version with the distilled version. If NVRAM contains a distilled configuration, the router does not prompt you for confirmation and proceeds with overwriting the existing distilled configuration file in NVRAM.
![]() |
Note If you specify a file in a Flash device as the CONFIG_FILE variable, every time you save your configuration file with the copy system:running-config nvram:startup-config command, the old configuration file is marked as deleted, and the new configuration file is saved to that device. Eventually, Flash memory will be full, since the old configuration files still take up memory. Use the squeeze command to permanently delete the old configuration files and reclaim the space. |
Router# copy system:running-config slot0:config2 Router# configure terminal Router(config)# boot config slot0:config2 Router(config)# end Router# copy system:running-config nvram:startup-config [ok] Router# show bootvar BOOT variable = slot0:rsp-boot-m CONFIG_FILE variable = nvram: Current CONFIG_FILE variable = slot0:config2 Configuration register is 0x010F
You can configure the router to load one or two configuration files at system startup. The configuration files are loaded into memory and read in as if you were typing the commands at the command line. Thus, the configuration for the router will be a mixture of the original startup configuration and the one or two downloaded configuration files.
For historical reasons, the first file the router downloads is called the network configuration file. The second file the router downloads is called the host configuration file. Two configuration files can be used when all of the routers on a network use many of the same commands. The network configuration file contains the standard commands used to configure all of the routers. The host configuration files contain the commands specific to one particular host. If you are loading two configuration files, the host configuration file should be the configuration file you want to have precedence over the other file. Both the network and host configuration files must reside on a network server reachable via TFTP, rcp, or FTP, and must be readable.
The rcp protocol requires a client to send a remote username on each rcp request to a server. When you copy a configuration file from the router to a server using rcp, the Cisco IOS software sends the first valid username in the following list:
1. The username specified in the boot network or boot host command, if a username is specified.
2. The username set by the ip rcmd remote-username command, if the command is configured.
3. The remote username associated with the current TTY (terminal) process. For example, if the user is connected to the router through Telnet and was authenticated through the username command, the router software sends the Telnet username as the remote username.
4. The router host name.
For the rcp copy request to execute successfully, an account must be defined on the network server for the remote username. If the server has a directory structure, the configuration file or image is written to or copied from the directory associated with the remote 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.
If you copy the configuration file to a personal computer used as a file server, the computer must support rsh.
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 in the following list:
1. The username specified in the copy command, if a username is specified.
2. The username set by the ip ftp username command, if the command is configured.
3. Anonymous.
The router sends the first valid password in the following list:
1. The password specified in the copy command, if a password is specified.
2. The password set by the ip ftp password command, if the command is configured.
3. 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 details.
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.
You can specify an ordered list of network configuration and host configuration filenames. The Cisco IOS software scans this list until it successfully loads the appropriate network or host configuration file.
To configure the router to download configuration files at system startup, perform at least one of the tasks described in the following sections:
Booting host-confg... [timed out]
Refer to the Internetwork Troubleshooting Guide publication for troubleshooting procedures.
If there are any problems with the startup configuration file, or if the configuration register is set to ignore NVRAM, the router enters the setup command facility. See the "Using Setup for Configuration Changes" chapter in this publication for details on the setup command.
To configure the Cisco IOS software to download a network configuration file from a server at startup, use the following commands:
| Command | Purpose | |
|---|---|---|
Step 1 | configure terminal | Enter configuration mode from the terminal. |
Step 2 | boot network {ftp:[[[//[username[:password]@]location] | Enter the network configuration filename to download a file using TFTP, rcp, or FTP. |
Step 3 | service config | Enable the router to automatically load the network file upon restart. |
Step 4 | end | Exit configuration mode. |
Step 5 | copy system:running-config nvram:startup-config | Save the configuration file to your startup configuration. |
For Step 2, if you do not specify a network configuration filename, the Cisco IOS software uses the default filename network-confg. If you omit the address, the router uses the broadcast address.
You can specify more than one network configuration file. The software tries them in order entered until it loads one successfully. This procedure can be useful for keeping files with different configuration information loaded on a network server.
To configure the Cisco IOS software to download a host configuration file from a server at startup, use the following commands in global configuration mode:
| Command | Purpose | |
|---|---|---|
Step 1 | configure terminal | Enter configuration mode from the terminal. |
Step 2 | boot host {ftp:[[[//[username[:password]@]location] | Enter the host configuration filename to be download using FTP, rcp, or TFTP. |
Step 3 | service config | Enable the device to automatically load the host file upon restart. |
Step 4 | end | Exit configuration mode. |
Step 5 | copy system:running-config nvram:startup-config | Save the configuration file to your startup configuration. |
If you do not specify a host configuration filename, the router uses its own name to form a host configuration filename by converting the name to all lowercase letters, removing all domain information, and appending -confg. If no host name information is available, the software uses the default host configuration filename router-confg. If you omit the address, the router uses the broadcast address.
You can specify more than one host configuration file. The Cisco IOS software tries them in order entered until it loads one successfully. This procedure can be useful for keeping files with different configuration information loaded on a network server.
In the following example, a router is configured to download the host configuration file hostfile1 and the network configuration file networkfile1: The router uses TFTP and the broadcast address to obtain the file.
Router# configure terminal Router(config)# boot host tftp:hostfile1 Router(config)# boot network tftp:networkfile1 Router(config)# service config Router(config)# end Router# copy system:running-config nvram:startup-config
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Posted: Tue Sep 12 18:29:00 PDT 2000
Copyright 1989-2000©Cisco Systems Inc.