cisco · IOS · 36 pp.
Cisco IOS: Руководство по управлению конфигурационными файлами PDF
Related manuals
Contents
Document text
Types of Configuration Files
Managing Configuration Files Prerequisites for Managing Configuration Files, on page 1 Restrictions for Managing Configuration Files, on page 1 Information About Managing Configuration Files, on page 1 How to Manage Configuration File Information, on page 8 Feature History for Managing Configuration Files, on page 35 Prerequisites for Managing Configuration Files • You should have at least a basic familiarity with the Cisco IOS environment and the command-line interface. • You should have at least a minimal configuration running on your system. You can create a basic configuration file using the setup command.
Restrictions for Managing Configuration Files • Many of the Cisco IOS commands described in this document are available and function only in certain configuration modes on the device. • Some of the Cisco IOS configuration commands are only available on certain device platforms, and the command syntax may vary on different platforms. Information About Managing Configuration Files Types of Configuration Files Configuration files contain the Cisco IOS software commands used to customize the functionality of your Cisco device.
Commands are parsed (translated and executed) by the Cisco IOS software when the system is booted (from the startup-config file) or when you enter commands at the CLI in a configuration mode. Startup configuration files (startup-config) are used during system startup to configure the software. Running configuration files (running-config) contain the current configuration of the software. The two configuration Managing Configuration Files 1
Location of Configuration Files
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 EXEC command but not save the configuration using the copy running-config startup-config EXEC command. To change the running configuration, use the configure terminal command, as described in the Modifying the Configuration File, on page 9 section. As you use the Cisco IOS configuration modes, commands generally are executed immediately and are saved to the running configuration file either immediately after you enter them or when you exit a configuration mode.
To change the startup configuration file, you can either save the running configuration file to the startup configuration using the copy running-config startup-config EXEC command or copy a configuration file from a file server to the startup configuration (see the “Copying a Configuration File from a TFTP Server to the Router” section for more information). Configuration Mode and Selecting a Configuration Source To enter configuration mode on the device, 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, as described in the following section. See the “Re-executing the Configuration Commands in the Startup Configuration File” section for more information. Configuring from the network allows you to load and execute configuration commands over the network. See the “Copying a Configuration File from a TFTP Server to the Switch” section for more information.
Configuration File Changes Using the CLI 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 or more system:running-config EXEC command. Comments are not displayed when you list the startup configuration with the show startup-config or more nvram:startup-config EXEC mode command.
Comments are stripped out of the configuration file when it is loaded onto the device. However, you can list the comments in configuration files stored on a File Transfer Protocol (FTP), Remote Copy Protocol (RCP), or Trivial File Transfer Protocol (TFTP) server. When you configure the software using the CLI, the software executes the commands as you enter them. Location of Configuration Files Configuration files are stored in the following locations: • The running configuration is stored in RAM. • On all platforms except the Class A Flash file system platforms, the startup configuration is stored in nonvolatile random-access memory (NVRAM).
Managing Configuration Files Configuration Mode and Selecting a Configuration Source Managing Configuration Files 2
Copying a Configuration File from the Device to a TFTP Server
• On Class A Flash file system platforms, the startup configuration is stored in the location specified by the CONFIG_FILE environment variable (see the Specifying the CONFIG_FILE Environment Variable on Class A Flash File Systems , on page 30 section). The CONFIG_FILE variable defaults to NVRAM and can be a file in the following file systems: nvram: (NVRAM) flash: (internal flash memory) usbflash0: (external usbflash file system) usbflash1: (external usbflash file system) Copy Configuration Files from a Network Server to the Device You can copy configuration files from a TFTP, rcp, or FTP server to the running configuration or startup configuration of the device.
You may want to perform this function for one of the following reasons: • To restore a backed-up configuration file. • To use the configuration file for another device. For example, you may add another device to your network and want it to have a similar configuration to the original device. By copying the file to the new device, you can change the relevant parts rather than recreating the whole file. • To load the same configuration commands on to all of the devices in your network so that all of the devices have similar configurations. The copy { ftp: | rcp:
| tftp:system:running-config } EXEC command loads the configuration files into the device as if you were typing the commands on the command line. The device 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 is 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 is used. However, some commands in the existing configuration may not be replaced or negated.
In this case, the resulting configuration file is a mixture of the existing configuration file and the copied configuration file, with the copied configuration file having precedence. 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 device. To copy configuration files from a server to a device, perform the tasks described in the following sections. The protocol that 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 TCP/IP stack, which is connection-oriented. Copying a Configuration File from the Device to a TFTP Server 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. Managing Configuration Files Copy Configuration Files from a Network Server to the Device Managing Configuration Files 3
Restrictions
Copying a Configuration File from the Device to an RCP Server You can copy a configuration file from the device to an RCP server. One of the first attempts to use the network as a resource in the UNIX community resulted in the design and implementation of the remote shell protocol, which included the remote shell (rsh) and remote copy (rcp) functions. Rsh and rcp give users the ability to execute commands remotely and copy files to and from a file system residing on a remote host or server on the network. The Cisco implementation of rsh and rcp interoperates with standard implementations. The rcp copy commands rely on the rsh server (or daemon) on the remote system.
To copy files using rcp, you need not create a server for file distribution, as you do with TFTP. You need only to have access to a server that supports the remote shell (rsh). (Most UNIX systems support rsh.) Because you are copying a file from one place to another, you must have read permission on the source file and write permission on the destination file. If the destination file does not exist, rcp creates it for you. Although the Cisco rcp implementation emulates the functions of the UNIX rcp implementation—copying files among systems on the network—the Cisco command syntax differs from the UNIX rcp command syntax.
The Cisco rcp support offers a set of copy commands that use rcp as the transport mechanism. These rcp copy commands are similar in style to the Cisco TFTP copy commands, but they offer an alternative that provides faster performance and reliable delivery of data. These improvements are possible because the rcp transport mechanism is built on and uses the TCP/IP stack, which is connection-oriented. You can use rcp commands to copy system images and configuration files from the device to a network server and vice versa. You also can enable rcp support to allow users on remote systems to copy files to and from the device.
To configure the Cisco IOS software to allow remote users to copy files to and from the device, use the ip rcmd rcp-enable global configuration command. Restrictions 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 device to a server using RCP, the Cisco IOS software sends the first valid username it encounters in the following sequence: 1. The username specified in the copy EXEC command, if a username is specified. 2. The username set by the ip rcmd remote-username global configuration 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 device through Telnet and was authenticated through the username command, the device software sends the Telnet username as the remote username. 4. The device 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 name as the remote username.
Use the ip rcmd remote-username command to specify a username for all copies. (Rcmd is a UNIX routine used at the super-user level to execute commands on a remote machine using an authentication scheme based on reserved port numbers. Rcmd stands for “remote command”). Include the username in the copy command if you want to specify a username for that copy operation only. Managing Configuration Files Copying a Configuration File from the Device to an RCP Server Managing Configuration Files 4