configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router1(config)#
boot network tftp
boot host tftp
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, Recipe 1.4 shows how to compress the startup configuration file to help fit more information into your existing NVRAM. Also, since routers can operate for years without reloading, using this feature to keep your routers up to date seems pointless.
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:
%Error opening tftp://255.255.255.255/network-confg (Timed out) %Error opening tftp://255.255.255.255/cisconet.cfg (Timed out) %Error opening tftp://255.255.255.255/router1-confg (Timed out) %Error opening tftp://255.255.255.255/router1.cfg (Timed out)
Here you can see what happened when we enabled the service config option and reloaded our
router, which was called
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:
Loading Network-auto from 172.25.1.1 (via Ethernet0): ! [OK - 27/4096 bytes] Loading Router8-auto from 172.25.1.1 (via Ethernet0): ! [OK - 71/4096 bytes]
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.
show versionCisco Internetwork Operating System Software IOS (tm) 2500 Software (C2500-IO-L), Version 12.2(7a), RELEASE SOFTWARE (fc2) Copyright (c) 1986-2002 by cisco Systems, Inc. Compiled Thu 21-Feb-02 02:07 by pwade Image text-base: 0x0304CF80, data-base: 0x00001000 ROM: System Bootstrap, Version 5.2(8a), RELEASE SOFTWARE BOOTLDR: 3000 Bootstrap Software (IGS-RXBOOT), Version 10.2(8a), RELEASE SOFTWAR E (fc1) Router1 uptime is 4 minutes System returned to ROM by reload System image file is "flash:c2500-io-l.122-7a.bin" Host configuration file is "tftp://172.25.1.1/Router1-auto" Network configuration file is "tftp://172.25.1.1/Network-auto" cisco 2500 (68030) processor (revision D) with 16384K/2048K bytes of memory. Processor board ID 04915359, with hardware revision 00000000 Bridging software. X.25 software, Version 3.0.0. 2 Ethernet/IEEE 802.3 interface(s) 2 Serial network interface(s) 32K bytes of nonvolatile configuration memory. 16384K bytes of processor board System flash (Read ONLY) Configuration register is 0x2102
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:
00:00:25: AUTOINSTALL: Ethernet0 is assigned 172.25.1.30 00:00:25: AUTOINSTALL: Obtain siaddr 172.25.1.3 (as config server) 00:00:25: AUTOINSTALL: Obtain default router (opt 3) 172.25.1.3 %Error opening tftp://172.25.1.3/network-confg (No such file or directory) %Error opening tftp://172.25.1.3/cisconet.cfg (No such file or directory) %Error opening tftp://172.25.1.3/router-confg (No such file or directory) %Error opening tftp://172.25.1.3/ciscortr.cfg (No such file or directory) %Error opening tftp://172.25.1.3/network-confg (No such file or directory) %Error opening tftp://172.25.1.3/cisconet.cfg (No such file or directory)
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
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.