Booting the Router Using a Remote Configuration File:
You want to boot the router using an alternate configuration.
The following set of commands allows you to automatically load a configuration file located on a remote TFTP server when the router boots:
By default, when the router reloads, it will read the configuration information from a file in its Nonvolatile Random Access Memory (NVRAM). Cisco commonly refers to this file as the startup configuration file. However, you can configure the router to load all or part of its configuration from a remote server via TFTP. This feature does not prevent the router from loading its startup configuration from NVRAM. In fact, the router will load its local startup file first before proceeding to the TFTP server files.
Uses for this feature vary, although most people who implement it do so because their configuration file has grown too large for their NVRAM to handle. It can also be a useful way of keeping an access-list that is shared by a number of routers, centralized and up to date. And we have sometimes used it as a temporary measure when the NVRAM in a router is damaged.
However, we consider this feature to be highly risky and recommend avoiding it in most cases. If the problem is simply one of NVRAM capacity,
If you choose to implement remote configuration despite these cautions, we should mention a few other items. First, the router will attempt to load a host and a network file. The router will assume that network files are common to all routers, while the host files contain router specific information. When you enable the service config option, the router will attempt to first load a network file and then a host file. If it can’t find these files, the router will generate error messages:
Here you can see what happened when we enabled the service config option and reloaded our router, which was called router1. It attempted to load several different files automatically. The first two files have generic network filenames. Then it looks for the host file under two different names. The router attempts to load these configuration files from IP address 255.255.255.255 by default.
Then, when we added the boot commands, the router looks for the specified files from the appropriate TFTP server. Again, notice the order in which the router loaded the files, with the network file first followed by the host file:
If you do not configure the router to load specific network or host filenames, it will try to load the default files, shown in the trace above. If these files don’t exist, the router will pause for a significant amount of time while it tries to find them. So when you use this feature, you should always include both a network and a host file to load. If you don’t need a network file, for example, you can put a file on the server that only contains the keyword “end”.
This feature only loads configuration commands into the running configuration. It does not copy them into the startup configuration file.
The show version command tells you whether the router was able to load these files successfully:
The service config option is disabled by default. However, if the router tries to boot but cannot find its startup configuration file, it will automatically enable this option to attempt to find a configuration file through the network:
Two interesting things happen if you reload a router with an empty configuration file. First, the router enables its autoinstall option and attempts to acquire an IP address via DHCP. In this example, the router obtained a DHCP address of 172.25.1.30. Second, after it obtains a dynamic address, it attempts to load a configuration file via TFTP.
Notice the filenames that the router cycles through in an attempt to load a configuration file. If there happened to be a file with one of these names in the TFTP directory for some other reason, this router will have downloaded it and used its contents to configure itself, which could have caused serious problems.