|
|
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 Setup for Configuration Changes" chapter in this publication 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 Configuration Fundamentals Command Reference. To locate documentation of other commands that appear in this chapter, use the command reference master index or search online.
| Old Command | New Command |
|---|---|
| configure network | copy rcp running-config (for an rcp server)
copy tftp running-config (for a TFTP server) |
| configure overwrite-network | copy rcp startup-config (for an rcp server)
copy tftp startup-config (for a TFTP server) |
| show configuration | show startup-config |
| write erase | erase startup-config |
| write memory | copy running-config startup-config |
| write network | copy running-config rcp (for an rcp server)
copy running-config tftp (for a TFTP server) |
| write terminal | show running-config |
To load and maintain configuration files needed for startup, complete any of the tasks in the following sections:
Perform the following tasks in EXEC mode to display information about configuration files:
| Task | Command |
|---|---|
| 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. | show boot (Cisco 3600 series, Cisco 7000 family only) |
| List the configuration information stored in a specified file. | show file device:filename (Cisco 7000 family only) |
| List the configuration information in running memory. | show running-config |
| List the startup configuration information.
On all platforms except the Cisco 7000 family1, the startup configuration is usually NVRAM. On the Cisco 7000 family, the CONFIG_FILE environment variable points to the startup configuration. The CONFIG_FILE variable defaults to NVRAM. | show startup-config |
Refer to the Configuration Fundamentals Command Reference for examples of these commands.
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 running-config startup-config command.
To change the running configuration, use the configure terminal command, as described in the "Configure the Cisco IOS Software from the Terminal" section. To change the startup-config, you can either save the running configuration file to the startup configuration using the copy running-config startup-config command (which is also described in the "Configure the Cisco IOS Software from the Terminal" section) or copy commands from a file directory to the startup configuration without affecting the running configuration (refer to the "Copy 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 "Configure the Cisco IOS Software from the Terminal" section for details. Configuring from memory reexecutes the commands in the startup configuration file. See the "Reexecute 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 "Copy 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 show running-config EXEC command. Also, when the startup configuration is NVRAM, comments do not show up when you list the startup configuration with the show 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 a TFTP, rcp, or MOP 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, complete the following tasks:
| Task | Command |
|---|---|
| Step 1 Enter configuration mode and select the terminal option. | configure terminal |
| Step 2 Enter the necessary configuration commands. | See the appropriate chapter for specific configuration commands. |
| Step 3 Quit configuration mode. | end
or press Ctrl-Z (^Z) |
| Step 4 Save the configuration file to your startup configuration. On most platforms, this step saves the configuration to NVRAM. On the Cisco 7000 family, this step saves the configuration to the location specified by the CONFIG_FILE environment variable. The CONFIG_FILE variable defaults to NVRAM. | copy running-config startup-config |
Router1#configure terminalRouter1(config)#!The following command provides the router host name.Router1(config)#hostname router2Router2(config)#endRouter2#copy running-config 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.
You can copy configuration files from the router to a TFTP server or rcp server. 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 rcp transport mechanism provides faster performance and more reliable delivery of data than TFTP. These improvements are possible because rcp is built on and uses 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, complete the following tasks in the EXEC mode:
| Task | Command |
|---|---|
| Step 1 Specify that the running or startup configuration file be stored on a network server. | copy running-config tftp
or |
| Step 2 Enter the IP address of the network server. | ip-address |
| Step 3 Enter the name of the configuration file to store on the server. | filename |
| Step 4 Confirm the entry. | y |
The command prompts you for the destination host's address and a filename, as the following example illustrates.
The following example copies a configuration file from a router to a TFTP server:
Tokyo#copy running-config tftpRemote host [172.16.2.155]? Name of configuration file to write [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.
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. Use the ip rcmd remote-username command to specify which directory on the server to use. 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.
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, complete the following tasks:
| Task | Command |
|---|---|
| Step 1 Enter configuration mode from the terminal.
This step is required only if you override the default remote username (see Step 2). | configure terminal |
| Step 2 Specify the remote username. This step is optional, but recommended. | ip rcmd remote-username username |
| Step 3 Exit configuration mode. | end |
| Step 4 Specify that the router's running configuration or startup configuration file be stored on an rcp server. | copy running-config rcp
or |
| Step 5 Enter the IP address of the network server. | ip-address |
| Step 6 Enter the name of the configuration file to store on the server. | filename |
| Step 7 Confirm the entry. | y |
Router#configure terminalRouter(config)#iprcmd remote-usernamenetadmin1Router(config)#endRouter#copy running-config rcpRemote host[]?172.16.101.101Name of configuration file to write [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 terminalRtr2(config)#iprcmd remote-usernamenetadmin2Rtr2(config)#endRtr2#copy startup-config rcpRemote host[]?172.16.101.101Name 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 server or an rcp 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 tftp running-config and copy rcp running-config commands load the configuration files into the router as if you were typing the commands in at the command line. They do 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 tftp startup-config or copy rcp startup-config command) and reload the router.
The following sections describe these tasks:
You can copy configuration files from a TFTP or rcp server.The protocol you use depends on which type of server you are using. The rcp transport mechanism provides faster performance and more reliable delivery of data than TFTP. These improvements are possible because the rcp transport mechanism is built on and uses 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, complete the following tasks from EXEC mode:
| Task | Command |
|---|---|
| Step 1 Copy a file from a TFTP server to the router. | copy tftp running-config
or copy tftp startup-config |
| Step 2 When prompted, enter the IP address or domain name of the server. | ip-address or name |
| Step 3 If prompted, enter the filename of the configuration file. | filename |
| Step 4 Confirm the entry. | y |
In the following example, the software is configured from the file tokyo-config at IP address 172.16.2.155:
Router1#copy tftp running-configHost or network configuration file [host]? IP address of remote host [255.255.255.255]?172.16.2.155Name of configuration file [tokyo-confg]? Configure using tokyo-confg from 172.16.2.155? [confirm]yBooting 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.
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. Use the ip rcmd remote-username command to specify which directory on the server to use. 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.
To copy a configuration file from an rcp server to the running configuration or startup configuration, perform the following tasks:
| Task | Command |
|---|---|
| Step 1 Enter configuration mode from the terminal. This step is required only if you override the default remote username (see Step 2). | configure terminal |
| Step 2 Specify the remote username. This step is optional, but recommended. | ip rcmd remote-username username |
| Step 3 Exit configuration mode. | end |
| Step 4 Using rcp, copy the configuration file from a network server to running memory or the startup configuration. | copy rcp running-config
or copy rcp startup-config |
| Step 5 When prompted, enter the IP address of the server. | ip-address |
| Step 6 When prompted, enter the name of the configuration file. | filename |
| Step 7 Confirm the entry. | y |
Router#configure terminalRouter(config)#iprcmd remote-usernamenetadmin1Router(config)#endRouter#copy rcp running-configHost or network configuration file [host]? Address of remote host [255.255.255.255]?172.16.101.101Name of configuration file [Router-confg]?host1-confgConfigure 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 terminalRtr2(config)#ip rcmd remote-usernamenetadmin1Rtr2(config)#endRtr2#copy rcp startup-configAddress of remote host [255.255.255.255]?172.16.101.101Name of configuration file[rtr2-confg]?host2-confgConfigure 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
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 show startup-config EXEC command expands the configuration before displaying it.
| Task | Command |
|---|---|
| Step 1 Verify that your system's ROMs support file compression. If not, you can install new ROMs that support file compression. | Refer to the appropriate hardware installation and maintenance publication. |
| Step 2 Specify that the configuration file is to be compressed. | service compress-config |
| Step 3 Exit global configuration mode. | end |
| Step 4 Enter the new configuration. | Use TFTP or rcp 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 |
| Step 5 When you have finished changing the running-configuration, save the new configuration. | copy running-config startup-config |
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 terminalRouter(config)#service compress-configRouter(config)#endRouter#copy tftp running-configHost or network configuration file [host]? IP address of remote host [255.255.255.255]?172.16.2.155Name of configuration file [tokyo-confg]? Configure using tokyo-confg from 172.16.2.155? [confirm]yBooting tokyo-confg from 172.16.2.155:!!! [OK - 874/16000 bytes] Router#copy running-config startup-configBuilding configuration... Compressing configuration from 129648 bytes to 11077 bytes [OK]
On the Cisco 7000 family 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, perform the following tasks, beginning in privileged EXEC mode:
| Task | Command |
|---|---|
| Step 1 Copy the current startup configuration to the new location to create the configuration file. | copy startup-config device:filename |
| Step 2 Enter global configuration mode. | configure terminal |
| Step 3 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. | boot buffersize bytes |
| Step 4 Specify that the startup configuration file is to be stored in Flash memory by setting the CONFIG_FILE variable. | boot config device:filename |
| Step 5 Exit global configuration mode. | end |
| Step 6 Enter the new configuration. | Use TFTP or rcp 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 |
| Step 7 When you have finished changing the running-configuration, save the new configuration. | copy running-config startup-config |
Refer to the "Specify the CONFIG_FILE Environment Variable (Cisco 7000 family)" section for more information.
The following example stores the configuration file in slot 0:
Router# copy startup-config slot0:router-config Router#configure terminalRouter(config)#boot buffersize 129000Router(config)#boot config slot0:router-configRouter(config)#endRouter#copy running-config startup-config
Care must be taken when editing or changing a large configuration. Flash memory space is used every time a copy running-config 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. Cisco recommends that you use a large-capacity Flash card of at least 20 MB.
You can also store large configurations on TFTP or rcp servers and download them at system startup. To use a network server to store large configurations, perform the following tasks, beginning in privileged EXEC mode:
| Task | Command |
|---|---|
| Step 1 Save the running configuration to a TFTP or rcp server. | copy running-config {tftp | rcp} |
| Step 2 Enter global configuration mode. | configure terminal |
| Step 3 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. | boot buffersize bytes |
| Step 4 Specify that the startup configuration file is to be loaded from the network server at startup. | boot network [tftp | rcp] filename [ip-address] |
| Step 5 Exit global configuration mode. | end |
| Step 6 Save the configuration. | copy running-config startup-config |
Refer to the "Copy Configuration Files from the Router to a Network Server" and "Configure the Router to Download Configuration Files" sections for more information on these tasks.
On many platforms, such as the Cisco 1600 series, Cisco 3600 series, and Cisco 7000 family routers, you can copy 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 a TFTP or rcp 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 command in EXEC mode:
| Task | Command |
|---|---|
| Load a configuration file directly into NVRAM. | copy device:[partition-number:][filename] startup-config (Cisco 1600 series and Cisco 3600 series)
copy [device:]filename startup-config (Cisco 7000 family) |
| Copy a configuration file to your running configuration. | copy device:[partition-number:][filename] running-config (Cisco 1600 series and Cisco 3600 series)
copy [device:]filename running-config (Cisco 7000 family) |
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 configuration on a Cisco 3600 series.
For a Cisco 1600 series router, the process will be the same except the device used in the copy command must be flash:
Router#copy slot0:4:ios-upgrade-1 startup-configCopy 'ios-upgrade-1' from flash device as 'startup-config' ? [yes/no]yes[OK]
On Cisco 3600 series and Cisco 7000 family routers, you can copy files from one Flash memory device, such as internal Flash memory or a Flash memory card in a PCMCIA slot, to another Flash memory device. Copying files to different Flash memory devices lets you create backup copies of working configurations and duplicate configurations for other routers.
To copy a configuration file between Flash memory devices, follow these steps in EXEC mode:
| Task | Command |
|---|---|
| Step 1 Display the layout and contents of Flash memory to verify the file name. | show device: [all | chips | detailed | err | partition number | summary] |
| Step 2 Copy a configuration file between Flash memory devices. | copy device:[partition-number:][filename] device:[partition-number:][filename] |
| Step 3 Verify the checksum of the file you copied. | verify device: [partition-number:][filename] |
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 ?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-configDestination 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]yesErasing 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 rcp server to a Flash memory device, perform the following task in privileged EXEC mode:
| Task | Command |
|---|---|
| Step 1 Enter configuration mode from the terminal. This step is required only if you override the default remote username (see Step 2). | configure terminal |
| Step 2 Specify the remote username. This step is optional, but recommended. | ip rcmd remote-username username |
| Step 3 Exit configuration mode. | end |
| Step 4 Using rcp, copy the configuration file from a network server to the Flash memory device. | copy rcp device:[partition-number:][filename] |
| Step 5 When prompted, enter the IP address of the server. | ip-address |
| Step 6 When prompted, enter the name of the configuration file. | filename |
| Step 7 Confirm the entry. | y |
To copy a configuration file from a TFTP server to the router, complete the following tasks from EXEC mode:
| Task | Command |
|---|---|
| Step 1 Copy the file from a TFTP server to the Flash memory device. | copy tftp device:[partition-number:][filename] |
| Step 2 When prompted, enter the IP address or domain name of the server. | ip-address or name |
| Step 3 If prompted, enter the filename of the configuration file. | filename |
| Step 4 Confirm the entry. | y |
Router# copy tftp:router-config slot0:new-config
To reexecute the commands located in the startup configuration, complete the following task in privileged EXEC mode:
| Task | Command |
|---|---|
| Reexecute the configuration commands located in the startup configuration. | configure memory |
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, perform the following task in EXEC mode:
| Task | Command |
|---|---|
| Clear the contents of your startup configuration. | erase startup-config |
For all platforms except the Cisco 7000 family, this command erases NVRAM. The startup configuration file cannot be restored once it has been deleted.
On the Cisco 7000 family, 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. Refer to the "Recover Deleted Files on a Flash Device" section for more information on recovering deleted files.
To erase or delete a saved configuration from a specific Flash device, complete one of the following tasks in EXEC mode:
| Task | Command |
|---|---|
| For the Cisco 7000 family, delete a specified configuration file on a specified Flash device. | delete [device:]filename (Cisco 7000 family) |
| For the Cisco 1600 series and Cisco 3600 series routers, erase a specified configuration file, all files on a device, or all files in a partition. | erase device:[partition-number] (Cisco 1600 series and Cisco 3600 series only) |
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.
For the Cisco 7000 family, if you omit the device name, the Cisco IOS software uses the default device specified by the cd command.
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 erases the myconfig file from a Flash memory card inserted in slot 0:
Router# erase slot0:myconfig
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 device specified by the CONFIG_FILE environment variable (Cisco 7000 family) at startup. See the "Specify the CONFIG_FILE Environment Variable (Cisco 7000 family)" 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 "Configure the Router to Download Configuration Files" section for details.
On the Cisco 7000 family, 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, complete the following tasks, beginning in EXEC mode:
| Task | Command |
|---|---|
| Step 1 Copy the configuration file to the device from which the router will load the file upon restart. | copy [flash | mop | rcp | tftp | running-config | startup-config] device:filename |
| Step 2 Enter configuration mode from the terminal. | configure terminal |
| Step 3 Set the CONFIG_FILE environment variable. This step modifies the runtime CONFIG_FILE environment variable. | boot config device:filename |
| Step 4 Exit configuration mode. | end |
| Step 5 Save this runtime CONFIG_FILE environment variable to your startup configuration. | copy running-config startup-config |
| Step 6 Optionally, verify the contents of the CONFIG_FILE environment variable. | show boot |
Possible devices are nvram, bootflash, slot0, and slot1.
When saving the runtime CONFIG_FILE environment variable to the startup configuration, 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.
Router#copy running-config slot0:config2Router#configure terminalRouter(config)#boot config slot0:config2Router(config)#endRouter#copy running-config startup-config[ok] Router#show bootBOOT variable = slot0:rsp-boot-m CONFIG_FILE variable = nvram: Current CONFIG_FILE variable = slot0:config2 Configuration register is0x010F
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 routers 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 MOP, and must be readable.
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. Use the ip rcmd remote-username command to specify which directory on the server to use. 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.
If you copy the configuration file to a personal computer used as a file server, the computer must support rsh.
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, complete the following tasks:
| Task | Command |
|---|---|
| Step 1 Enter configuration mode from the terminal. | configure terminal |
| Step 2 Enter the network configuration filename to download a file using TFTP, rcp, or MOP. | boot network mop filename [mac-address] [interface] |
| Step 3 Enable the router to automatically load the network file upon restart. | service config |
| Step 4 Exit configuration mode. | end |
| Step 5 Save the configuration file to your startup configuration. | copy running-config startup-config |
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 both the tftp and the rcp keywords, the software assumes that the you are using TFTP to transfer the file and that the server whose IP address you specify supports TFTP. 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, complete the following tasks.
| Task | Command |
|---|---|
| Step 1 Enter configuration mode from the terminal. | configure terminal |
| Step 2 Enter the host configuration filename to be download using MOP, rcp, or TFTP. | boot host mop filename [mac-address] [interface]
boot host [tftp | rcp] filename [ip-address] |
| Step 3 Enable the device to automatically load the host file upon restart. | service config |
| Step 4 Exit configuration mode. | end |
| Step 5 Save the configuration file to your startup configuration. | copy running-config startup-config |
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 both the tftp and the rcp keywords, the software assumes that the you are using TFTP to transfer the file and that the server whose IP address you specify supports TFTP. 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 terminalRouter(config)#boot host hostfile1Router(config)#boot network networkfile1Router(config)#service configRouter(config)#endRouter#copy running-config startup-config
|
|