After a switch is configured as an FTP client, it can log in to the FTP server for transferring files and managing files and directories on the FTP server. The configuration for accessing other devices using FTP is simple, and FTP supports file transfer and file directory management. FTP provides the authorization and authentication functions for managing files. However, data is transferred in plaintext, which brings security risks.
FTP is applicable to file transfer when high network security is not required, and is often used for downloading the system software from the FTP server and backing up the configuration file.
The following uses the command lines and outputs of the S5720-EI running V200R008C00 as an example.
As shown in Figure 1, the remote server at IP address 10.1.1.1/24 functions as the FTP server. The switch at IP address 10.2.1.1/24 functions as the FTP client and has reachable routes to the FTP server.
The switch needs to be upgraded. You need to download the system software from the FTP server to the switch and back up the current configuration file of the switch to the FTP server.
The configuration roadmap is as follows:
<HUAWEI> ftp 10.1.1.1 Trying 10.1.1.1 ... Press CTRL+K to abort Connected to 10.1.1.1. 220 FTP service ready. User(10.1.1.1:(none)):admin 331 Password required for admin. Enter password: 230 User logged in.
[ftp] binary //Set the file transfer mode to binary. The default mode is ASCII. [ftp] get devicesoft.cc //Download the system software on the FTP server to the switch. [ftp] put vrpcfg.zip //Upload the backup configuration file on the switch to the FTP server. [ftp] quit
The ASCII mode is used to transfer text files, and the binary mode is used to transfer programs including the system software (with the file name extension of .cc, .bin, or .pat), images, voices, videos, compressed packages, and database files.
# Run the dir command on the switch to check whether the system software is downloaded to the switch.
<HUAWEI> dir Directory of flash:/ Idx Attr Size(Byte) Date Time FileName 0 -rw- 14 Mar 13 2012 14:13:38 back_time_a 1 drw- - Mar 11 2012 00:58:54 logfile 2 -rw- 4 Nov 17 2011 09:33:58 snmpnotilog.txt 3 -rw- 11,238 Mar 12 2012 21:15:56 private-data.txt 4 -rw- 7,717 Mar 12 2012 21:15:54 vrpcfg.zip 5 -rw- 14 Mar 13 2012 14:13:38 back_time_b 6 -rw- 106,616,955 Mar 13 2012 14:24:24 devicesoft.cc 7 drw- - Oct 31 2011 10:20:28 sysdrv 8 drw- - Feb 21 2012 17:16:36 compatible 9 drw- - Feb 09 2012 14:20:10 selftest 10 -rw- 19,174 Feb 20 2012 18:55:32 backup.cfg 11 -rw- 43,496 Dec 15 2011 20:59:36 20111215.zip 12 -rw- 588 Nov 04 2011 13:54:04 servercert.der 13 -rw- 320 Nov 04 2011 13:54:26 serverkey.der 14 drw- - Nov 04 2011 13:58:36 security ... 509,256 KB total (52,752 KB free)# Check whether the file vrpcfg.zip is stored in the working directory on the FTP server.