How to: Export Configuration Files from a Switch to a TFTP Server

How to: Import/Export Files to/from a Switch Using a TFTP Server


Overview

This document describes how to export the current configuration file of a switch to a Trivial File Transfer Protocol (TFTP) server. This process is essential for network administrators to back up switch configurations and to ensure smooth recovery in case of a configuration error or hardware failure.


Pre-requisites

  1. A TFTP client such as Tftpd64.

Link to download Tftpd64: https://pjo2.github.io/tftpd64/

Through the TFTP client, ensure that the TFTP server is running and accessible by verifying the IP address of the TFTP server (in this example, 192.168.2.2).
  1. SSH/Telnet/Serial client such as PuTTY or Tera Term.

Link to download PuTTY: https://www.putty.org/

  1. Procedure for connecting to the switch via SSH, Telnet, or the console port as the following procedure will require this knowledge.

The procedure(s) to connect to the switch via SSH, Telnet, or the console port can be found in the Basic Operation Configuration Guide.


Procedure 

Set the PC IP Address

1. Navigate to the Control Panel on your Windows PC and select the View network status and tasks under the Network and Internet heading.


2. Click on the Change adapter settings in the left panel of the window.


3. In the Network Connections window, double click on the Ethernet port that will be used to access the switch. In the example below, Ethernet 2 was the port connected to the switch.


4. At the bottom of the Ethernet status menu click on the Properties button.


5. Under the “This connection uses the following items:” list heading, double click on Internet Protocol Version 4 (TCP/IPv4)


6. Click on the Use the following IP address radio button and change the IP address of your PC to an IP address within the subnet of your switch. Your switch IP address can be found using the Basic Operation Configuration Guide which will be the default IP address of 192.168.1.238. When finished entering the parameters, click on OK. In this example, the switch IP address is 192.168.2.110, so the PC IP address was set to 192.168.2.2 with a /24 subnet.


Set up the TFTP client

Open Tftpd64. Change the Current Directory to the folder you intend to have the switch config saved to on your PC. In this example, the Downloads folder was the intended directory. From the Server Interfaces dropdown select the IP address of your PC that was setup in the "Set the IP Address" section. The example IP address set was 192.168.2.2.


Commands for copying the switch configurations

1. Connect to the switch via SSH, Telnet, or the console cable and log in using your username and password. Per the Basic Operation Configuration Guide the default credentials are admin/admin. Screenshots below represent a connection to the switch through Telnet.




2. To export the current running configuration file, run the following command with your IP address inserted in place of 192.168.2.2 (192.168.2.2 was the example PC’s IP address):
      ```
      copy running-config tftp://192.168.2.2/test.cfg
      enter “y” when prompted
      ```
Expected return from the above command:


3. To export the startup configuration file, run the following command:

      ```

      copy startup.cfg tftp://192.168.2.2/test2.cfg

      enter “y” when prompted

      ```

Expected return from the above command:


This command instructs the switch to copy the startup configuration (i.e., the configuration loaded when the switch is powered on or restarted) to a TFTP server with the IP address 192.168.2.2. The file will be named "test2.cfg" on the TFTP server.


Guide to import a file, such as a NOS firmware image, to the switch

 1. Connect to the switch via SSH, Telnet, or the console cable and log in using your username and password. Per the Basic Operation Configuration Guide the default credentials are admin/admin. Screenshots below represent a connection to the switch through Telnet.



3. To import a nos.img file, run the following command below:
copy tftp://<PC-IP-address>/<name-of-file-on-PC> <name of file to be named on switch>
In this example:

Our PC IP address is:192.168.2.2

The filename that has been stored on the PC is: B002.img

The name of the file once imported to the switch’s directory: nos.img

Example command: copy tftp://192.168.2.2/B002.img nos.img

note: Make sure to remember to have the ".img" file extension at the end of the file being imported and the file to be saved to the switch.

If the connection is successful, you will see a large number of "#" populate in the terminal, as shown in the image below. This indicates that the switch is downloading the file from the TFTP server:


If the connection is unsuccessful, it will appear as shown below:

If this occurs, ensure that TFTPD64 is permitted through your Firewalls/Security programs.

Upon completion, the terminal will display: Write OK.

To load the imported file, use the following commands:

boot startup-config null (press the Enter key)

boot img nos.img primary (then press the Enter key)

The switch requires power to be cycled, and the imported image file will load upon restart.

Post-steps

For exporting:
Verify that the configuration files have been transferred successfully by accessing your TFTP server and confirming the presence of your exported files.


For uploading a new switch firmware:
In the CLI, enter in the command "show version". Verify that the software package version matches the switch firmware version you uploaded.