You can log in to the FTP server from the FTP client to download system software and configuration files from the FTP server to the client.
To transfer files with a remote FTP server or manage directories of the server, configure a device as an FTP client and use FTP to access the FTP server.
As shown in Figure 1, the FTP client and server are routable. To download system software and configuration files from the FTP server to the FTP client, log in to the FTP server from the FTP client.
The configuration roadmap is as follows:
Configure the user name and password for an FTP user to log in to the FTP server and the directory that the user will access.
Enable the FTP server function.
Run login commands to log in to the FTP server.
Configure the file transfer mode and working directory to allow the client to download files from the server.
To complete the configuration, you need the following data:
User name and password used by the FTP client for login
IP address of the FTP server: 1.1.1.1
Name of the file to be downloaded and directory of the file
<HUAWEI> system-view [~HUAWEI] aaa [*HUAWEI-aaa] local-user huawei password Please configure the password (8-128) Enter Password: Confirm Password:
The password must meet the following requirements:
The password is entered in man-machine interaction mode. The system does not display the entered password.
A password is a string of 8 to 16 case-sensitive characters and must contain at least two types of the following characters: uppercase letters, lowercase letters, digits, and special characters.
For example, the password "Aa123"45"" is valid, but the password "Aa 123"45"" is invalid.
The configured password is displayed in ciphertext in the configuration file.
[*HUAWEI-aaa] local-user huawei service-type ftp [*HUAWEI-aaa] local-user huawei ftp-directory cfcard:/ [*HUAWEI-aaa] local-user huawei level 3 [*HUAWEI-aaa] commit [*HUAWEI-aaa] quit
[~HUAWEI] interface LoopBack 0 [~HUAWEI-LoopBack0] ip address 10.1.1.1 255.255.255.255 [*HUAWEI-LoopBack0] quit [*HUAWEI] ftp server enable [*HUAWEI] ftp server-source -i loopback 0 [*HUAWEI] commit [~HUAWEI] quit
<HUAWEI> ftp 10.1.1.1
Trying 10.1.1.1 ...
Press CTRL+K to abort
Connected to 1.1.1.1.
220 FTP service ready.
User(10.1.1.1:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in.
[ftp]
[ftp] binary 200 Type set to I. [ftp] lcd new_dir:/ The current local directory is new_dir:. [ftp] commit
[ftp] get V800R021C00SPC100B020D0123.cc 200 Port command okay. 150 Opening BINARY mode data connection for V800R021C00SPC100B020D0123.cc. 226 Transfer complete. FTP: 1127 byte(s) received in 0.156 second(s) 7.22Kbyte(s)/sec. [ftp] quit
Run the dir command to check whether the required file has been downloaded to the client.
FTP server configuration file
#
aaa
local-user huawei password cipher @%@%UyQs4,KTtSwJo(4QmW#K,LC:@%@%
local-user huawei ftp-directory cfcard:/
local-user huawei level 3
local-user huawei service-type ftp
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 1.1.1.1 255.255.255.0
#
interface loopback 0
ip address 10.1.1.1 255.255.255.255
ftp server enable
ftp server-source -i loopback 0
#
return
FTP client configuration file
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 2.1.1.1 255.255.255.0
#
return