01-08 File Management
01-08 File Management
Ethernet Switches
Configuration Guide - Basic Configuration 8 File Management
8 File Management
Storage Medium
The switch supports the flash memory.
In this format, drive indicates the storage medium and can be set to flash:.
drive of devices in a stack can be set to:
– flash: root directory of the flash memory of the master switch on a device
in a stack.
– stack ID#flash: root directory of the flash memory in a slot on a device in
a stack.
For example, slot2#flash: indicates the flash memory in slot 2.
In the file name, path indicates the directory and subdirectory. The directory
name is case-insensitive. Spaces and the following characters cannot be used
in the directory name: ~ * / \ : ' "
Paths are either absolute or relative. The relative path is related to the root
directory or the current working directory. A relative path starting with a slash
(/) is related to the root directory.
– flash:/my/test/ is an absolute path.
– /selftest/ is related to the root directory and indicates the selftest
directory in the root directory.
– selftest/ is related to the current working directory and indicates the
selftest directory in the current working directory.
For example, in the dir flash:/my/test/mytest.txt command, flash:/my/test/
is an absolute path.
Run the dir /my/test/mytest.txt command to find the mytest.txt file from a
directory related to the root directory.
Run the dir test/mytest.txt command to find the mytest.txt file from a
directory related to the current working directory (flash:/my/ for example).
NOTE
● In the file operation command format, filename indicates the file name.
● In the file operation command format, directory indicates the path (drive + path).
● When the device functions as a server, you can access the device from a
terminal to manage files on the device and transfer files between the device
and the terminal.
● When the device functions as a client, you can use the device to manage files
on other devices and transfer files between the device and other devices.
In Trivial File Transfer Protocol (TFTP) mode, the device can function only as a
client. In File Transfer Protocol (FTP), Secure File Transfer Protocol (SFTP), Secure
Copy Protocol (SCP), or File Transfer Protocol over SSL (FTPS) mode, the device
can function both as a server and a client.
In the scenario of
managing storage
media, directories,
and files, log in to You can log in to the Only files on the
the device through device directly to local device can be
Device
the console port, manage storage managed. File
login
Telnet, or STelnet. media, directories, transfer is not
This login mode is and files. supported.
mandatory for
storage medium
management.
● Data is encrypted
and protected.
● The SFTP mode
supports file
The SFTP mode is
transfer and
applicable to the
operations on
scenario with high
directories.
network security
● In SFTP mode, the Configurations are
SFTP requirements. The
SFTP and FTP complicated.
SFTP mode is widely
used in log functions are
download and file available on the
backup. device. (In FTPS
mode, FTPS and
FTP cannot be
configured
simultaneously.)
● Data is encrypted
The SCP mode is and protected.
applicable to the Configurations are
highly-efficient file ● In SCP mode, files complicated (similar
upload and are uploaded or to SFTP
SCP downloaded
download scenarios configurations), and
with high network when the client is interactions are not
security connected to the supported.
requirements. server, which is
efficient.
● Configurations
The FTPS mode uses are complicated,
the data encryption, and a set of
The FTPS mode is user identity certificates must
applicable to authentication, and be obtained from
scenarios with high message integrity Certificate
FTPS
network check mechanisms Authority (CA).
requirements and no to ensure the
FTP function. security of the TCP- ● To enable the
based application- FTPS function,
layer protocols. disable the FTP
function first.
Device login, FTP, and TFTP are easy to learn and configure. The following section
describes the remaining modes in more detail.
SFTP Mode
As a part of Secure Shell (SSH), SFTP allows remote users to securely log in to the
device and perform file management and transmission through the security
channel provided by SSH. Therefore, SFTP improves data transmission security. In
addition, the device can function as the SSH client to connect to the remote SSH
server for secure file transmission.
SSH security features:
● Encrypted transmission: When an SSH connection is set up, two devices
negotiate an encryption algorithm and a session key to ensure secure
communications between them.
● Public key-based authentication: The device supports the RSA, DSA, or ECC
authentication mode.
● Server authentication: The SSH protocol authenticates a server based on the
public key to defend against attacks from bogus servers.
● Interaction data check: The SSH protocol uses the CRC (for SSH1.5) or MD5-
based MAC algorithm (for SSH2.0) to check the data integrity and
authenticity. This mechanism protects the system from man-in-the-middle
attacks.
Establishment of an SSH connection:
1. Negotiate the SSH version.
The client and the server negotiate an SSH version by exchanging character
strings that specify the SSH version.
2. Negotiate the algorithm.
The server and the client negotiate the key exchange algorithm, encryption
algorithm, and MAC algorithm for subsequent communications.
3. Exchange keys.
Based on the key exchange algorithm, the server and the client obtain the
same session key and session ID after calculation.
4. Authenticate users.
The client sends an authentication request containing the user identity
information to the server. If the authentication succeeds or expires, the client
is disconnected from the server.
The public key-based and password-based authentication modes are
supported.
– In public key-based (RSA, DSA, or ECC) authentication mode, the client
must generate the RSA, DSA, or ECC key and send it to the server. When
a user initiates an authentication request, the client randomly generates
a text that is encrypted with the private key and sends it to the server.
The server decrypts the text by using the public key. If decryption
succeeds, the server considers this user trusted and grants this user access
rights. If decryption fails, the client is disconnected from the server.
– Password-based authentication is implemented by the Authentication,
Authorization and Accounting (AAA). Similar to Telnet and FTP, SSH
supports local database authentication and remote RADIUS server
authentication. The SSH server compares the user name and password of
an SSH client with the preset ones. Authentication succeeds if both
match.
5. Request a session.
After user authentication is complete, the client sends a session request to the
server. After receiving the request, the server processes it.
NOTE
Before an SSH connection is set up, the local key pair (RSA, DSA, or ECC key pair) must be
generated on the server. The key pair is used to generate the session key and session ID and
authenticate the server. This step is the key to SSH server configuration.
SCP Mode
Based on the SSH remote file copy function, SCP is used to copy, upload, and
download files. SCP commands are easy to use, improving network maintenance
efficiency.
FTPS Mode
FTPS combines FTP and Secure Sockets Layer (SSL). A client and server use SSL to
authenticate each other and encrypt data to be transmitted. SSL ensures secure
connections to FTP servers and greatly improves security of common FTP servers,
enabling files of the device to be managed securely.
● CA
CA is an entity that issues, manages, and abolishes digital certificates, and it
authenticates identities of digital certificate owners. Root CAs are widely
trusted in the world and authorize other lower-level CAs. CA identity
information is provided in the file of a trusted CA.
For example, CA1 is a root CA that issues a certificate to lower-level CA2, and
CA2 issues the certificate to lower-level CA3. The certificate used by the server
is issued by the lowest-level CA.
If the certificate of the server is issued by CA3, the certificate is authenticated
as follows: CA3 authenticates the certificate of the server. If the
authentication succeeds, CA2 authenticates the certificate of CA3. If the
authentication succeeds, the root CA authenticates the certificate of CA2.
Only when the root authentication succeeds, the certificate used by the server
is valid.
Figure 8-1 shows the certificate issuing process and certificate authentication
process.
● Digital certificate
NOTICE
Ensure that the power supply of the device is stable. Interruption of the power
supply during operations such as file downloading may cause file corruption or
damage to the file system. As a result, the storage medium on the device may be
damaged or the device cannot be properly started.
Pre-configuration Tasks
Before logging in to the device to manage files, complete the following tasks:
● Ensure that routes are reachable between the terminal and the device.
● Ensure that a user has logged in to the device using a terminal.
Configuration Procedure
After a user logs in to the device on a terminal, the user can perform operations
on storage media, directories, and files.
Procedure
● Perform operations on directories.
● The directory to be
deleted must be
empty.
Delete a directory. rmdir directory ● A deleted directory
and its files cannot be
restored from the
recycle bin.
copy { source-http-
urlname destination-
Download a file Only
filename | source-
from or upload a V200R013C00SPC500 or a
filename destination-
file to an HTTP later version supports this
http-urlname }
server. function.
[ username user-name
password password ]
copy { source-https-
urlname destination-
Download a file filename | source- Only
from or upload a filename destination- V200R013C00SPC500 or a
file to an HTTPS https-urlname } later version supports this
server. [ username user-name function.
password password ] ssl-
policy ssl-policy
To perform multiple
operations at one time,
run the execute batch-
Execute batch files. execute batch-filename filename command in the
system view. The batch
files must be stored in the
storage medium first.
NOTE
NOTICE
----End
Pre-configuration Tasks
Before connecting to the FTP server to manage files, complete the following tasks:
● Ensure that routes are reachable between the terminal and the device.
● Ensure that the terminal functions as the FTP client.
Configuration Procedure
NOTICE
The FTP protocol brings security risks. Therefore, the SFTPv2, SCP, or FTPS mode is
recommended.
Table 8-6 describes the procedure for managing files when the device functions as
an FTP server.
Table 8-6 Managing files when the device functions as an FTP server
Connect to the
Connect to the device
4 device using FTP on -
using FTP
the terminal.
Procedure
● Set FTP server parameters.
Enable the FTP ftp [ ipv6 ] server By default, the FTP server
server function. enable function is disabled.
NOTE
● If the FTP service is enabled, the port number of the FTP service cannot be
changed. To change the port number, run the undo ftp [ ipv6 ] server command
to disable the FTP service first.
● After operations on files are complete, run the undo ftp [ ipv6 ] server to disable
the FTP server function to ensure the device security.
Configure the
local-user user-name By default, a local user can
service type for
service-type ftp use any access type.
local users.
are used to classify packets. After these rules are applied to routing devices,
the routing devices determine the packets to be received and rejected.
Users can configure a basic ACL to allow only specified clients to connect to
the FTP server.
The ACL rules are as follows:
– When permit is used in the ACL rule, devices that match the ACL rule can
establish FTP connections with the local device.
– When deny is used in the ACL rule, devices that match the ACL rule
cannot establish FTP connections with the local device.
– When the ACL rule is configured but packets from devices do not match
the rule, other devices cannot establish FTP connections with the local
device.
– When the ACL contains no rule, any device can establish FTP connections
with the local device.
Return to the
quit -
system view.
Configure a basic
ACL for the FTP ftp [ ipv6 ] acl acl-number -
server.
After connecting to the FTP server, users can run FTP commands to perform
file-related operations including performing operations on directories and
files, configuring the file transfer mode, and viewing the online help about
FTP commands.
NOTE
Change the
working
cd remote-directory -
directory on the
server.
Change the -
current working
cdup
directory to its
parent directory.
Display the -
working
pwd
directory on the
server.
Delete a
directory from rmdir remote-directory -
the server.
Delete a file
delete remote-filename -
from the server.
Enable the
By default, the prompt
system prompt prompt
function is disabled.
function.
The current user can switch to another user in the FTP client view. The new
FTP connection is the same as that established by running the ftp command.
Users can run different commands in the FTP client view to disconnect the
FTP client from the FTP server.
----End
Pre-configuration Tasks
Before connecting to the SFTP server to manage files, complete the following
tasks:
● Ensure that routes are reachable between the terminal and the device.
● Ensure that the SSH client software has been installed on the terminal.
Configuration Procedure
NOTICE
You are advised to use SFTPv2 or FTPS because they provide increased security
over SFTPv1.
Table 8-12 describes the procedure for managing files when the device functions
as an SFTP server.
Table 8-12 Managing files when the device functions as an SFTP server
Time for updating the key pair of the 0, indicating the key pair of the server
server is never updated
Procedure
● Set SFTP server parameters.
(Optional)
Configure the
minimum key
length supported
ssh server dh- By default, the minimum key
during Diffie-
exchange min-len length supported is 1024
hellman-group-
min-len bytes.
exchange key
exchange between
the SSH server and
client.
(Optional) Specify
By default, DSA, ECC, RSA
the public key ssh server publickey
public key algorithms are
algorithm of the { dsa | ecc | rsa } *
enabled.
SSH server.
(Optional)
By default, the SSH
Configure the SSH ssh server timeout
authentication timeout
authentication seconds
duration is 60 seconds.
timeout duration.
(Optional)
Configure the ssh server By default, the number of
number of SSH authentication- SSH authentication retries is
authentication retries times 3.
retries.
By default, no ACL is
configured for the SSH
server.
(Optional) ssh [ ipv6 ] server
Configure an ACL. acl acl-number An ACL is configured to
determine which clients can
log in to the current device
through SSH.
– When the local RSA key pair is generated, two key pairs (a server key pair
and a host key pair) are generated at the same time. Each key pair
contains a public key and a private key. The length of the two key pairs is
2048 bits.
– When the local DSA key pair is generated, only the host key pair is
generated. The length of the host key pair can be 1024 or 2048 bits. The
default length is 2048 bits.
– When the local ECC key pair is generated, only the host key pair is
generated. The length of the host key pair can be 256, 384, or 521 bits.
The default length is 521 bits.
● Configure the VTY user interface for SSH users to log in to the device.
SSH users use the VTY user interface to log in to the device using SFTP.
Attributes of the VTY user interface must be configured.
Table 8-15 Configuring the VTY user interface for SSH users to log in to the
device
Operation Command Description
user-interface vty
Enter the VTY user
first-ui-number [ last- -
interface view.
ui-number ]
By default, no authentication
mode is configured for the
VTY user interface.
Set the
authentication The authentication mode of
authentication-mode the VTY user interface must
mode of the VTY
aaa be set to AAA. Otherwise,
user interface to
AAA. you cannot configure the
protocol inbound ssh
command and users cannot
log in to the device.
Configure the
The default SFTP service
authorized ssh user username sftp-
authorized directory is
directory for SSH directory directoryname
flash: for an SSH user.
users.
password-rsa authentication mode, create a local user with the same user
name in the AAA view.
– If the SSH user uses the password authentication mode, only the SSH
server needs to generate the RSA, DSA, or ECC key. If the SSH user uses
the RSA, DSA, or ECC authentication mode, both the SSH server and
client need to generate the RSA, DSA, or ECC key and configure the
public key of the peer end locally.
Perform any of the following configurations according to authentication
mode:
– To configure password authentication for the SSH user, see Table 8-17.
– To configure RSA, DSA, or ECC authentication for the SSH user, see Table
8-18.
– To configure password-rsa, password-dsa, or password-ecc authentication
for the SSH user, configure an AAA user and set the RSA, DSA, or ECC
public key. For details, see Table 8-17 and Table 8-18.
local-user user-name
Configure the local user
password irreversible- -
name and password.
cipher password
rsa peer-public-key
key-name [ encoding-
type { der | openssh |
pem } ]
,
dsa peer-public-key
Display the RSA, DSA, key-name encoding-
-
or ECC public key view. type { der | openssh |
pem }
, or
ecc peer-public-key
key-name encoding-
type { der | openssh |
pem }
User Authentication
Password:
sftp>
In the SFTP client view, you can perform one or more file-related operations
listed in Table 8-19.
You can perform the following operations in any sequence and select one or
more operation items as required.
NOTE
In the SFTP client view, the system does not support predictive command input.
Therefore, you must enter commands in their full syntax.
The file system limits the number of files in the root directory to 50. Creation of files
in excess of this limit in the root directory may fail.
A maximum of 10
directories can be
deleted at one time.
Before running the rmdir
Delete directories rmdir remote-directory command to delete
from the server. &<1-10> directories, ensure that
the directories do not
contain any files.
Otherwise, the deletion
fails.
Create a directory
mkdir remote-directory -
on the server.
Download a file
get remote-filename
from the remote -
[ local-filename ]
server.
A maximum of 10 files
Delete files from the remove remote-filename
can be deleted at one
server. &<1-10>
time.
You can also use the following commands to download files from the SFTP
server or upload files.
– IPv4 address: sftp client-transfile { get | put } [ -a source-address | -i
interface-type interface-number ] host-ip host-ipv4 [ port ] [ [ public-
net | -vpn-instance vpn-instance-name ]| prefer_kex prefer_key-
exchange | identity-key { rsa | dsa | ecc } | prefer_ctos_cipher
prefer_ctos_cipher | prefer_stoc_cipher prefer_stoc_cipher |
prefer_ctos_hmac prefer_ctos_hmac | prefer_stoc_hmac
prefer_stoc_hmac | -ki aliveinterval | -kc alivecountmax ] * username
user-name password password sourcefile source-file [ destination
destination ]
– IPv6 address: sftp client-transfile { get | put } ipv6 [ -a source-address ]
host-ip host-ipv6 [ -oi interface-type interface-number ] [ port ] [ -vpn-
instance vpn-instance-name | prefer_kex prefer_key-exchange | identity-
key { rsa | dsa | ecc } | prefer_ctos_cipher prefer_ctos_cipher |
prefer_stoc_cipher prefer_stoc_cipher | prefer_ctos_hmac
prefer_ctos_hmac | prefer_stoc_hmac prefer_stoc_hmac | -ki aliveinterval
| -kc alivecountmax ] * username user-name password password
sourcefile source-file [ destination destination ]
● Disconnect the SFTP client from the SSH server.
----End
● Run the display ssh server status command to view global configuration of
the SSH server.
● Run the display ssh server session command to view session information of
the SSH client on the SSH server.
Pre-configuration Tasks
Before connecting to the SCP server to manage files, complete the following tasks:
● Ensure that routes are reachable between the terminal and the device.
● Ensure that the SSH client software supporting SCP has been installed on the
terminal.
Configuration Procedure
Table 8-20 describes the procedure for managing files when the device functions
as an SCP server.
Table 8-20 Managing files when the device functions as an SCP server
Time for updating the key pair of the 0, indicating the key pair of the server
server is never updated
Procedure
● Set SCP server parameters.
(Optional)
Configure the
minimum key
By default, the minimum key
length supported
ssh server dh- length in Diffie-hellman-
during Diffie-
exchange min-len group-exchange between the
hellman-group-
min-len SSH server and client is 1024
exchange key
bytes.
exchange
between the SSH
server and client.
(Optional)
Specifies the By default, DSA, ECC, RSA
ssh server publickey
public key public key algorithms are
{ dsa | ecc | rsa } *
algorithm of the enabled.
SSH server.
(Optional)
Configure the By default, the SSH
ssh server timeout
SSH authentication timeout
seconds
authentication duration is 60 seconds.
timeout duration.
(Optional)
Configure the ssh server
By default, the number of SSH
number of SSH authentication-
authentication retries is 3.
authentication retries times
retries.
By default, no ACL is
configured for the SSH server.
(Optional) ssh [ ipv6 ] server acl An ACL is configured to
Configure an ACL. acl-number determine which clients can
log in to the current device
through SSH.
– When the local RSA key pair is generated, two key pairs (a server key pair
and a host key pair) are generated at the same time. Each key pair
contains a public key and a private key. The length of the two key pairs is
2048 bits.
– When the local DSA key pair is generated, only the host key pair is
generated. The length of the host key pair can be 1024 or 2048 bits. The
default length is 2048 bits.
– When the local ECC key pair is generated, only the host key pair is
generated. The length of the host key pair can be 256, 384, or 521 bits.
The default length is 521 bits.
● Configure the VTY user interface for SSH users to log in to the device.
SSH users use the VTY user interface to log in to the device using SCP.
Attributes of the VTY user interface must be configured.
Table 8-23 Configuring the VTY user interface for SSH users to log in to the
device
Operation Command Description
user-interface vty
Enter the VTY user
first-ui-number [ last- -
interface view.
ui-number ]
By default, no authentication
mode is configured for the
VTY user interface.
Set the
authentication The authentication mode of
authentication-mode the VTY user interface must
mode of the VTY
aaa be set to AAA. Otherwise,
user interface to
AAA. you cannot configure the
protocol inbound ssh
command and users cannot
log in to the device.
– If the SSH user uses the password authentication mode, only the SSH
server needs to generate the RSA, DSA, or ECC key. If the SSH user uses
the RSA, DSA, or ECC authentication mode, both the SSH server and
client need to generate the RSA, DSA, or ECC key and configure the
public key of the peer end locally.
Perform any of the following configurations according to authentication
mode:
– To configure password authentication for the SSH user, see Table 8-25.
– To configure RSA, DSA, or ECC authentication for the SSH user, see Table
8-26.
– To configure password-rsa, password-dsa, or password-ecc authentication
for the SSH user, configure an AAA user and set the RSA, DSA, or ECC
public key. For details, see Table 8-25 and Table 8-26.
local-user user-name
Configure the local user
password irreversible- -
name and password.
cipher password
rsa peer-public-key
key-name [ encoding-
type { der | openssh |
pem } ]
,
dsa peer-public-key
Display the RSA, DSA, key-name encoding-
-
or ECC public key view. type { der | openssh |
pem }
, or
ecc peer-public-key
key-name encoding-
type { der | openssh |
pem }
The SSH client software supporting SCP must be installed on the terminal to
ensure that the terminal can connect to the device using SCP. The following
describes how to connect to the device using OpenSSH and the Windows CLI.
– For details about how to install OpenSSH, see the OpenSSH installation
description.
– To use OpenSSH to connect to the device using SFTP, run the relevant
OpenSSH commands. For details about OpenSSH commands, see
OpenSSH help.
– Windows command prompt can identify commands supported by
OpenSSH only when OpenSSH is installed on the terminal.
Access the Windows CLI and run the commands supported by the OpenSSH
to connect to the device using SCP. (The following information is for
reference.)
C:\Documents and Settings\Administrator> scp [email protected]:flash:/vrpcfg.zip vrpcfg-backup.zip
The authenticity of host '10.136.23.5 (10.136.23.5)' can't be established.
DSA key fingerprint is 46:b2:8a:52:88:42:41:d4:af:8f:4a:41:d9:b8:4f:ee.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.136.23.5' (DSA) to the list of known hosts.
User Authentication
Password:
The user terminal uploads or downloads files while connecting to the SCP
server and accesses the user local directory.
NOTE
The file system limits the number of files in the root directory to 50. Creation of files
in excess of this limit in the root directory may fail.
----End
Pre-configuration Tasks
Before connecting to the FTPS server to manage files, complete the following
tasks:
● Ensure that routes are reachable between the terminal and the device.
● Ensure that the FTP client software supporting SSL has been installed on the
terminal.
Configuration Procedure
Table 8-27 describes the procedure for managing files when the device functions
as an FTPS server.
Table 8-27 Managing files when the device functions as an FTPS server
Task 1 must be
Upload the digital performed before
Upload the server
certificate and task 2. The other
1 digital certificate and
private key to the tasks can be
private key
device. performed in any
sequence.
Configure an SSL
Configure the SSL
policy and load the
2 policy and load the
digital certificate to
digital certificate
the server.
Connect to the
Connect to the device
5 device using FTPS on -
using FTPS
the terminal.
Procedure
● Upload the server digital certificate and private key.
Upload the server digital certificate and private key file to the security
directory on the device in SFTP or SCP mode. If no security directory exists on
the device, run the mkdir directory command to create one.
The server must obtain a digital certificate (including the private key file)
from a CA. Clients that connect to the server must obtain a digital certificate
from the CA to authenticate the validity of the server digital certificate.
NOTE
A certificate authority (CA) is an entity that issues and manages digital certificates.
Digital certificates used on the FTPS server must be issued by a CA.
Digital certificates support the PEM, ASN1, and PFX formats. Despite of the
formats, the certificates have the same content.
– A PEM digital certificate has a file name extension .pem and is applicable
to text transmission between systems.
– An ASN1 digital certificate has a file name extension .der and is the
default format for most browsers.
– A PFX digital certificate has a file name extension .pfx and is a binary
format that can be converted into the PEM or ASN1 format.
For details, see the description about uploading files in other modes.
● Configure the SSL policy and load the digital certificate.
Load the digital certificate and specify the private key.
Table 8-29 Configuring the SSL policy and loading the digital certificate
Operation Command Description
Create an SSL
policy and enter
ssl policy policy-name -
the SSL policy
view.
By default, no customized
cipher suite policy is bound
to an SSL policy. Each SSL
policy uses a default cipher
suite. After a customized
cipher suite policy is
unbound from an SSL
policy, the SSL policy uses
one of the following cipher
suites supported by default:
● tls1_ck_rsa_with_aes_256
_sha
● tls1_ck_rsa_with_aes_128
_sha
● tls1_ck_dhe_rsa_with_aes
(Optional) Bind a binding cipher-suite- _256_sha
customized SSL customization
● tls1_ck_dhe_dss_with_ae
cipher suite policy customization-policy-
s_256_sha
to an SSL policy. name
● tls1_ck_dhe_rsa_with_aes
_128_sha
● tls1_ck_dhe_dss_with_ae
s_128_sha
● tls12_ck_rsa_aes_256_cbc
_sha256
If the cipher suite in the
customized cipher suite
policy bound to an SSL
policy contains only one
type of algorithm (RSA or
DSS), the corresponding
certificate must be loaded
for the SSL policy to ensure
successful SSL negotiation.
● Configure the FTPS server function and set FTP service parameters.
FTPS is based on the FTP protocol. You can enable the FTPS server function
and set FTP service parameters.
Table 8-30 Configuring the FTPS server function and setting FTP service
parameters
Operation Command Description
(Optional) Set
the maximum By default, the maximum
ftp [ ipv6 ] server max-
number of number of sessions
sessions max-sessions-
sessions supported by the FTP server
number
supported by the is 5.
FTP server.
NOTE
● If the FTPS service is enabled, the port number of the FTPS service cannot be
changed. To change the port number, run the undo ftp [ ipv6 ] secure-server
command to disable the FTPS service first.
● After operations on files are complete, run the undo ftp [ ipv6 ] secure-server to
disable the FTPS server function to ensure the device security.
● Configure local FTP user information.
Before performing operations on files using FTPS, configure the local user
name and password, service type, and authorized directory on the FTPS server.
Configure the
local-user user-name By default, a local user can
service type for
service-type ftp use any access type.
local users.
NOTE
The file system limits the number of files in the root directory to 50. Creation of files
in excess of this limit in the root directory may fail.
----End
Configuration Procedure
NOTE
TFTP is insecure and will bring security risks. Using SFTPv2, SCP, or FTPS is recommended.
Table 8-32 describes the procedure for managing files when the device functions
as a TFTP client.
Table 8-32 Procedure for managing files when the device functions as a TFTP
client
No. Task Description Remarks
Procedure
● (Optional) Configure the TFTP client source address.
When specifying the source address in an ACL, use the address of a stable
interface, for example, a loopback interface. This simplifies the ACL rule and
security policy configuration. After the client source address is configured as
the source or destination address in the ACL rule, IP address differences and
interface status impact are shielded, and incoming and outgoing packets are
filtered.
By default, no ACL
rule is configured.
NOTE
The vpn-instance and
public parameter is
supported only when a
software-based ACL is
applied to the S5720I-
SI, S5735-S, S5735S-S,
rule [ rule-id ] { deny | S5735-S-I, S5735S-H,
permit } [ source { source- S5736-S, S5731-H,
S5731-S, S5731S-H,
address source-wildcard |
Configure the ACL S5731S-S, S5732-H,
any } | fragment | logging | S6720-EI, S6720S-EI,
rule.
time-range time-name | S6720S-S, S6730-H,
{ vpn-instance vpn-instance- S6730S-H, S6730-S, or
name | public } ] * S6730S-S. For usage
scenarios of software-
based ACLs, see "ACL
Implementations" in
the S300, S500, S2700,
S5700, and S6700
V200R020C10
Configuration Guide -
Security ACL
Configuration - ACL
Fundamentals.
Return to the
quit -
system view.
tftp [ -a source-ip-address | -i
interface-type interface-
number ] tftp-server [ public-
IPv4
net | vpn-instance vpn-
address
instance-name ] { get | put }
source-filename [ destination-
filename ] ● get: downloads a file.
● put: uploads a file.
tftp ipv6 [ -a source-ip-
address ] tftp-server-ipv6 [ -oi
IPv6 interface-type interface-
address number ] { get | put } source-
filename [ destination-
filename ]
NOTE
The file system limits the number of files in the root directory to 50. Creation of files
in excess of this limit in the root directory may fail.
The source address or interface specified in the tftp command has a higher
priority than that specified in the tftp client-source command. If you specify
different source addresses or interfaces in the tftp client-source and tftp
commands, the source address or interface specified in the tftp command
takes effect. The source address or interface specified in the tftp client-
source command applies to all TFTP connections. The source address or
interface specified in the tftp command applies only to the current TFTP
connection.
----End
Pre-configuration Tasks
Before connecting to a device as an FTP client to manage files, complete the
following tasks:
● Ensure that routes are reachable between the current device and the FTP
server.
● Obtain the host name or IP address of the FTP server, FTP user name, and
password.
● Obtain the listening port number of the FTP server if the default listening port
number is not used.
Configuration Procedure
NOTICE
The FTP protocol brings security risks. The SFTPv2, SCP, or FTPS mode is
recommended.
Table 8-35 describes the procedure for managing files when the device functions
as an FTP client.
Table 8-35 Procedure for managing files when the device functions as an FTP
client
No. Task Description Remarks
(Optional) Change
4 -
the login user
Procedure
● (Optional) Configure the FTP client source address.
When specifying the source address in an ACL, use the address of a stable
interface, for example, a loopback interface. This simplifies the ACL rule and
security policy configuration. After the client source address is configured as
the source or destination address in the ACL rule, IP address differences and
interface status impact are shielded, and incoming and outgoing packets are
filtered.
The FTP client source address must be set to the loopback interface IP address
or loopback interface.
Table 8-37 Running FTP commands to connect to the FTP server (with an
IPv4 address)
Operation Command Description
Connect to
ftp [ -a source-ip-address |
the FTP server
-i interface-type interface-
in the user
number ] host-ip [ port-
view when
number ] [ public-net |
the server
vpn-instance vpn-
uses an IPv4
instance-name ]
address. Select one of them.
ftp To enter the FTP client view,
Connect to run the ftp command.
the FTP server open [ -a source-ip-
in the FTP address | -i interface-type
client view interface-number ] host-ip
when the [ port-number ] [ public-
server uses an net | vpn-instance vpn-
IPv4 address. instance-name ]
NOTE
● Before connecting to the FTP server, run the set net-manager vpn-instance
command to set the default VPN instance. After this command is used, the FTP
operation uses the default VPN instance.
● The source address specified in the ftp command has a higher priority than that
specified in the ftp client-source command on an IPv4 network. If you specify
different source addresses in the ftp client-source and ftp commands, the source
address specified in the ftp command takes effect. The source address specified in
the ftp client-source command applies to all TFTP connections. The source
address specified in the ftp command applies only to the current TFTP connection.
Table 8-38 Running FTP commands to connect to the FTP server (with an
IPv6 address)
Operation Command Description
Connect to the
FTP server in the
ftp ipv6 host-ipv6 [ port-
user view when
number ]
the server uses
an IPv6 address. Select one of them.
To enter the FTP
Connect to the ftp client view, run the
FTP server in the ftp command.
FTP client view
when the server open ipv6 host-ipv6 [ port-
uses an IPv6 number ]
address.
Users must enter the correct user name and password to connect to the
server.
● Run FTP commands to perform file-related operations.
After connecting to the FTP server, users can run FTP commands to perform
file-related operations including performing operations on directories and
files, configuring the file transfer mode, and viewing the online help about
FTP commands.
NOTE
Change the
working
cd remote-directory -
directory on the
server.
Change the -
current working
cdup
directory to its
parent directory.
Display the -
working
pwd
directory on the
server.
Delete a
directory from rmdir remote-directory -
the server.
Delete a file
delete remote-filename -
from the server.
Enable the
By default, the prompt
system prompt prompt
function is disabled.
function.
The current user can switch to another user in the FTP client view. The new
FTP connection is the same as that established by running the ftp command.
Users can run different commands in the FTP client view to disconnect the
FTP client from the FTP server.
----End
Configuration Procedure
Table 8-40 describes the procedure for managing files when the device functions
as an SFTP client.
Table 8-40 Procedure for managing files when the device functions as an SFTP
client
No. Task Description Remarks
Procedure
● (Optional) Configure the SFTP client source address.
When specifying the source address in an ACL, use the address of a stable
interface, for example, a loopback interface. This simplifies the ACL rule and
security policy configuration. After the client source address is configured as
the source or destination address in the ACL rule, IP address differences and
interface status impact are shielded, and incoming and outgoing packets are
filtered.
The SFTP client source address must be set to the loopback interface IP
address or loopback interface.
Perform this step only if the device logs in to the SSH server in RSA, DSA, or ECC
authentication mode. This step is not required if the password authentication mode is
used.
Enter the
system-view -
system view.
Enter the
system-view -
system view.
Enable first
By default, first
authentication ssh client first-time
authentication is disabled on
for the SSH enable
the SSH client.
client.
Table 8-44 Configuring the SSH client to assign the RSA, DSA, or ECC public
key to the SSH server
Operation Command Description
Enter the
system-view -
system view.
Return to the
peer-public-key end -
system view.
Enter the
system system-view -
view.
Operatio
Command Description
n
Operatio
Command Description
n
Operatio
Command Description
n
(Optiona ssh client rekey time rekey- By default, the key re-
l) time negotiation interval is 60
Configur minutes.
e the
SSH
client key
re-
negotiati
on
trigger
interval.
Operatio
Command Description
n
sftp [ -a source-address | -i
interface-type interface-
number ] host-ip [ port ]
[ [ public-net | -vpn-instance
vpn-instance-name ] | identity-
key { dsa | rsa | ecc } | user-
Connect
identity-key { rsa | dsa | ecc } |
the SFTP
prefer_kex prefer_key-exchange
client to
| prefer_ctos_cipher
the SFTP
prefer_ctos_cipher |
server
prefer_stoc_cipher
based on
prefer_stoc_cipher |
IPv4.
prefer_ctos_hmac
prefer_ctos_hmac |
Run either of the commands
prefer_stoc_hmac
based on the IP address type.
prefer_stoc_hmac| -ki
aliveinterval ] | [ -kc In most cases, only the IP
alivecountmax] * address is specified in the
commands.
sftp ipv6 [ -a source-address ] NOTE
host-ipv6 [ -oi interface-type The aes128 or aes256
interface-number ] [ port ] algorithm is recommended to
[ identity-key { dsa | rsa | ecc } improve data transmission
security.
| user-identity-key { rsa | dsa |
ecc } | -vpn-instance vpn-
Connect
instance-name | prefer_kex
the SFTP
prefer_key-exchange |
client to
prefer_ctos_cipher
the SFTP
prefer_ctos_cipher |
server
prefer_stoc_cipher
based on
prefer_stoc_cipher |
IPv6.
prefer_ctos_hmac
prefer_ctos_hmac |
prefer_stoc_hmac
prefer_stoc_hmac | -ki
aliveinterval | -kc
alivecountmax ] *
Command example:
[HUAWEI] sftp 10.137.217.201
NOTE
In the SFTP client view, the system does not support predictive command input.
Therefore, you must enter commands in their full syntax.
The file system limits the number of files in the root directory to 50. Creation of files
in excess of this limit in the root directory may fail.
A maximum of 10
directories can be
deleted at one time.
Before running the rmdir
Delete directories rmdir remote-directory command to delete
from the server. &<1-10> directories, ensure that
the directories do not
contain any files.
Otherwise, the deletion
fails.
Create a directory
mkdir remote-directory -
on the server.
Download a file
get remote-filename
from the remote -
[ local-filename ]
server.
A maximum of 10 files
Delete files from the remove remote-filename
can be deleted at one
server. &<1-10>
time.
You can also use the following commands to download files from the SFTP
server or upload files.
– IPv4 address: sftp client-transfile { get | put } [ -a source-address | -i
interface-type interface-number ] host-ip host-ipv4 [ port ] [ [ public-
net | -vpn-instance vpn-instance-name ]| prefer_kex prefer_key-
exchange | identity-key { rsa | dsa | ecc } | prefer_ctos_cipher
prefer_ctos_cipher | prefer_stoc_cipher prefer_stoc_cipher |
prefer_ctos_hmac prefer_ctos_hmac | prefer_stoc_hmac
prefer_stoc_hmac | -ki aliveinterval | -kc alivecountmax ] * username
user-name password password sourcefile source-file [ destination
destination ]
– IPv6 address: sftp client-transfile { get | put } ipv6 [ -a source-address ]
host-ip host-ipv6 [ -oi interface-type interface-number ] [ port ] [ -vpn-
instance vpn-instance-name | prefer_kex prefer_key-exchange | identity-
key { rsa | dsa | ecc } | prefer_ctos_cipher prefer_ctos_cipher |
prefer_stoc_cipher prefer_stoc_cipher | prefer_ctos_hmac
prefer_ctos_hmac | prefer_stoc_hmac prefer_stoc_hmac | -ki aliveinterval
| -kc alivecountmax ] * username user-name password password
sourcefile source-file [ destination destination ]
● Disconnect the SFTP client from the SSH server.
Operation Command Description
----End
Configuration Procedure
Table 8-47 describes the procedure for managing files when the device functions
as an SCP client.
Table 8-47 Procedure for managing files when the device functions as an SCP
client
No. Task Description Remarks
Procedure
● (Optional) Configure the SCP client source address.
Perform this step only if the device logs in to the SSH server in RSA, DSA, or ECC
authentication mode. This step is not required if the password authentication mode is
used.
Enter the
system-view -
system view.
Enter the
system-view -
system view.
Enable first
By default, first
authentication ssh client first-time
authentication is disabled on
for the SSH enable
the SSH client.
client.
Table 8-51 Configuring the SSH client to assign the RSA, DSA, or ECC public
key to the SSH server
Operation Command Description
Enter the
system-view -
system view.
Return to the
peer-public-key end -
system view.
Enter
the
system-view -
system
view.
Operati
Command Description
on
By default, an SSH
client supports all key
exchange algorithms.
The system software
does not support the
dh_group_exchange_s
ha1, dh_group14_sha1,
and dh_group1_sha1
parameters. To use the
dh_group_exchange_s
ha1, dh_group14_sha1,
(Option
or dh_group1_sha1
al)
parameter, you need to
Configur
install the WEAKEA
e a key ssh client key-exchange
plug-in. For higher
exchang { dh_group14_sha256 |
security purposes, you
e dh_group15_sha512 |
are advised to use
algorith dh_group16_sha512 |
other parameters.
m list dh_group_exchange_sha256 }*
for the You can search for
SSH Plug-in Usage Guide
client. at the Huawei technical
support website
(Enterprise Network
or Carrier), and choose
the desired plug-in
usage guide based on
the switch model and
software version. If you
do not have permission
to access the website,
contact technical
support personnel.
Operati
Command Description
on
By default, an SSH
client supports all
encryption algorithms.
The system software
does not support the
aes256_cbc,
aes128_cbc, 3des_cbc,
and des_cbc
parameters. To use
these parameters, you
(Option need to install the
al) WEAKEA plug-in. For
Configur higher security
e an purposes, you are
encrypti advised to specify the
ssh client cipher { aes128_ctr |
on aes256_ctr or
aes256_ctr } *
algorith aes128_ctr parameter.
m list You can search for
for the Plug-in Usage Guide
SSH at the Huawei technical
client. support website
(Enterprise Network
or Carrier), and choose
the desired plug-in
usage guide based on
the switch model and
software version. If you
do not have permission
to access the website,
contact technical
support personnel.
Operati
Command Description
on
By default, the
WEAKEA plug-in is not
installed, an SSH server
supports only the
sha2_256 algorithm,
and the undo ssh
server hmac command
is unavailable. When
the WEAKEA plug-in is
installed, an SSH server
also supports the
sha2_256_96, sha1,
sha1_96, md5 and
md5_96 algorithms,
and the undo ssh
server hmac command
is available.
The system software
(Option
does not support the
al)
sha2_256_96, sha1,
Configur
sha1_96, md5, and
e an
md5_96 parameters. To
HMAC
ssh client hmac sha2_256 use the sha2_256_96,
algorith
sha1, sha1_96, md5, or
m list
md5_96 parameter, you
for the
need to install the
SSH
WEAKEA plug-in. For
client.
higher security
purposes, you are
advised to specify the
sha2_256 parameter.
You can search for
Plug-in Usage Guide
at the Huawei technical
support website
(Enterprise Network
or Carrier), and choose
the desired plug-in
usage guide based on
the switch model and
software version. If you
do not have permission
to access the website,
contact technical
support personnel.
Operati
Command Description
on
(Option ssh client rekey time rekey-time By default, the key re-
al) negotiation interval is
Configur 60 minutes.
e the
SSH
client
key re-
negotiat
ion
trigger
interval.
NOTE
The file system limits the number of files in the root directory to 50. Creation of files
in excess of this limit in the root directory may fail.
----End
Pre-configuration Tasks
Before connecting to a device as an FTPS client to manage files, complete the
following tasks:
● Ensure that routes are reachable between the current device and the FTPS
server.
● Load the digital certificate on the FTPS server.
● Obtain the host name or IP address of the FTPS server, FTPS user name, and
password.
Configuration Procedure
Table 8-53 describes the procedure for managing files when the device functions
as an FTPS client.
Table 8-53 Procedure for managing files when the device functions as an FTPS
client
Upload the CA
Upload required files
1 certificate and CRL
to the device.
file
(Optional) Change
5 -
the login user
Procedure
● Upload the CA certificate and CRL file.
Upload the CA certificate and CRL file to the security directory on the device
in FTP, SFTP, or SCP mode. If no security directory exists on the device, run
the mkdir security command to create one.
NOTE
● The FTPS client must obtain certificates from the CA to authenticate the digital
certificate of the server.
● The CRL is issued by the CA and contains serial numbers of certificates that are
revoked. If the digital certificate is listed in the CRL file, the client cannot
authenticate the server successfully and the FTPS connection fails.
Digital certificates support the PEM, ASN1, and PFX formats. Despite of the
formats, the certificates have the same content.
– A PEM digital certificate has a file name extension .pem and is applicable
to text transmission between systems.
– An ASN1 digital certificate has a file name extension .der and is the
default format for most browsers.
– A PFX digital certificate has a file name extension .pfx and is a binary
format that can be converted into the PEM or ASN1 format.
The CRL file supports the ASN1 and PEM formats. These two formats
represent the same contents.
For details, see the description about uploading files in other modes.
● Configure an SSL policy and load the CA certificate and CRL file.
Table 8-54 Configuring an SSL policy and loading the CA certificate and CRL
file
Operation Command Description
Enter the
system-view -
system view.
By default, no customized
cipher suite policy is bound
to an SSL policy. Each SSL
policy uses a default cipher
suite. After a customized
cipher suite policy is unbound
from an SSL policy, the SSL
policy uses one of the
following cipher suites
supported by default:
● tls1_ck_rsa_with_aes_256_
sha
● tls1_ck_rsa_with_aes_128_
sha
(Optional) ● tls1_ck_dhe_rsa_with_aes_
Bind a binding cipher-suite- 256_sha
customized customization
● tls1_ck_dhe_dss_with_aes_
SSL cipher customization-policy-
256_sha
suite policy to name
an SSL policy. ● tls1_ck_dhe_rsa_with_aes_
128_sha
● tls1_ck_dhe_dss_with_aes_
128_sha
● tls12_ck_rsa_aes_256_cbc_
sha256
If the cipher suite in the
customized cipher suite
policy bound to an SSL policy
contains only one type of
algorithm (RSA or DSS), the
corresponding certificate
must be loaded for the SSL
policy to ensure successful
SSL negotiation.
Load the CA
certificate in trusted-ca load pem-ca Load the CA certificate in the
the PEM ca-filename PEM, ASN1 or PFX format.
format. A maximum of four CA
certificates can be loaded in
Load the CA an SSL policy. The loaded CA
certificate in trusted-ca load asn1-ca certificates are added to the
the ASN1 ca-filename existing CA list.
format.
NOTE
Before rolling V200R008C00 or a
Load the CA
trusted-ca load pfx-ca later version back to an earlier
certificate in
ca-filename auth-code version, back up the SSL private
the PFX key file.
cipher auth-code
format.
NOTE
● If only one CA certificate exists on the FTPS server, configure all CA certificates in
the validation path up to and including the root CA certificate.
● If a certificate chain exists on the FTPS server, configure only the root CA certificate
on the client.
● If the CRL file is not loaded, the FTPS connection is not affected. However, the
client cannot authenticate the digital certificate of the server. You are advised to
load the CRL file and keep it up to date.
● Connect to the FTPS server.
When connecting to the FTPS server, run the ftp command to enter the FTP
client view and the open command to implement FTP connection.
Users must enter the correct user name and password to enter the FTP client
view and manage files on the server.
● Run FTP commands to perform file-related operations.
After connecting to the FTPS server, users can run FTP commands to perform
file-related operations on the FTPS server.
NOTE
Change the
working
cd remote-directory -
directory on the
server.
Change the -
current working
cdup
directory to its
parent directory.
Display the -
working
pwd
directory on the
server.
Delete a
directory from rmdir remote-directory -
the server.
Delete a file
delete remote-filename -
from the server.
Enable the
By default, the prompt
system prompt prompt
function is disabled.
function.
----End
Figure 8-2 Networking diagram for logging in to the switch for file operations
Procedure
Step 1 View files and subdirectories in the current directory.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] quit
<Switch> dir
Directory of flash:/
Step 2 Create the test directory, copy the vrpcfg.zip file to test, and rename vrpcfg.zip
as backup.zip.
# Create the test directory.
<Switch> mkdir test
NOTE
If no target file name is specified, the source file and target file have the same name.
----End
Configuration File
Switch configuration file
#
sysname Switch
#
return
Figure 8-3 Networking diagram for managing files when the device functions as
an FTP server
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure the FTP function and FTP user information including user name,
password, user privilege level, service type, and authorized directory on the
FTP server.
2. Save the vrpcfg.zip file on the FTP server.
3. Connect to the FTP server from the PC.
4. Upload devicesoft.cc to and download vrpcfg.zip from the FTP server.
Procedure
Step 1 Configure the FTP function and FTP user information on the FTP server.
<HUAWEI> system-view
[HUAWEI] sysname FTP_Server
[FTP_Server] ftp server-source -i MEth 0/0/1
//If the device does not have an Ethernet management port, the source interface is the interface with the
management IP address. If the source address of the server is configured as a non-management IP address
or the interface with a non-management IP address, a client can connect to the server only using the
configured source address.
[FTP_Server] ftp server enable
[FTP_Server] aaa
[FTP_Server-aaa] local-user admin1234 password irreversible-cipher Helloworld@6789
[FTP_Server-aaa] local-user admin1234 privilege level 15
[FTP_Server-aaa] local-user admin1234 service-type ftp
[FTP_Server-aaa] local-user admin1234 ftp-directory flash:/
[FTP_Server-aaa] quit
[FTP_Server] quit
Step 3 Connect to the FTP server from the PC as user admin1234 whose password is
Helloworld@6789 and transfer files in binary mode.
Step 4 Upload the system software to the device and back up the configuration file of
the device to the PC.
# Upload the system software to the device.
ftp> put devicesoft.cc
200 Port command okay.
150 Opening BINARY mode data connection for devicesoft.cc
226 Transfer complete.
ftp: 23876556 bytes sent in 25.35Seconds 560.79Kbytes/sec.
NOTE
The devicesoft.cc file to be uploaded and the vrpcfg.zip file to be downloaded are stored
in the local directory on the FTP client. Before uploading and downloading files, obtain the
local directory on the client. The default FTP user's local directory on the Windows XP
operating system is C:\Documents and Settings\Administrator.
# Access the FTP user's local directory on the PC and check the vrpcfg.zip file.
----End
Configuration File
FTP_Server configuration file
#
sysname FTP_Server
#
FTP server enable
FTP server-source -i MEth 0/0/1
#
aaa
local-user admin1234 password irreversible-cipher $1a$P2m&M5d"'JHR7b~SrcHF\Z\,2R"t&6V|zOLh9y$>M
\bjG$D>%@Ug/<3I$+=Y$
local-user admin1234 privilege level 15
local-user admin1234 ftp-directory flash:/
local-user admin1234 service-type ftp
#
return
Related Content
Videos
Networking Requirements
As shown in Figure 8-4, routes between the PC and the device functioning as an
SSH server are reachable. 10.136.23.4 is the management Ethernet interface's IP
address on the SSH server. Configure the device as an SSH server so that it can
authenticate the client (PC) and encrypt data in bidirectional mode. This prevents
man-in-middle attacks and DNS/IP spoofing attacks and ensures secure file
transfer.
Figure 8-4 Networking diagram for managing files using SFTP when the device
functions as an SSH server
Configuration Roadmap
The configuration roadmap is as follows:
1. Generate a local key pair and enable the SFTP server function on the SSH
server so that the server and client can securely exchange data.
2. Configure the VTY user interface on the SSH server.
3. Configure SSH user information including the authentication mode, service
type, authorized directory, user name, and password.
4. Connect to the SSH server using the third-party software OpenSSH on the PC.
Procedure
Step 1 Generate a local key pair on the SSH server, and enable the SFTP server.
<HUAWEI> system-view
[HUAWEI] sysname SSH_Server
[SSH_Server] dsa local-key-pair create
Info: The key name will be: SSH_Server_Host_DSA.
Info: The key modulus can be any one of the following : 1024,
2048.
Info: If the key modulus is greater than 512, it may take a few
minutes.
Please input the modulus [default=2048]:
Info: Generating keys...
Info: Succeeded in creating the DSA host keys.
[SSH_Server] ssh server-source -i MEth 0/0/1
//If the device does not have an Ethernet management port, the source interface is the interface with the
management IP address. If the source address of the server is configured as a non-management IP address
or the interface with a non-management IP address, a client can connect to the server only using the
configured source address.
[SSH_Server] sftp server enable
Step 3 Configure SSH user information including the authentication mode, service type,
authorized directory, user name, and password.
[SSH_Server] ssh user client001 authentication-type password
[SSH_Server] ssh user client001 service-type sftp
[SSH_Server] ssh user client001 sftp-directory flash:
[SSH_Server] aaa
[SSH_Server-aaa] local-user client001 password irreversible-cipher Helloworld@6789
[SSH_Server-aaa] local-user client001 privilege level 15
[SSH_Server-aaa] local-user client001 service-type ssh
[SSH_Server-aaa] quit
Step 4 Connect to the SSH server using the third-party software OpenSSH on the PC.
The Windows CLI can identify OpenSSH commands only when OpenSSH is
installed on the PC.
NOTE
Use a version of OpenSSH that is compatible with the operating system running on the
terminal. An incorrect version may prevent communication with the switch through SFTP.
After you connect to the SSH server through third-party software, the SFTP view is
displayed. You can then perform file-related operations in the SFTP view.
----End
Configuration File
SSH_Server configuration file
#
sysname SSH_Server
#
aaa
local-user client001 password irreversible-cipher $1a$P2m&M5d"'JHR7b~SrcHF\Z\,2R"t&6V|zOLh9y$>M\bjG
$D>%@Ug/<3I$+=Y$
local-user client001 privilege level 15
local-user client001 service-type ssh
#
sftp server enable
ssh user client001
ssh user client001 authentication-type password
ssh user client001 service-type sftp
ssh user client001 sftp-directory flash:
ssh server-source -i MEth 0/0/1
#
user-interface vty 0 14
authentication-mode aaa
#
return
Networking Requirements
As shown in Figure 8-6, routes between the PC and the device functioning as an
FTPS server are reachable. 10.137.217.201 is the management Ethernet interface
IP address on the FTPS server.
The FTP server function does not provide security mechanisms. Because data is
transmitted in plain text, the network is susceptible to man-in-the-middle attacks
and MAC/IP address spoofing. To address this issue and ensure secure file transfer,
configure the SSL policy, data encryption, user identity authentication, and
message integrity check mechanisms on the FTPS server. SSL ensures secure
connection based on the FTP server function.
Figure 8-6 Networking diagram for managing files when the device functions as
an FTPS server
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure the FTP server function on the device and upload the digital
certificate to the root directory on the device.
2. On the device, copy the digital certificate to the security directory, configure
the SSL policy, and load the digital certificate so that the client can
authenticate the server.
3. Enable the FTPS server function and configure the local FTP user.
4. Connect to the FTPS server using third-party software.
Procedure
Step 1 Configure the FTP server function on the server and upload the digital certificate
to the server.
# Enable the FTP server function and configure FTP user information.
<HUAWEI> system-view
[HUAWEI] sysname FTPS_Server
[FTPS_Server] ftp server-source -i MEth 0/0/1
//If the device does not have an Ethernet management port, the source interface is the interface with the
management IP address. If the source address of the server is configured as a non-management IP address
or the interface with a non-management IP address, a client can connect to the server only using the
configured source address.
[FTPS_Server] ftp server enable
[FTPS_Server] aaa
[FTPS_Server-aaa] local-user admin password irreversible-cipher huawei@6789
[FTPS_Server-aaa] local-user admin service-type ftp
[FTPS_Server-aaa] local-user admin privilege level 3
[FTPS_Server-aaa] local-user admin ftp-directory flash:
[FTPS_Server-aaa] quit
[FTPS_Server] quit
# Open the Windows CLI and run the ftp command to connect to the FTP server.
Enter the correct user name and password to connect to the FTP server. Upload
the digital certificate and private key to the FTP server.
Run the dir command on the FTP server to check that the digital certificate and
private key are uploaded successfully.
<FTPS_Server> dir
Directory of flash:/
Run the dir command in the security directory to check that the digital certificate
and private key have been moved successfully.
<FTPS_Server> cd security/
<FTPS_Server> dir
Directory of flash:/security/
# Create an SSL policy and load a digital certificate in the ASN1 format.
<FTPS_Server> system-view
[FTPS_Server] ssl policy ftp_server
[FTPS_Server-ssl-policy-ftp_server] certificate load asn1-cert 4_servercert_der_dsa.der key-pair dsa key-
file 4_serverkey_der_dsa.der
[FTPS_Server-ssl-policy-ftp_server] quit
Step 3 Enable the FTPS server function and configure the local FTP user.
# Enable the FTPS server function.
NOTE
Disable the FTP server function before enabling the FTPS server function.
[FTPS_Server] undo ftp server
[FTPS_Server] ftp secure-server ssl-policy ftp_server
[FTPS_Server] ftp secure-server enable
# Run the display ftp-server command on the FTPS server to view the SSL policy
name and the FTPS server status. The command output indicates that the FTPS
server status is running.
[FTPS_Server] display ftp-server
FTP server is stopped
Max user number 5
User count 1
Timeout value(in minute) 30
Listening port 21
Acl number 0
FTP server's source address 0.0.0.0
FTP SSL policy ftp_server
FTP Secure-server is running
# The FTP server supporting SSL can securely connect to the FTPS server, upload
files, and download files.
----End
Configuration File
FTPS_Server configuration file
#
sysname FTPS_Server
#
FTP secure-server enable
FTP server-source -i MEth 0/0/1
ftp secure-server ssl-policy ftp_server
#
aaa
local-user admin password irreversible-cipher $1a$P2m&M5d"'JHR7b~SrcHF\Z\,2R"t&6V|zOLh9y$>M\bjG
$D>%@Ug/<3I$+=Y$
local-user admin privilege level 3
local-user admin ftp-directory flash:
local-user admin service-type ftp
#
ssl policy ftp_server
certificate load asn1-cert 4_servercert_der_dsa.der key-pair dsa key-file 4_serverkey_der_dsa.der
#
return
Networking Requirements
As shown in Figure 8-7, the remote device at 10.1.1.1/24 functions as the TFTP
server. The device at 10.2.1.1/24 functions as the TFTP client. Routes between the
device and the server are reachable.
The device needs to be upgraded. To upgrade the device, you must download
system software devicesoft.cc from and upload the configuration file vrpcfg.zip
to the TFTP server.
Figure 8-7 Networking diagram for managing files when the device functions as a
TFTP client
Configuration Roadmap
The configuration roadmap is as follows:
1. Run the TFTP software on the TFTP server and configure the working
directory.
2. Run TFTP commands to download devicesoft.cc from and upload vrpcfg.zip
to the TFTP server.
Procedure
Step 1 Run the TFTP software on the TFTP server and configure the working directory.
(For details, see related third-party documentation.)
Step 2 Run TFTP commands to download devicesoft.cc from and upload vrpcfg.zip to
the TFTP server.
<HUAWEI> tftp 10.1.1.1 get devicesoft.cc
Info: Transfer file in binary mode.
Downloading the file from the remote TFTP server. Please wait...\
TFTP: Downloading the file successfully.
23876556 bytes received in 199 seconds.
<HUAWEI> tftp 10.1.1.1 put vrpcfg.zip
Info: Transfer file in binary mode.
Uploading the file to the remote TFTP server. Please wait...|
TFTP: Uploading the file successfully.
7717 bytes send in 1 second.
# Access the working directory on the TFTP server and check that the vrpcfg.zip
file has been uploaded successfully.
----End
Configuration File
None
Networking Requirements
As shown in Figure 8-8, the remote device at 10.1.1.1/24 functions as the FTP
server. The device at 10.2.1.1/24 functions as the FTP client. Routes between the
device and the server are reachable.
The device needs to be upgraded. To upgrade the device, you must download
system software devicesoft.cc from and upload the configuration file vrpcfg.zip
to the FTP server.
Figure 8-8 Networking diagram for managing files when the device functions as
an FTP client
Configuration Roadmap
The configuration roadmap is as follows:
1. Run the FTP software on the FTP server and configure FTP user information.
2. Connect to the FTP server.
3. Run FTP commands to download devicesoft.cc from and upload vrpcfg.zip to
the FTP server.
Procedure
Step 1 Run the FTP software on the FTP server and configure FTP user information. (For
details, see related third-party documentation.)
Step 2 Connect to the FTP server.
<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
[ftp]
Step 3 Run FTP commands to download devicesoft.cc from and upload vrpcfg.zip to the
FTP server.
[ftp] binary
[ftp] get devicesoft.cc
[ftp] put vrpcfg.zip
[ftp] quit
# Access the working directory on the FTP server and check that the vrpcfg.zip
file has been successfully uploaded.
----End
Configuration File
None
Networking Requirements
SSH provides a mechanism to authenticate the client and encrypts data
bidirectionally, ensuring secure file transfer on insecure networks. The client uses
SFTP to securely connect to the SSH server and transfer files.
As shown in Figure 8-9, routes between the SSH server and clients client001 and
client002 are reachable. In this example, a Huawei device functions as the SSH
server.
Client001 and client002 connect to the SSH server using the password
authentication mode and the DSA authentication mode, respectively.
Figure 8-9 Networking diagram for managing files when the device functions as
an SFTP client
Configuration Roadmap
The configuration roadmap is as follows:
1. Generate a local key pair and enable the SFTP server function on the SSH
server so that the server and client can securely exchange data.
2. Create users client001 and client002 and set their authentication modes on
the SSH server.
3. Generate a local key pair on client002 and configure the DSA public key of
client002 on the SSH server so that the server can authenticate the client
when the client connects to the server.
4. Log in to the SSH server as users client001 and client002 using SFTP and
manage files.
Procedure
Step 1 Generate a local key pair and enable the SFTP server function on the SSH server.
<HUAWEI> system-view
[HUAWEI] sysname SSH Server
[SSH Server] dsa local-key-pair create
Info: The key name will be: SSH Server_Host_DSA.
Info: The key modulus can be any one of the following : 1024,
2048.
Info: If the key modulus is greater than 512, it may take a few
minutes.
Please input the modulus [default=2048]:
Info: Generating keys...
Info: Succeeded in creating the DSA host keys.
[SSH_Server] ssh server-source -i Vlanif 10 //Assume that the interface corresponding to the server IP
address 10.1.1.1 is VLANIF 10.
[SSH Server] sftp server enable
# Create an SSH user named client001 user and set the authentication mode to
password for the user.
[SSH Server] ssh user client001
[SSH Server] ssh user client001 authentication-type password
[SSH Server] ssh user client001 service-type sftp
[SSH Server] ssh user client001 sftp-directory flash:
[SSH Server] aaa
[SSH Server-aaa] local-user client001 password irreversible-cipher Helloworld@6789
[SSH Server-aaa] local-user client001 service-type ssh
[SSH Server-aaa] local-user client001 privilege level 3
[SSH Server-aaa] quit
# Create an SSH user named client002 and set the authentication mode to DSA
for the user.
[SSH Server] ssh user client002
[SSH Server] ssh user client002 authentication-type dsa
[SSH Server] ssh user client002 service-type sftp
[SSH Server] ssh user client002 sftp-directory flash:
Step 3 Generate a local key pair on client002 and configure the DSA public key of
client002 on the SSH server.
# Generate a local key pair on client002.
<HUAWEI> system-view
[HUAWEI] sysname client002
[client002] dsa local-key-pair create
Info: The key name will be: SSH Server_Host_DSA.
Info: The key modulus can be any one of the following : 1024,
2048.
Info: If the key modulus is greater than 512, it may take a few
minutes.
Please input the modulus [default=2048]:
Info: Generating keys...
Info: Succeeded in creating the DSA host keys.
=====================================================
Time of Key pair created: 2014-03-03 19:11:04+00:00
Key name: client002_Host
Key type: DSA encryption Key
=====================================================
Key code:
30820109 02820100 C7D92E27 E88745D4 933AB1F5 DA692AC4 1D544BDC 8EA252B0 E90A5001
1F2567C6 3952DEFD 95EF93C2 D77E8CDF B36E7F43 57C1D7BA 0978DD7A 2F7F7187 04FD6A03
C4FFDB58 04B3A0C4 B6E50528 AAE56FF9 5F66EE00 8E4702DB AA764006 322E6F72 CC9C1A39
462DBCD0 EA934441 1678BA23 40473EC4 58DF84FA 20C9CB60 98E5ACDA 2E98B55A 0299FBAB
FE91EFA3 E155E065 7C7FFCD4 4EAB71EC A7A73DD7 AC8474B7 2DD37D1C 710C6E14 57DA200C
477E45BC 38AC7685 BD8D6325 CCBE3F32 85435E5B EB6A08DF 752B7EBD CE21CFCB F3AC0C35
671E5ACC AFC36F0B 54E646F6 D12B4BA3 6E9EF69F A5BED377 954709EB CE29A923 04B347D7
29296E7D 3D5F69AB 4365AA2F 0203 010001
AAAAB3NzaC1yc2EAAAADAQABAAABAQDH2S4n6IdF1JM6sfXaaSrEHVRL3I6iUrDpClABHyVnxjlS3v2V75PC13
6M37Nuf0NXwde6CXjdei9/cYcE/WoDxP/bWASz
oMS25QUoquVv+V9m7gCORwLbqnZABjIub3LMnBo5Ri280OqTREEWeLojQEc
+xFjfhPogyctgmOWs2i6YtVoCmfur/pHvo+FV4GV8f/zUTqtx7KenPdeshHS3LdN9HHEMbhRX
2iAMR35FvDisdoW9jWMlzL4/MoVDXlvragjfdSt+vc4hz8vzrAw1Zx5azK/DbwtU5kb20StLo26e9p
+lvtN3lUcJ684pqSMEs0fXKSlufT1faatDZaov= dsa-key
# Configure the DSA public key of client002 on the SSH server. (Information in
bold in the display command output is the DSA public key of client002. Copy the
information to the server.)
[SSH Server] dsa peer-public-key dsakey001 encoding-type der
[SSH Server-dsa-public-key] public-key-code begin
[SSH Server-dsa-key-code] 30820109
[SSH Server-dsa-key-code] 02820100
[SSH Server-dsa-key-code] C7D92E27 E88745D4 933AB1F5 DA692AC4 1D544BDC
[SSH Server-dsa-key-code] 8EA252B0 E90A5001 1F2567C6 3952DEFD 95EF93C2
[SSH Server-dsa-key-code] D77E8CDF B36E7F43 57C1D7BA 0978DD7A 2F7F7187
[SSH Server-dsa-key-code] 04FD6A03 C4FFDB58 04B3A0C4 B6E50528 AAE56FF9
[SSH Server-dsa-key-code] 5F66EE00 8E4702DB AA764006 322E6F72 CC9C1A39
[SSH Server-dsa-key-code] 462DBCD0 EA934441 1678BA23 40473EC4 58DF84FA
[SSH Server-dsa-key-code] 20C9CB60 98E5ACDA 2E98B55A 0299FBAB FE91EFA3
[SSH Server-dsa-key-code] E155E065 7C7FFCD4 4EAB71EC A7A73DD7 AC8474B7
[SSH Server-dsa-key-code] 2DD37D1C 710C6E14 57DA200C 477E45BC 38AC7685
[SSH Server-dsa-key-code] BD8D6325 CCBE3F32 85435E5B EB6A08DF 752B7EBD
[SSH Server-dsa-key-code] CE21CFCB F3AC0C35 671E5ACC AFC36F0B 54E646F6
[SSH Server-dsa-key-code] D12B4BA3 6E9EF69F A5BED377 954709EB CE29A923
[SSH Server-dsa-key-code] 04B347D7 29296E7D 3D5F69AB 4365AA2F
[SSH Server-dsa-key-code] 0203
[SSH Server-dsa-key-code] 010001
[SSH Server-dsa-key-code] public-key-code end
[SSH Server-dsa-public-key] peer-public-key end
Please select public key type for user authentication [R for RSA; D for DSA; Enter for Skip publickey
authentication; Ctrl_C for Cancel], Please select [R, D, Enter or
Ctrl_C]:D
sftp-client>
Please select public key type for user authentication [R for RSA; D for DSA; Enter for Skip publickey
authentication; Ctrl_C for Cancel], Please select [R, D, Enter or
Ctrl_C]:D
sftp-client>
----End
Configuration File
● SSH server configuration file
#
sysname SSH Server
#
dsa peer-public-key dsakey001 encoding-type der
public-key-code begin
30820109
02820100
C7D92E27 E88745D4 933AB1F5 DA692AC4 1D544BDC 8EA252B0 E90A5001 1F2567C6
3952DEFD 95EF93C2 D77E8CDF B36E7F43 57C1D7BA 0978DD7A 2F7F7187 04FD6A03
C4FFDB58 04B3A0C4 B6E50528 AAE56FF9 5F66EE00 8E4702DB AA764006 322E6F72
CC9C1A39 462DBCD0 EA934441 1678BA23 40473EC4 58DF84FA 20C9CB60 98E5ACDA
2E98B55A 0299FBAB FE91EFA3 E155E065 7C7FFCD4 4EAB71EC A7A73DD7 AC8474B7
2DD37D1C 710C6E14 57DA200C 477E45BC 38AC7685 BD8D6325 CCBE3F32 85435E5B
Figure 8-10 Networking diagram for managing files when the device functions as
an SCP client
Configuration Roadmap
The configuration roadmap is as follows:
Procedure
Step 1 Generate a local key pair on the SSH server.
<HUAWEI> system-view
[HUAWEI] sysname SSH_Server
[SSH_Server] dsa local-key-pair create
Info: The key name will be: SSH_Server_Host_DSA.
Info: The key modulus can be any one of the following : 1024, 2048.
Info: If the key modulus is greater than 512, it may take a few minutes.
Please input the modulus [default=2048]:
Info: Generating keys...
Info: Succeeded in creating the DSA host keys.
# Create an SSH user client001 and set the authentication mode to password
and service type to all.
[SSH_Server] ssh user client001
[SSH_Server] ssh user client001 authentication-type password
[SSH_Server] ssh user client001 service-type all
[SSH_Server] ssh server-source -i Vlanif 10 //Assume that the interface corresponding to the server IP
address 10.1.1.1 is VLANIF 10.
[SSH_Server] scp server enable
# Download the backup.cfg file from the remote SSH server at 10.1.1.1 using
AES-256 encryption to the local user's directory.
[SCP_Client] scp -cipher aes256 [email protected]:backup.cfg backup.cfg
Trying 10.1.1.1 ...
Press CTRL+K to abort
Connected to 10.1.1.1 ...
The server has not been authenticated. Continue to access it? [Y/N]:y
Do you want to save the server's public key? [Y/N]:y
The server's public key will be saved with the name 10.1.1.1. Please wait.
..
Enter password:
backup.cfg 100% 19174Bytes 7KByte(s)/sec
----End
Configuration File
● SSH_Server configuration file
#
sysname SSH_Server
#
aaa
local-user client001 password irreversible-cipher $1a$P2m&M5d"'JHR7b~SrcHF\Z\,2R"t&6V|zOLh9y
$>M\bjG$D>%@Ug/<3I$+=Y$
local-user client001 privilege level 3
local-user client001 service-type ssh
#
scp server enable
ssh user client001
ssh user client001 authentication-type password
ssh user client001 service-type all
ssh server-source -i Vlanif 10
#
user-interface vty 0 14
authentication-mode aaa
#
return
● SCP_Client configuration file
#
sysname SCP_Client
#
ssh client first-time enable
#
return
and MAC/IP address spoofing. To address this issue and ensure secure file transfer,
configure the SSL policy, data encryption, user identity authentication, and
message integrity check mechanisms on the FTPS server. SSL ensures secure
connection based on the FTP server function.
As shown in Figure 8-11, routes between the FTPS server and the device
functioning as the FTPS client are reachable. The FTPS client can securely connect
to the FTPS server to remotely manage files.
● On the FTPS client, configure the SSL policy and load the CA certificate to
check the owner's identity.
● On the FTPS server, configure the SSL policy, load the digital certificate to
check the owner's identity, and enable the FTPS server function.
Obtain required certificates for the FTPS client and server from the CA. In this
example, Huawei device functions as the FTPS server.
Figure 8-11 Networking diagram for managing files when the device functions as
an FTPS client
Configuration Roadmap
The configuration roadmap is as follows:
Procedure
Step 1 Upload the certificates.
● Configure the FTP function on the client and server and upload the
certificates to the client and server. For details, see 8.3.2 Managing Files
When the Device Functions as an FTP Server.
# Run the dir command on the FTPS server to check that the digital
certificate and private key have been uploaded successfully.
<HUAWEI> system-view
[HUAWEI] sysname FTPS_Server
[FTPS_Server] quit
<FTPS_Server> dir
Directory of flash:/
# Run the dir command on the client to check that the CA certificate has
been uploaded successfully.
<HUAWEI> system-view
[HUAWEI] sysname FTPS_Client
[FTPS_Client] quit
<FTPS_Client> dir
Directory of flash:/
# Run the dir command in the security directory to check that the digital
certificate and private key have been moved successfully.
<FTPS_Server> cd security/
<FTPS_Server> dir
Directory of flash:/security/
# Configure the SSL policy and load the digital certificate in the ASN1 format.
<FTPS_Server> system-view
[FTPS_Server] ssl policy ftp_server
[FTPS_Server-ssl-policy-ftp_server] certificate load asn1-cert 4_servercert_der_dsa.der key-pair dsa
key-file 4_serverkey_der_dsa.der
[FTPS_Server-ssl-policy-ftp_server] quit
# Run the display ssl policy command on the FTPS server to view
information about the SSL policy.
[FTPS_Server] display ssl policy
# Run the dir command in the security directory to check that the CA
certificate has been moved successfully.
<FTPS_Client> cd security/
<FTPS_Client> dir
Directory of flash:/security/
# Run the display ssl policy command on the FTPS client to view information
about the SSL policy.
[FTPS_Client] display ssl policy
Step 3 Enable the FTPS server function and configure the local FTP user.
NOTE
Disable the FTP server function before enabling the FTPS server function.
[FTPS_Server] undo ftp server
[FTPS_Server] ftp secure-server ssl-policy ftp_server
[FTPS_Server] ftp secure-server enable
[FTPS_Server] ftp server-source -i Vlanif 10 //Assume that the interface corresponding to the server IP
address 10.1.1.1 is VLANIF 10.
Alternatively, you can use the same user who uploaded the certificates in Step 1 or
create a user.
Step 4 On the FTPS client, run FTP commands to connect to the FTPS server and
remotely manage files.
[FTPS_Client] ftp ssl-policy ftp_client 10.1.1.1
Trying 10.1.1.1 ...
Press CTRL+K to abort
Connected to 10.1.1.1.
220 FTP service ready.
234 AUTH command successfully, Security mechanism accepted.
200 PBSZ is ok.
200 Data channel security level is changed to private.
User(10.1.1.1:(none)):admin
331 Password required for admin.
Enter password:
230 User logged in.
[ftp]
To connect to the FTPS server, enter the correct user name and password.
Step 5 Verify the configuration.
# Run the display ftp-server command on the FTPS server to view the SSL policy
name and the FTPS server status.
[FTPS_Server] display ftp-server
FTP server is stopped
Max user number 5
User count 1
Timeout value(in minute) 30
Listening port 21
Acl number 0
FTP server's source address 0.0.0.0
FTP SSL policy ftp_server
FTP Secure-server is running
----End
Configuration File
● FTPS_Server configuration file
#
sysname FTPS_Server
#
FTP secure-server enable
FTP server-source -i Vlanif10
ftp secure-server ssl-policy ftp_server
#
aaa
local-user admin password irreversible-cipher $1a$P2m&M5d"'JHR7b~SrcHF\Z\,2R"t&6V|zOLh9y$>M
\bjG$D>%@Ug/<3I$+=Y$
local-user admin privilege level 3
local-user admin ftp-directory flash:
local-user admin service-type ftp
#
ssl policy ftp_server
certificate load asn1-cert 4_servercert_der_dsa.der key-pair dsa key-file 4_serverkey_der_dsa.der
#
return
Procedure
Step 1 Check whether the source address of the FTP server is configured on the device.
● FTP IPv4:
Run the display this command in the system view to check whether the ftp
server-source command is configured. If not, run the ftp server-source
command in the system view to configure an IPv4 source address for the FTP
server.
● FTP IPv6:
Run the display this command in the system view to check whether the ftp
ipv6 server-source command is configured. If not, run the ftp ipv6 server-
source command in the system view to configure an IPv6 source address for
the FTP server.
Step 2 Check whether the FTP server is running properly.
Run the display ftp-server command in any view to check the FTP server status.
● The following information indicates that the FTP server is not running:
<HUAWEI> display ftp-server
Info: The FTP server is already disabled.
Run the ftp server enable command in the system view to start the FTP
server.
<HUAWEI> system-view
[HUAWEI] ftp server enable
Info: Succeeded in starting the FTP server.
● The following information indicates that the FTP server is running properly:
<HUAWEI> display ftp-server
FTP server is running
Max user number 5
User count 0
Timeout value(in minute) 30
Listening port 21
Acl number 0
FTP server's source address 0.0.0.0
FTP SSL policy
FTP Secure-server is stopped
Step 3 Check whether the listening port number of the FTP server is the default port
number 21.
1. Run the display tcp status command in any view to check the current TCP
port listening status.
<HUAWEI> display tcp status
TCPCB Tid/Soid Local Add:port Foreign Add:port VPNID State
2a67f47c 6 /1 0.0.0.0:21 0.0.0.0:0 23553 Listening
2b72e6b8 115/4 0.0.0.0:22 0.0.0.0:0 23553 Listening
3265e270 115/1 0.0.0.0:23 0.0.0.0:0 23553 Listening
2a6886ec 115/23 10.137.129.27:23 10.138.77.43:4053 0 Establish
ed
2a680aac 115/14 10.137.129.27:23 10.138.80.193:1525 0 Establish
ed
2a68799c 115/20 10.137.129.27:23 10.138.80.202:3589 0 Establish
ed
2. Run the display ftp-server command in any view to check the listening port
number of the FTP server.
<HUAWEI> display ftp-server
FTP server is running
Max user number 5
User count 0
Timeout value(in minute) 30
Listening port 21
Acl number 0
FTP server's source address 0.0.0.0
FTP SSL policy
FTP Secure-server is stopped
If the listening port number is not 21, run the ftp server port command to set the
listening port number to 21.
<HUAWEI> system-view
[HUAWEI] undo ftp server
Warning: The operation will stop the FTP server. Continue? [Y/N]:y
Info: Succeeded in closing the FTP server.
[HUAWEI] ftp server port 21
[HUAWEI] ftp server enable
Info: Succeeded in starting the FTP server.
Alternatively, enter the port number configured on the server when setting up an
FTP connection on the FTP client.
Step 4 Check whether the authentication information, authorized directory, and user
privilege level of the FTP user are correctly configured.
The FTP user name, password, authorized directory, and user privilege level must
be configured. If the FTP authorized directory and user privilege level are not
configured, login fails.
1. Run the aaa command to enter the AAA view.
2. Run the local-user user-name password irreversible-cipher password
command to configure the local FTP user name and password.
3. Run the local-user user-name ftp-directory directory command to specify an
FTP authorized directory for the FTP user.
4. Run the local-user user-name privilege level level command to set the FTP
user privilege level. The user privilege level must be set to 3 or higher to
ensure successful connection establishment.
The service type is optional. By default, the system supports all service types. If
you set the service-type parameter, only the service types that you set are
available to the FTP user.
Run the local-user user-name service-type ftp command to set the service types
for the FTP user.
Step 5 Check whether the number of online FTP users who have logged in to the FTP
server reaches the upper threshold.
Run the display ftp-users command to check the number of online FTP users.
Step 6 Check the ACL rule on the FTP server.
Run the display [ ipv6 ] ftp-server command to check the ACL rule on the FTP
server.
If an ACL is configured on the FTP server, only IP addresses specified in the ACL
can log in to the FTP server.
Step 7 Check whether multiple authentication modes are configured on the FTP server.
1. Run the aaa command to enter the AAA view.
2. Run the display this command to check whether multiple authentication
modes are configured. For details, see AAA Configuration.
----End
● The server root directory does not have sufficient storage space.
● The MTU on the server or client is modified. The size of data frames sent by
the server or client exceeds the maximum value of the peer device or a device
on the transmission path. As a result, the data frames are discarded.
Procedure
Step 1 Check whether the source or destination directory contains characters not
supported by the device, such as spaces.
The directory name cannot contain spaces and the following special characters: ~
* / \ : ' ".
If the directory contains any of these characters, modify the directory.
Step 2 Check whether the storage space of the server root directory is sufficient.
Run the dir command on the server to check the available space of the server root
directory.
If the storage space is insufficient, run the delete /unreserved command in the
user view to delete outdated files.
Step 3 Check whether the MTU on the server or client interface exceeds the maximum
value supported by the device.
Run the display this command in the interface view on the server or client to
check the MTU value. If no value is displayed, the default value 1500 is used.
If the MTU exceeds the maximum value of the server or client, run the mtu
command in the interface view to set the MTU to a smaller value. For details on
the largest frame size supported by a device, see What Is the MTU of an
Interface and What Is the Largest Frame Size Allowed on an Interface? in
Interface Management in the FAQs.
----End
NOTICE
● After you run the fixdisk device-name command, all the files and directories in
the specified storage device will be deleted. Exercise caution when determining
whether to run these commands because the files and directories cannot be
restored after being deleted.
● The fixdisk device-name command cannot rectify device-level faults.
● FTP is easy to
FTP can be used configure.
when security FTP transmits data in
requirements are ● This mode plain text, resulting
FTP provides
low; for example, in potential security
during version authorization and risks.
upgrades. authentication
functions.
● SCP performs
high-security
encryption and
integrity checks
for data.
● This mode
features high
SCP can be used efficiency because
when security and the same SCP is complex to
SCP performance command is used configure (similar to
requirements are to set up a SFTP).
high. connection
between the
client and server
and complete the
file upload/
download
operation
simultaneously.
NOTE
● The console port uses XModem as the transmission protocol. Select the correct
transmission protocol when you transfer files.
● When TFTP is used, the device can function as the client only. When FTP, SFTP, SCP, or
FTPS is used, the device can function as the client or server.
● When uploading system files to a device, ensure that the power supply of the device is
normal. Interruption of the power supply may result in file or file system corruption, and
may prevent the device from working properly.
● The device cannot automatically download files from a server at a specified time using
the console port, FTP, SFTP, SCP, TFTP, or FTPS.
<HUAWEI>dir //Display all the files and folders in the flash memory.
Directory of flash:/
NOTE
● The actual output information may differ from the preceding information.
● The all parameter is supported only in a stack. When this parameter is specified,
the command deletes all the files in the corresponding directories on all member
devices in a batch.
● Do not delete running version files (including system software, patch files, web
page files, and configuration files) in the CLI. To delete such files, use the
BootROM menu. After a version file is deleted, the device cannot restart using the
version file. Exercise caution when you delete a version file.
● Log files are stored in the logfile or syslogfile directory of the flash memory.
You can access the logfile or syslogfile directory and then delete log files, or
directly delete log files from the absolute path of the flash memory.
# Access the logfile directory and then delete log files.
<HUAWEI> cd logfile/
<HUAWEI> delete logfile-2013-01-24-09-15-03.zip
Delete flash:/logfile/logfile-2013-01-24-09-15-03.zip?[Y/N]:y
Info: Deleting file flash:/logfile/logfile-2013-01-24-09-15-03.zip...succeeded.
# Delete log files from the absolute path of the flash memory.
<HUAWEI> delete flash:/logfile/logfile-2013-01-24-09-15-03.zip
Delete flash:/logfile/logfile-2013-01-24-09-15-03.zip?[Y/N]:y
Info: Deleting file flash:/logfile/logfile-2013-01-24-09-15-03.zip...succeeded.