CCNA® Lab 4 - TFTP Server and Configuration Backup



Lab 4 Goals

● Explain locations for Cisco® device configuration
● Back up switch configuration to an external TFTP server
● Configure switch using the external configuration

Requirements

● Cisco switch configured with basic configuration from Labs 2 and 3
● PC with COM port, Ethernet port, TFTP server software
● Cisco rollover cable
● Ethernet cable

Process

● Connect the rollover cable and the Ethernet cable to PC1
● Configure the PC to the IP address shown above: 192.168.1.3 255.255.255.0
● Power on the switch and manage the switch using the console connection

Background

Cisco considers three device configuration files for the same device:

  • The running-config that resides in RAM and actually controls the device functions

  • The startup-config that resides in NVRAM, and is loaded when the device boots

  • An external copy of the configuration, stored on a TFTP server

The problem is that these configuration files are not automatically synchronized, and therefore, there can be differences between the configurations. As you have seen in Labs 2 and 3, configuration changes are made to the running-config. They are not saved until the command "copy running-config startup-config" backs up the running configuration. If changes are not saved, the "old" configuration will load the next time the device boots, and the device will not function as it is supposed to. Usually, a process that a customer considers very important stops working.

This can be an exciting time in a network, with much loud discussion about why a customer isn't working as they should. The customer expresses their concern to management, usually loudly, and management expresses their concerns to the technicians, usually loudly. Then a technician remembers that changes were made, finds the work order or change document, and makes the changes. Eventually the customer and management calm down and may even forget that the problem happened. Until the next time someone forgets to save changes made to a device.

Unfortunately, this happens more often than you might think. The solution to this problem is simple: save the changed configuration with the command "copy running-config startup-config".

While the problem above was caused by incomplete procedures and carelessness, a larger problem occurs when a device fails completely. If the only configurations are stored on the device as the running and startup configurations, the only method of recovering the configuration is to type it all in again, hoping that someone remembers everything that should be in the configuration. Life is not usually so kind. Technicians do not document their processes so well. After all, these were the same technicians that forgot to back up the configuration to the startup-config.

Cisco provided a solution. The IOS has the capability to move configurations between the router or switch, and an external server. This process uses an IP protocol called Trivial File Transfer Protocol: TFTP. Because the protocol is TFTP, the server is usually called a TFTP server (even though there can be other applications running on the server).

This lab will use TFTP to backup up a configuration and to restore the configuration to labsw1. The TFTP server should be connected to labsw1, which has the configuration from Labs 2 and 3. If you have have a hardware lab, you must have a TFTP server. The IP address for the TFTP server is 192.168.1.3 255.255.255.0. If you are using Packet Tracer, install a generic server, configure it with IP address 192.168.1.3 255.255.255.0, and make sure that TFTP is "on."

Backing up the configuration to a TFTP server

The format for all copy commands is the same:

copy [existing-location] [target-location]

For the copy command used in previous labs

• the existing location was the running-config
• the target location was the startup-config

The command to save the configuration is
copy running-config startup-config

Saving a configuration to a TFTP server uses the same format. To copy the running configuration to the TFTP server:
copy running-config tftp

To restore a configuration from a TFTP server to a new device, a similar copy command is used. The existing location is the TFTP server, and target location is the startup-config (never, never, copy a configuration to the running config. The configuration is merged with the existing configuration, and may cause problems).

The TFTP copy process

The process is always done in the router or switch. Before starting the copy process, it is advisable to test connectivity with a ping from the router or switch to IP address of the TFTP server:

1. labsw1>ping 192.168.1.3 If the test fails, check equipment configuration and connectivity."
2. labsw1> enable
(Enter the enable password when prompted)"
3. labsw1 # copy run tftp

Copying a configuration to a TFTP server will result in two prompts. The first prompt is for the IP address or DNS name of the server(DNS not yet covered). The IP address is 192.168.1.3.

4. Address or name of remote host []? 192.168.1.3
5. Destination filename [labsw1-confg]?

Pressing Enter will accept the default name “labsw1-config”. The name can be changed if desired, for example, to labsw1."

6. Destination filename [labsw1-config]? labsw1
!!!!!!!!!

“!!!!!!!
” is an indication that the copy process is working successfully. If the attempt was unsuccessful, the indication would be “....” If the copy is unsuccessful, check connectivity by a ping from the PC to the switch, and by verifying the function and configuration of the TFTP server software. Ping the IP address of the TFTP server to verify connectivity.

Depending on your system, it is possible to view the stored configuration on the TFTP server. The file is an ASCII file, and it will reside in the directory that you specified for the TFTP files. From a command prompt on the PC, use the "type" or "more" command to view the file. Notice that it is the same as the show running-config display on the switch.

Packet Tracer will show that the file was copied, but does not allow you to view the contents of the file. Verify the existence of the file by using Config > Services > TFTP. The file should be near the bottom of the list.

Test the restoration of the configuration from the TFTP server. To test, it is necessary to delete the startup configuration and reload the switch. Reloading the switch after deleting the startup configuration will return the switch to factory defaults. To delete the startup configuration:

7. labsw1# erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
Press Enter to confirm
[OK]
Erase of nvram: complete
03:52:58: %SYS-7-NV_BLOCK_INIT: Initalized the geometry of nvramload
8. labsw1#reload

You may be presented with the following prompt:

System configuration has been modified. Save? [yes/no]:

Replying “yes” to save the configuration will be the same as the command “copy run start.” The goal is to reload the switch with no configuration. Reply “no”.

Proceed with reload? [confirm] Press Enter
03:53:05: %SYS-5-RELOAD: Reload requested

When the reload is complete, you will see

Press RETURN to get started!


Press Enter, and the switch will prompt:

Switch >


Before the configuration can be restored from the TFTP server, the switch must be configured with enough information that it can communicate with the TFTP server. For this lab, the interface VLAN 1 configuration must be restored.

9. Switch> enable
10. Switch# configuration terminal
11. Switch (config)#interface VLAN 1
12. Switch (config-if)# IP address 192.168.1.75 255.255.255.0
13. Switch (config-if)# no shutdown
14. Switch (config-if)#Crtl-Z
Switch#

At this point, the switch should be able to communicate with the TFTP server. To test the configuration, ping the IP address of the TFTP server::

15. Switch # ping 192.168.1.3

The ping should be successful.

Sending 5, 100-byte ICMP Echos to 192.168.1.3, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 31/31/31 ms

If the ping is successful, it will be possible to restore the configuration. From the switch:

16. Switch# copy tftp start

The information required to complete the copy is the same information above. Respond to the prompt with the information provided.

17. Address or name of remote host []? 192.168.1.3
18. Source filename []? labsw1 (Note: name must exactly match the name of the file saved above in Step 3.)
19. Destination filename [startup-config]? Press Enter to accept
Accessing tftp://192.168.1.3/labsw1-config...
Loading labsw1 from 192.168.0.3 (via Vlan1): !!!!
[OK - 1459 bytes]
[OK]
1459 bytes copied in 18.456 secs (79 bytes/sec)

Switch#

The copy was successful. The startup configuration can be viewed before reloading

20. Switch# show startup-config


The startup configuration should contain the same information created in Labs 2 and 3. Reload the switch to move the startup configuration into the running configuration.

21. Switch# reload

The switch will reload with the labsw1 configuration. Test the passwords, etc., and verify that the configuration is the one that was created in Labs 1 and 2.

Note: This lab is a very simple example of using a TFTP server. The server is in the same network/subnet as the switch. That will not be true in most networks. Missing from this example is a default gateway, required for most enterprise networks. The default gateway is related to routing, and will be covered in later labs.