After a switch is configured as an FTP server, users can access the switch using the FTP client software on the local terminals. Users can then manage files between the switch and local terminals. The configuration for managing files 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 management when high network security is not required, and is often used in version upgrades.
The following uses the command lines and outputs of the S5720-EI running V200R008C00 as an example.
As shown in Figure 1, the PC connects to the switch, and the IP address of the management network interface on the switch is 10.136.23.5. The switch needs to be upgraded. The switch is required to function as the FTP server so that you can upload the system software from the PC to the switch and back up the configuration file to the PC.
The configuration roadmap is as follows:
<HUAWEI> system-view [HUAWEI] sysname FTP_Server [FTP_Server] ftp server enable //Enable the FTP server function. [FTP_Server] aaa [FTP_Server-aaa] local-user admin1234 password irreversible-cipher Helloworld@6789 //Set the login password to Helloworld@6789. [FTP_Server-aaa] local-user admin1234 privilege level 15 //Set the user level to 15. [FTP_Server-aaa] local-user admin1234 service-type ftp //Set the user service type to FTP. [FTP_Server-aaa] local-user admin1234 ftp-directory flash:/ //Set the FTP service authorized directory to flash:/. [FTP_Server-aaa] quit [FTP_Server] quit
<FTP_Server> save
The following example assumes that the PC runs the Windows XP operating system.
C:\Documents and Settings\Administrator> ftp 10.136.23.5 Connected to 10.136.23.5. 220 FTP service ready. User (10.136.23.5:(none)): admin1234 331 Password required for admin1234. Password: 230 User logged in. ftp> binary //Set the file transfer mode to binary. The default mode is ASCII. 200 Type set to I. ftp>
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.
# Upload the system software to the switch.
ftp> put devicesoft.cc 200 Port command okay. 150 Opening BINARY mode data connection for devicesoft.cc 226 Transfer complete. ftp: 106616955 bytes sent in 151.05 Seconds 560.79Kbytes/sec.
# Back up the configuration file of the switch to the PC.
ftp> get vrpcfg.zip 200 Port command okay. 150 Opening BINARY mode data connection for vrpcfg.zip. 226 Transfer complete. ftp: 1257 bytes received in 0.03Seconds 40.55Kbytes/sec.
Before uploading and downloading files to the FTP server, determine the FTP working directory on the FTP client. For example, the default FTP working directory on the Windows XP operating system is the login user working directory (such as C:\Documents and Settings\Administrator). This directory also stores the system software to be uploaded and backup configuration file.
# Run the dir command on the switch to check whether the system software is uploaded to the switch.
<FTP_Server> 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- 1,257 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- 23,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 FTP working directory on the PC.
FTP_Server configuration file
# sysname FTP_Server # FTP server enable # aaa local-user admin1234 password irreversible-cipher %^%#-=9Z)M,-aL$_U%#$W^1T-\}Fqpe$E<#H$J<6@KTSL/J'\}I-%^%# local-user admin1234 privilege level 15 local-user admin1234 ftp-directory flash:/ local-user admin1234 service-type ftp # return