No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

AR500, AR510, and AR530 V200R007 Commands Reference

This document describes all the configuration commands of the device, including the command function, syntax, parameters, views, default level, usage guidelines, examples, and related commands.
Rate and give feedback :
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
File Management Commands

File Management Commands

ascii

Function

The ascii command sets the file transfer mode to ASCII on an FTP client.

The default file transfer mode is ASCII.

Format

ascii

Parameters

None

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

Files can be transferred in ASCII or binary mode.

ASCII mode is used to transfer plain text files, and binary mode is used to transfer application files, such as system software , images, video files, compressed files, and database files.

Example

# Set the file transfer mode to ASCII.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] ascii
200 Type is ASCII 
Related Topics

binary

Function

The binary command sets the file transmission mode to binary on an FTP client.

The default file transfer mode is ASCII.

Format

binary

Parameters

None

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

Files can be transferred in ASCII or binary mode.

ASCII mode is used to transfer plain text files, and binary mode is used to transfer application files, such as system software , images, video files, compressed files, and database files.

Example

# Set the file transmission mode to binary.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] binary
200 Type is Image (Binary) 
Related Topics

bye

Function

The bye command terminates the connection with the remote FTP server and enters the user view.

Format

bye

Parameters

None

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

This command is equivalent to the quit command.

You can use the close and disconnect commands to terminate the connection with the remote FTP server and retain the FTP client view.

Example

# Terminate the connection with the remote FTP server and enter the user view.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] bye
221 Windows FTP Server (WFTPD, by Texas Imperial Software) says goodbye.
<Huawei>
Related Topics

cd (FTP client view)

Function

The cd command changes the working directory of the FTP server.

Format

cd remote-directory

Parameters

Parameter Description Value
remote-directory Specifies the name of a working directory on the FTP server. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

The FTP server authorizes users to access files in certain directories and their subdirectories.

Example

# Change the working directory to d:/temp.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] cd d:/temp
250 "D:/temp" is current directory.

cd (SFTP client view)

Function

The cd command changes the working directory of the SFTP server.

Format

cd [ remote-directory ]

Parameters

Parameter Description Value
remote-directory Specifies the name of a directory on the SFTP server. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

SFTP client view

Default Level

3: Management level

Usage Guidelines

  • The SFTP server authorizes users to access files in certain directories and their subdirectories.

  • The specified working directory must exist on the SFTP server. If the remote-directory parameter is not included in the cd command, only the current working directory of an SSH user is displayed as the command output.

Example

# Change the current working directory of the SFTP server to /bill.

<Huawei> system-view
[Huawei] sftp 10.137.217.201
Please input the username:admin
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201 ...
Enter password:
sftp-client> cd bill
Current directory is:
/bill  

cd (user view)

Function

The cd command changes the current working directory of a user.

By default, the current working directory is flash:.

Format

cd directory

Parameters

Parameter Description Value
directory Specifies the current working directory of a user.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] path format.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

For example, a directory name is flash:/selftest/test/.

Views

User view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

The following describes the drive name.
  • drive is the storage device and is named as flash:.

The path can be an absolute path or relative path.
  • flash:/my/test/ is an absolute path.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

Precautions
  • The directory specified in the cd command must exist; otherwise, the error messages will be displayed.

    You can perform the following operations to rectify faults:
    1. Run the pwd command to view the current working directory.
    2. Run the dir command to view the current working directory and verify that the directory specified in the cd command exists.

Example

# Change the current working directory from flash:/temp to flash:.

<Huawei> pwd
flash:/temp
<Huawei> cd flash:
<Huawei> pwd
flash:

# Change the current working directory from flash: to flash:/t1/t2.

<Huawei> pwd
flash:
<Huawei> cd flash:/t1/t2
<Huawei> pwd
flash:/t1/t2

# Change the current working directory from flash:/selftest to flash:/logfile.

<Huawei> pwd
flash:/selftest
<Huawei> cd /logfile/
<Huawei> pwd
flash:/logfile

# Change the current working directory from flash:/selftest to flash:/selftest/test.

<Huawei> pwd
flash:/selftest
<Huawei> cd test/
<Huawei> pwd
flash:/selftest/test
Related Topics

cdup (SFTP client view)

Function

The cdup command changes the current working directory of an SSH user to its parent directory.

Format

cdup

Parameters

None

Views

SFTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

You can run the cdup command to change the current working directory to its parent directory.

Precautions

If the current working directory is the SFTP authorization directory, the command cannot change the current working directory.

Example

# Change the current working directory to its parent directory.

<Huawei> system-view
[Huawei] sftp 10.137.217.201
Please input the username:admin
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201 ...
Enter password:
sftp-client> cd dhcp
Current directory is:
/dhcp 
sftp-client> cdup
Current directory is:
/
sftp-client> cdup
Error: Failed to change the current directory.
sftp-client>

cdup (FTP client view)

Function

The cdup command enables you to return to the upper-level directory.

Format

cdup

Parameters

None

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

To exit from the current directory and return to the upper-level directory, run the cdup command.

Precautions

The directories accessible to an FTP user are restricted by the authorized directories configured for the user.

Example

# Exit from the current directory and return to the upper-level directory.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] cd security
250 CWD command successful.
[Huawei-ftp] cdup
250 "C:/" is current directory .

close

Function

The close command terminates the connection with the remote FTP server and retains the FTP client view.

Format

close

Parameters

None

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

This command is equivalent to the disconnect command.

You can run the bye and quit commands to terminate the connection with the remote FTP server and enter the user view.

Precautions

To enter the user view from the FTP client view, you can run the bye or quit command.

Example

# Terminate the connection with the remote FTP server and enter the FTP client view.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] close
221 Windows FTP Server (WFTPD, by Texas Imperial Software) says goodbye.


[Huawei-ftp]
Related Topics

copy

Function

The copy command copies a file.

Format

copy source-filename destination-filename

Parameters

Parameter

Description

Settings

source-filename

Specifies the path and the name of a source file.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

destination-filename

Specifies the path and the name of a destination file.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The following describes the drive name.

  • drive is the storage device and is named as flash:.

The path can be an absolute path or relative path.
  • flash:/my/test/ is an absolute path.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

Precautions
  • If the destination file name is not specified, the designation file and the source file have the same name. If the source file and the destination file are in the same directory, you must specify the destination file name. If the destination file name is not specified, you cannot copy the source file.

  • If the destination file name is the same as that of an existing file, the system prompts you whether to overwrite the existing file. The system prompt is displayed only when file prompt is set to alert.

  • When you use a USB drive, do not remove it during data transmission.

Example

# Copy the file config.cfg from the root directory of the flash card to flash:/temp. The destination file name is temp.cfg.

<Huawei> copy flash:/config.cfg flash:/temp/temp.cfg
Info: Copy flash:/config.cfg to flash:/temp/temp.cfg?(y/n)[n]:y
100%  complete
Info: Copied file flash:/config.cfg to flash:/temp/temp.cfg...Done

# If the current directory is the root directory of the flash card, you can perform the preceding configuration using the relative path.

<Huawei> pwd
flash:
<Huawei> dir
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 
   0   -rw-      6,721,804  Mar 19 2012 12:31:58   devicesoft.cc
   1   -rw-            910  Mar 19 2012 12:32:58   config.cfg
   2   drw-              -  Mar 05 2012 09:54:34   temp
...
468,560 KB total (197,728 KB free)
<Huawei> copy config.cfg temp/temp.cfg
Info: Copy flash:/config.cfg to flash:/temp/temp.cfg?(y/n)[n]:y
100%  complete
Info: Copied file flash:/config.cfg to flash:/temp/temp.cfg...Done

# Copy the file config.cfg from the root directory of the flash card to flash:/temp. The destination file name is config.cfg.

<Huawei> pwd
flash:
<Huawei> dir
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 
   0   -rw-      6,721,804  Mar 19 2012 12:31:58   devicesoft.cc
   1   -rw-            910  Mar 19 2012 12:32:58   config.cfg
   2   drw-              -  Mar 05 2012 09:54:34   temp
...
468,560 KB total (197,728 KB free)
<Huawei> copy config.cfg temp
Info: Copy flash:/config.cfg to flash:/temp/config.cfg?(y/n)[n]:y
100%  complete
Info: Copied file flash:/config.cfg to flash:/temp/config.cfg...Done

# Copy the file backup.zip to backup1.zip in the test directory from the current working directory flash:/test/.

<Huawei> pwd
flash:/test
<Huawei> copy backup.zip backup1.zip
Info: Copy flash:/test/backup.zip to flash:/test/backup1.zip?(y/n)[n]:y
100%  complete
Info: Copied file flash:/test/backup.zip to flash:/test/backup1.zip...Done 
Related Topics

delete (FTP client view)

Function

The delete command deletes a file from the FTP server.

Format

delete remote-filename

Parameters

Parameter Description Value
remote-filename Specifies the name of a file to be deleted. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

A file deleted in the FTP client view cannot be restored.

Example

# Delete the file temp.c.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] delete temp.c
Warning: The contents of file temp.c cannot be recycled. Continue? (y/n)[n]:y   
250 File deleted from remote host.      

delete (user view)

Function

The delete command deletes a specified file in the storage device.

Format

delete [ /unreserved ] [ /force ] { filename | devicename }

Parameters

Parameter Description Value
/unreserved

Deletes a specified file. The deleted file cannot be restored.

-
/force

Deletes a file directly without any confirmation.

-
filename

Specifies the name of a file to be deleted.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

devicename

Deletes all the files in the storage device.

-

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The following describes the drive name.

  • drive is the storage device and is named as flash:.

The path can be an absolute path or relative path.
  • flash:/my/test/ is an absolute path.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

Like devicename, drive specifies the storage device name.

Precautions

  • The wildcard (*) character can be used in the delete command.
  • If the parameter /unreserved is not included, the file is stored in the recycle bin. To display all files including deleted files that are displayed in square brackets ([ ]), run the dir /all command. To restore these files that are displayed in square brackets ([ ]), run the undelete command. To clear these files from the recycle bin, run the reset recycle-bin command.

    If you delete a file using the /unreserved parameter, the file cannot be restored.

  • If you delete a specified storage device, all files are deleted from the root directory of the storage device.

  • If you delete two files with the same name from different directories, the last file deleted is kept in the recycle bin.

  • If you attempt to delete a protected file, such as a configuration file, or patch filer, a system prompt is displayed.

  • You cannot delete a directory by running the delete command. To delete a directory, run the rmdir (user view) command.

Example

# Delete the file test.txt from the flash:/test/ directory.

<Huawei> delete flash:/test/test.txt
Info: Delete flash:/test/test.txt?(y/n)[n]:y

# Delete the file test.txt from the current working directory flash:/selftest.

<Huawei> delete test.txt
Info: Delete flash:/selftest/test.txt?(y/n)[n]::y

dir (user view)

Function

The dir command displays information about files and directories in the storage medium.

Format

dir [ /all ] [ filename | directory ]

Parameters

Parameter

Description

Value

/all

Displays information about all files and directories in the current directory, including files and directories moved to the recycle bin from the current directory.

NOTE:

If this parameter is specified on AR510 series routers, the system displays the file named lost+found. This file is a system file and cannot be deleted.

-

filename

Specifies the file name.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

directory

Specifies the file directory.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] path format.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The wildcard character (*) can be used in this command. If no parameter is specified, this command displays information about files and directories in the current directory.

The following describes the drive name:

  • drive is the storage device and is named as flash:.

The path can be an absolute path or relative path.
  • flash:/my/test/ is an absolute path.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

You can run the dir /all command to view information about all files and directories of the storage medium, including those moved to the recycle bin. The name of a file in the recycle bin is placed in square brackets ([]), for example, [test.txt].

Precautions

The device can display information about a maximum of 2,000 files and directories.

Example

# Display information about all files and directories in the current directory.

<Huawei> dir /all
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName
    0  -rw-            889  Feb 25 2012 10:00:58   private-data.txt
    1  -rw-          6,311  Feb 17 2012 14:05:04   backup.cfg
    2  -rw-            836  Jan 01 2012 18:06:20   rr.dat
    3  drw-              -  Jan 01 2012 18:08:20   syslogfile
    4  -rw-            836  Jan 01 2012 18:06:20   rr.bak
    5  drw-              -  Feb 27 2012 00:00:54   security
    6  -rw-        523,240  Mar 16 2011 11:21:36   bootrom_53hib66.bin
    7  -rw-          2,290  Feb 25 2012 16:46:06   vrpcfg.cfg
    8  -rw-            812  Dec 12 2011 15:43:10   hostkey
    9  drw-              -  Jan 01 2012 18:05:48   compatible
   10  -rw-     25,841,428  Nov 17 2011 09:48:10   basicsoft.cc
   11  -rw-            540  Dec 12 2011 15:43:12   serverkey
   12  -rw-     26,101,692  Dec 21 2011 11:44:52   devicesoft.cc
   13  -rw-          6,292  Feb 14 2012 11:14:32   1.cfg
   14  -rw-          6,311  Feb 17 2012 10:22:56   1234.cfg
   15  -rw-          6,311  Feb 25 2012 17:22:30   [11.cfg]

1,927,220 KB total (1,130,464 KB free)
                                

# Display information about the file vrpcfg.cfg in the current directory.

<Huawei> dir vrpcfg.cfg
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName
    0  -rw-          2,290  Feb 25 2012 16:46:06   vrpcfg.cfg

1,927,220 KB total (1,130,464 KB free)

# Display information about all .txt files in the current directory.

<Huawei> dir *.txt
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName
    0  -rw-            889  Feb 25 2012 10:00:58   private-data.txt

1,927,220 KB total (1,130,464 KB free)
Table 2-37  Description of the dir command output

Item

Description

d

Directory. If this item is not displayed, the corresponding FileName field displays a file. For example, devicesoft.cc is a file and security is a directory.

r

The file or directory is readable.

w

The file or directory is writable.

[ ]

A file moved to the recycle bin.

FileName

  • private-data.txt: The file saves service initialization data. Initialization data of some tasks is irrelevant to the configuration and is not recorded in the configuration file. The private-data.txt file records initialization data of these tasks, for example, the number of times the device restarts.
  • vrpcfg.cfg: configuration file. The file name extension of the configuration file must be .cfg or .zip.
  • basicsoft.cc: system software. The file name extension of the system software must be .cc.

Some software sub-systems store necessary data in other files in the file system when the device is running properly.

dir/ls (FTP client view)

Function

The dir and ls commands display all files or specified files that are stored on the FTP server, and save them to a local disk.

Format

dir [ remote-filename [ local-filename ] ]

ls [ remote-filename [ local-filename ] ]

Parameters

Parameter Description Value
remote-filename Specifies the name and directory of a file stored on the FTP server. The value is a string of 1 to 64 case-insensitive characters without spaces.
local-filename Specifies the name of the local file that saves the FTP server file information. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The following describes differences between the dir and ls commands.

  • When you run the dir command, detailed file information is displayed, including the file size, date when the file was created, whether the file is a directory, and whether the file can be modified. When you run the ls command, only the file name is displayed.
  • The dir command is used to save detailed file information, while the ls command is used to save only the file name even if the file is specified and saved in a local directory.

Precautions

The wildcard (*) character can be used in commands dir and ls.

Example

# Display the name or detailed information about a file that is saved in the test directory.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] cd test 
250 CWD command successfully.

[Huawei-ftp] dir
200 Port command okay.
150 Opening ASCII mode data connection for *.
drwxrwxrwx   1 noone    nogroup         0 Mar 24 10:48 .
drwxrwxrwx   1 noone    nogroup         0 Mar 26 15:52 ..
drwxrwxrwx   1 noone    nogroup         0 Mar 23 16:04 yourtest
-rwxrwxrwx   1 noone    nogroup      5736 Mar 24 10:38 backup.txt
-rwxrwxrwx   1 noone    nogroup      5736 Mar 24 10:38 backup1.txt 
226 Transfer complete.
[Huawei-ftp] ls
200 Port command okay.
150 Opening ASCII mode data connection for *.
.
..
yourtest
backup.txt
backup1.txt
226 Transfer complete.

# Display the detailed information for the file temp.c, and save the displayed information in file temp1.

[Huawei-ftp] dir temp.c temp1
200 Port command okay.
150 Opening ASCII mode data connection for temp.c.

226 Transfer complete.

[Huawei-ftp] quit

221 Server closing.
<Huawei> more temp1
-rwxrwxrwx  1  noone   nogroup  3929  Apr 27 18:13  temp.c

# Display the name of file test.bat, and save the displayed information in file test.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] ls test.bat test
200 Port command okay.
150 Opening ASCII mode data connection for test.bat.

226 Transfer complete.

[Huawei-ftp] quit

221 Server closing.
<Huawei> more test
test.bat
Table 2-38  Description of the dir/Is command output

Item

Description

d

Indicates a directory. If this parameter is not present, the command output indicates a file.

r

Indicates that the file or directory can be read.

w

Indicates that the file or directory can be modified.

dir/ls (SFTP client view)

Function

The dir and ls commands display a list of specified files that are stored on the SFTP server.

Format

dir [ -l | -a ] [ remote-directory ]

ls [ -l | -a ] [ remote-directory ]

Parameters

Parameter Description Value
-l Displays detailed information about all files and directories in a specified directory. -
-a Displays names of all files and directories in a specified directory. -
remote-directory Specifies the name of a directory on the SFTP server. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

SFTP client view

Default Level

3: Management level

Usage Guidelines

The dir and ls commands are equivalent.
  • If -l and -a parameters are not specified, detailed information about all files and directories in a specified directory is displayed when you run the dir or ls command. The effect is the same as the dir -l command output.
  • By default, if the remote-directory parameter is not specified, the list of current directory files is displayed when you run the dir or ls command.

Example

# Display a list of files in the test directory of the SFTP server.

<Huawei> system-view
[Huawei] sftp 10.137.217.201
Please input the username:admin
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201 ...
Enter password:
sftp-client> dir test
drwxrwxrwx   1 noone    nogroup         0 Mar 24 18:48 .
drwxrwxrwx   1 noone    nogroup         0 Mar 29 14:52 ..
-rwxrwxrwx   1 noone    nogroup         0 Mar 24 00:04 yourtest
-rwxrwxrwx   1 noone    nogroup      5736 Mar 24 18:38 backup.txt
-rwxrwxrwx   1 noone    nogroup      5736 Mar 24 18:38 backup1.txt
sftp-client> dir -a test
.
..
yourtest
backup.txt
backup1.txt
sftp-client> ls test
drwxrwxrwx   1 noone    nogroup         0 Mar 24 18:48 .
drwxrwxrwx   1 noone    nogroup         0 Mar 29 14:52 ..
-rwxrwxrwx   1 noone    nogroup         0 Mar 24 00:04 yourtest
-rwxrwxrwx   1 noone    nogroup      5736 Mar 24 18:38 backup.txt
-rwxrwxrwx   1 noone    nogroup      5736 Mar 24 18:38 backup1.txt
sftp-client> ls -a test
.
..
yourtest
backup.txt
backup1.txt

disconnect

Function

The disconnect command terminates the connection with the remote FTP server and displays the FTP client view.

Format

disconnect

Parameters

None

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

This command is equivalent to the close command.

You can run the bye and quit commands to terminate the connection with the remote FTP server and enter the user view.

To enter the user view from the FTP client view, you can run the bye or quit command.

Example

# Terminate the connection with the remote FTP server and enter the FTP client view.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] disconnect

221 Windows FTP Server (WFTPD, by Texas Imperial Software) says goodbye.

[Huawei-ftp]
Related Topics

display ftp-client

Function

The display ftp-client command displays the source IP address configured for the FTP client.

Format

display ftp-client

Parameters

None

Views

All views

Default Level

3: Management level

Usage Guidelines

The default source IP address 0.0.0.0 is used if ftp client-source is not configured.

Example

# Display the source IP address of the FTP client.

<Huawei> display ftp-client
Info: The source IP address of FTP client is 10.1.1.1.
Table 2-39  Description of the display ftp-client command output

Item

Description

Info: The source IP address of FTP client is 10.1.1.1.

10.1.1.1 is the source IP address of the FTP client.

You can run the ftp client-source command to configure the source IP address.

If a source IP address has been configured by using the ftp client-source command, the message "The source interface of the FTP client is LoopBack0" is displayed.

Related Topics

display ftp-server

Function

The display ftp-server command displays FTP server parameter settings.

Format

display [ ipv6 ] ftp-server

Parameters

Parameter Description Value
ipv6 Specifies the IPv6 FTP server. -

Views

All views

Default Level

3: Management level

Usage Guidelines

You can run this command to display FTP server parameter settings.

Example

# Display FTP server parameter settings.

<Huawei> display ftp-server
   FTP server is running
   Max user number                 5
   User count                      1
   Timeout value(in minute)        30
   Listening port                  21
   Acl number                      2010
   FTP server's source address     10.1.1.1
Table 2-40  Description of the display ftp-server command output

Item

Description

FTP server is running

The FTP server starts.

You can run the ftp [ ipv6 ] server enable command to start the FTP server.

Max user number

Maximum number of users who can access the FTP server.

User count

Number of users who are accessing the FTP server.

Timeout value(in minute)

Idle timeout duration of FTP users.

You can run the ftp [ ipv6 ] timeout command to set the idle timeout duration of FTP users.

Listening port

Number of the listening port on the FTP server. The default value is 21.

If the value is not 21, you can run the ftp [ ipv6 ] server port command to configure the listening port number.

Acl number

Number of the ACL of the FTP server.

The default value is 0. You can run the ftp [ ipv6 ] acl command to change the ACL number.

FTP server's source address

Source IP address for the FTP server to send packets. The default value is 0.0.0.0.

You can run the ftp server-source command to configure the source IP address for the FTP server. Here, the source IP address 10.1.1.1 is displayed. If a source interface is configured, this field displays "FTP server's source interface LoopBack0."

NOTE:
If you run the display ipv6 ftp-server command, the FTP server's source interface LoopBack0 is not displayed.

display ftp-users

Function

The display ftp-users command displays FTP user parameters on the FTP server.

Format

display ftp-users

Parameters

None

Views

All views

Default Level

3: Management level

Usage Guidelines

You can check FTP user parameters on the FTP server, such as the FTP user name, IP address of the client host, port number, idle duration, and the authorized directories.

Example

# Display FTP user parameters.

<Huawei> display ftp-users
  username  host                                           port  idle  topdir
  user      10.138.77.41                                   4028  0     flash:/test
  huawei    10.137.217.159                                 51156 0     flash: 

The preceding information indicates that two users are connected to the FTP server.

Table 2-41  Description of the display ftp-users command output

Item

Description

username

FTP user name.

host

IP address of the client host.

port

Port number of the client host.

idle

Idle duration.

topdir

Authorized directory of a user.

You can run the local-user ftp-directory command to configure the authorized directory.

display sftp-client

Function

The display sftp-client command displays the source IP address configured for the SFTP client.

Format

display sftp-client

Parameters

None

Views

All views

Default Level

3: Management level

Usage Guidelines

You can run the display sftp client command to display the source IP address of the SFTP client. The default source IP address 0.0.0.0 is used if sftp client-source is not configured.

Example

# Display the source IP address configured for the SFTP client.

<Huawei> display sftp-client
Info: The source address of SFTP client is 10.1.1.1
Table 2-42  Description of the display sftp-client command output

Item

Description

Info: The source address of SFTP client is 10.1.1.1

10.1.1.1 is the source IP address of the SFTP client.

You can run the sftp client-source command to configure the source IP address for the SFTP client.

If an IP address has been configured for the source port, the message "The source interface of the SFTP client is LoopBack0" is displayed.

display tftp-client

Function

The display tftp-client command displays the source IP address configured for the TFTP client.

Format

display tftp-client

Parameters

None

Views

All views

Default Level

3: Management level

Usage Guidelines

You can run the display tftp client command to query source IP address of the TFTP client. The default source IP address is 0.0.0.0 if tftp client-source is not configured.

Example

# Display the source IP address configured for the TFTP client.

<Huawei> display tftp-client
Info: The source address of TFTP client is 10.1.1.1.
Table 2-43  Description of the display tftp-client command output

Parameter

Description

Info: The source address of TFTP client is 10.1.1.1.

10.1.1.1 is the source IP address of the TFTP client.

You can run the tftp client-source command to configure the source IP address for the TFTP client.

If the IP address is configured for the source port, the message "The source interface of TFTP client is LoopBack0" is displayed.

display tftp-server status

Function

The display tftp-server status command displays the TFTP server information.

Format

display tftp-server status

Parameters

None

Views

All views

Default Level

3: Management level

Usage Guidelines

You can run this command to check the TFTP server configuration and connections with the current TFTP clients.

Example

# Display the TFTP server information.

<Huawei> display tftp-server status
TFTP Server is                         enabled
Listening port                         69
Timeout value(in second)               10
TFTP server's root path              flash:
There are 1 clients connected
        [1]: ip 10.137.217.163, port 23, op READ
Table 2-44  Description of the display tftp-server status command output

Item

Description

TFTP Server is

Status of the TFTP server.

  • disabled
  • enabled

To enable or disable the TFTP server function, run the tftp server enable command.

Listening port

Port number of the TFTP server.

To configure a port number for the TFTP server, run the tftp server port command.

Timeout value(in second)

Packet timeout period of the TFTP server, in seconds.

To configure a packet timeout period for the TFTP server, run the tftp server timeout command.

TFTP server's root path

Working directory of the TFTP server.

To configure a working directory for the TFTP server, run the set default tftp-directory command.

There are 1 clients connected

One client has connected to the TFTP server.

[1]: ip 10.137.217.163, port 23, op READ

Client information. The client sequence number is 1; IP address is 10.137.217.163; port number is 23; and operation type is Read.

execute

Function

The execute command executes a specified batch file.

Format

execute batch-filename

Parameters

Parameter Description Value
batch-filename

Specifies the name of a batch file.

The value is a string of 5 to 64 case-insensitive characters without spaces. The file name extension is .bat.

Views

System view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

If a series of commands are frequently executed, write these commands in a batch file, and store this file in system. In this way, you can only execute this command to run multiple commands which were manually entered before. This command improves maintenance and management efficiency.

NOTE:
  • The batch file is edited in .txt format. When editing the file, ensure that one command occupies one line. After editing the file, save the file and change the file name extension to .bat.

  • Transfer the batch file in file transmission mode to the device.

Prerequisites

Before running the execute command, ensure that the batch file to be processed is in the current directory; otherwise, the system cannot find the batch file.

Precautions

  • The commands in a batch file are run one by one. A batch file cannot contain invisible characters (control characters or escape characters, such as \r, \n, and \b). If any invisible character is detected, the execute command exits from the current process and no rollback is performed.

  • The execute command does not ensure that all commands can be run. If the system runs a wrong or immature command, it displays the error and goes to next command. The execute command does not perform the hot backup operation, and the command format or content is not restricted.

  • In case of interactive commands, batch file execution waits the device to interact with users before continuing.

Example

# Execute the test.bat file in the directory flash:/. The test.bat file contains three commands: system-view, aaa, and local-user huawei password irreversible-cipher Helloworld@6789.

<Huawei> system-view
[Huawei] execute test.bat
[Huawei] system-view
           ^
Error: Unrecognized command found at '^' position.
[Huawei] aaa
[Huawei-aaa] local-user huawei password irreversible-cipher Helloworld@6789
[Huawei-aaa] 

When the system runs the first command system-view in current system view, it displays an error and continues to run the following commands.

The system displays the execution of a batch file in AAA view.

[Huawei-aaa] display this 
 local-user huawei password irreversible-cipher %@%@HW=5%Mr;:2)/RX$FnU1HLO%-TBMp4wn%;~\#%iAut}_~O%0L%@%@

file prompt

Function

The file prompt command changes the prompt mode when you perform operations on files.

The default prompt mode is alert.

Format

file prompt { alert | quiet }

Parameters

Parameter Description Value
alert Display a prompt message before users perform an operation. -
quiet Do not display a prompt message before users perform an operation. -

Views

System view

Default Level

3: Management level

Usage Guidelines

If the prompt mode is set to quiet, the system does not provide prompt messages when operations leading to data loss are executed, such as deleting or overwriting files. Therefore, this prompt mode should be used with caution.

Example

# Set the prompt mode to quiet. When you rename a copied file test.txt using an existing file name test1.txt, no prompt message is displayed.

<Huawei> system-view
[Huawei] file prompt quiet
[Huawei] quit
<Huawei> copy test.txt test1.txt
100%  complete
Info: Copied file flash:/test.txt to flash:/test1.txt...Done. 

# Set the prompt mode to alert.

<Huawei> system-view
[Huawei] file prompt alert
[Huawei] quit
<Huawei> copy test.txt test1.txt
Copy flash:/test.txt to flash:/test1.txt?[Y/N]:y
The file flash:/test1.txt exists. Overwrite it?[Y/N]:y
100%  complete
Info: Copied file flash:/test.txt to flash:/test1.txt...Done. 

format

Function

The format command formats a storage device.

NOTE:

The AR510 series does not support this command.

Format

format drive

Parameters

Parameter Description Value
drive Specifies the name of the storage device to format.

If a storage device contains the system software package, the storage device cannot be formatted using the format command. To format the storage device, perform the operation in the BootROM menu.

-

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The following describes the storage device name.
  • drive is the storage device and is named as flash:.

When the file system fault cannot be rectified or the data on the storage device is unnecessary, the storage device can be formatted. When you run the format command, all files and directories are cleared from the storage device.

Configuration Impact
After a storage device is formatted, the data it saves is deleted. If the configuration file for the next startup is saved on the storage device, configurations are lost after the device is restarted. If the software package for the next startup is saved on the storage device, device restart is affected.

Precautions

After the format command is run, files and directories are cleared from the specified storage device and cannot be restored. Therefore, this command should be used with caution.

If the storage device is still unavailable after the format command is run, a physical exception may have occurred.

Example

# Format the storage device.

<Huawei> format flash:
All data(include configuration and system startup file) on flash: will be lost , proceed with format? (y/n)[n]:y
Info: Format flash: completed.

ftp

Function

The ftp command connects the FTP client to the FTP server and enters the FTP client view.

Format

# Connect the FTP client to the FTP server based on the IPv4 address.

ftp [ [ -a source-ip-address | -i interface-type interface-number ] host-ip [ port-number ] [ public-net | vpn-instance vpn-instance-name ] ]

# Connect the FTP client to the FTP server based on the IPv6 address.

ftp ipv6 host-ipv6 [ vpn6-instance vpn6-instance-name ] [ port-number ]

Parameters

Parameter Description Value
-a source-ip-address

Specifies the source IP address for connecting to the FTP client. You are advised to use the loopback interface IP address.

The value is in dotted decimal notation.

-i interface-type interface-number

Specifies the source interface type and ID. You are advised to use the loopback interface.

The IP address configured for this interface is the source IP address for sending packets. If no IP address is configured for the source interface, the FTP connection cannot be set up.

-
host-ip

Specifies the IP address or host name of the remote IPv4 FTP server.

The value is a string of 1 to 255 case-insensitive characters without spaces.

When quotation marks are used around the string, spaces are allowed in the string.

port-number

Specifies the port number of the FTP server.

The value is an integer that ranges from 1 to 65535. The default value is the standard port number 21.
public-net

Specifies the FTP server on the public network.

You must set the public-net parameter when the FTP server IP address is a public network IP address.

-
vpn-instance vpn-instance-name

Specifies the name of the VPN instance where the IPv4 FTP server is located.

The value is a string of 1 to 31 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.
vpn6-instance vpn6-instance-name

Specifies the name of the VPN instance where the IPv6 FTP server is located.

The value is a string of 1 to 31 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.
host-ipv6 Specifies the IP address or host name of the remote IPv6 FTP server.

The value is a string of 1 to 46 case-insensitive characters without spaces.

When quotation marks are used around the string, spaces are allowed in the string.

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

Before accessing the FTP server on the FTP client, you must first run the ftp command to connect the FTP client to the FTP server.

Precautions

  • You can set the source IP address to the source or destination IP address in the ACL rule when the -a or -i parameter is specified on the IPv4 network. This shields the IP address differences and interface status impact, filters incoming and outgoing packets, and implements security authentication.
  • You can run the set net-manager vpn-instance command to configure the NMS management VPN instance before running the open command to connect the FTP client and server.
    • If public-net or vpn-instance is not specified, the FTP client accesses the FTP server in the VPN instance managed by the NMS.

    • If public-net is specified, the FTP client accesses the FTP server on the public network.

    • If vpn-instance vpn-instance-name is specified, the FTP client accesses the FTP server in a specified VPN instance.

  • If no parameter is set in the ftp command, only the FTP view is displayed, and no connection is set up between the FTP server and client.
  • If the port number that the FTP server uses is non-standard, you must specify a standard port number; otherwise, the FTP server and client cannot be connected.
  • When you run the ftp command, the system prompts you to enter the user name and password for logging in to the FTP server. You can log in to the FTP server if the user name and password are correct.
  • If the number of login users exceeds the maximum value that the FTP server allows, other authorized users cannot log in to the FTP server. To allow news authorized users to log in to the FTP server, users who have performed FTP services must disconnect their clients from the FTP server. You can run the bye or quit command to disconnect the FTP client from the FTP server and return to the user view, or run the close or disconnect command to disconnect the FTP client from the FTP server and retain in the FTP client view.

Example

# Connect to the FTP server whose IP address is 10.137.217.201.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp]
# Connect to the remote IPv6 FTP server whose address is fc00:2001:db8::1.
<Huawei> ftp ipv6 fc00:2001:db8::1
Trying fc00:2001:db8::1
Press CTRL+K to abort
Connected to ftp fc00:2001:db8::1.
220 FTP service ready.
User(fc00:2001:db8::1:(none)):huawei
331 Password required for huawei
Enter Password:
230 User logged in.

[Huawei-ftp]
Related Topics

ftp acl

Function

The ftp acl command specifies an ACL number for the current FTP server so that the FTP client with the same ACL number can access the FTP server.

The undo ftp acl command deletes an ACL number of the current FTP server.

By default, no ACL is configured for FTP server.

Format

ftp [ ipv6 ] acl acl-number

undo ftp [ ipv6 ] acl

Parameters

Parameter Description Value
ipv6 Specifies the IPv6 FTP server. -
acl-number Specifies the number of the ACL. The value is an integer that ranges from 2000 to 2999.

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

To ensure the security of an FTP server, you need to configure an ACL for it to specify FTP clients that can access the current FTP server.

Precautions

  • The ftp acl command takes effect only after you run the rule command to configure the ACL rule.
  • The FTP only supports the basic ACL whose number ranges from 2000 to 2999.

Example

# Allow the client whose ACL number is 2000 to log in to the FTP server.

<Huawei> system-view
[Huawei] acl 2000
[Huawei-acl-basic-2000] rule permit source 10.10.10.1 0
[Huawei-acl-basic-2000] quit
[Huawei] ftp acl 2000
Related Topics

ftp client-source

Function

The ftp client-source command specifies the source IP address for the FTP client to send packets.

The undo ftp client-source command restores the default source IP address for the FTP client to send packets.

The default source IP address for the FTP client to send packets is 0.0.0.0.

Format

ftp client-source { -a source-ip-address | -i interface-type interface-number }

undo ftp client-source

Parameters

Parameter Description Value
-a source-ip-address

Specifies the source IP address. You are advised to use the loopback interface IP address.

The value is in dotted decimal notation.
-i interface-type interface-number

Specifies the source interface. You are advised to use the loopback interface.

The IP address configured for the source interface is the source IP address for sending packets. If no IP address is configured for the source interface, the FTP connection cannot be set up.

-

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

If no source IP address is specified, the client uses the source IP address that the router specifies to send packets. The source IP address must be configured for an interface with stable performance. The loopback interface is recommended. Using the loopback interface as the source interface simplifies the ACL rule and security policy configuration. This shields the IP address differences and interface status impact, filters incoming and outgoing packets, and implements security authentication.

Precautions

  • You can also run the ftp command to configure the source IP address whose priority is higher than that of the source IP address specified by the ftp client-source command. If you specify the source IP addresses by running the ftp client-source and ftp commands, the source IP address specified by the ftp command is used for data communication and is available only for the current FTP connection, while the source IP address specified by the ftp client-source command is available for all FTP connections.

  • The IP address that a user displays on the FTP server is the specified source IP address or source interface IP address.
  • If the specified source interface has been bound to a VPN instance, the client is automatically bound to the same VPN instance.

Example

# Set the source IP address of the FTP client to 10.1.1.1.

<Huawei> system-view
[Huawei] ftp client-source -a 10.1.1.1
Info: Succeeded in setting the source address of the FTP client to 10.1.1.1.

ftp server enable

Function

The ftp server enable command enables the FTP server function to allow FTP users to log in to the FTP server.

The undo ftp server command disables the FTP server function so that FTP users cannot log in to the FTP server.

By default, the FTP function is disabled.

Format

ftp [ ipv6 ] server enable

undo ftp [ ipv6 ] server

Parameters

Parameter Description Value
ipv6 Specifies the IPv6 FTP server. -

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

To manage FTP server files on a client, you must run the ftp server enable command to enable the FTP server function to allow FTP users to log in to the FTP server.

Precautions

If the FTP server function is disabled, no user can log in to the FTP server, and users who have logged in to the FTP server cannot perform any operation except logout.

The FTP protocol compromises device security. SFTP V2 mode is recommended.

Example

# Enable the FTP server function.

<Huawei> system-view
[Huawei] ftp server enable
Info: Succeeded in starting the FTP server.
Info: FTP is insecure, recommended to use SFTP with encryption features.
Related Topics

ftp server permit interface

Function

The ftp server permit interface command specifies physical interfaces on the FTP server to which clients can connect.

The undo ftp permit interface command restores the default physical interfaces on the FTP server to which clients can connect.

By default, clients can connect to all the physical interfaces on the FTP server.

Format

ftp server permit interface { interface-type interface-number } &<1-5>

undo ftp server permit interface

Parameters

Parameter Description Value
interface-type interface-number

interface-type: specifies the interface type.

interface-number: specifies the interface number. interface-number and interface-type specify an interface.

-

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

To prevent a client from connecting to the FTP server through an unauthorized physical interface, you can run the ftp server permit interface command to specify physical interfaces on the FTP server to which the client can connect.

Precautions

  • By default, the client can connect to all the physical interfaces on the FTP server. When you run this command to specify one physical interface on the FTP server, the client cannot connect to the other physical interfaces on the FTP server.
  • You can specify a maximum of five interfaces each time you run the ftp server permit interface command. The latest configuration overrides the previous one. For example, before you run the command, clients can connect to three physical interfaces GigabitEthernet 1/0/0, GigabitEthernet 2/0/0, and GigabitEthernet 3/0/0 on the FTP server. After you run the command to specify the interface GigabitEthernet 1/0/0, clients can only connect to the interface GigabitEthernet 1/0/0.

Example

# Specify physical interfaces on the FTP server to which clients can connect.

<Huawei> system-view
[Huawei] ftp server permit interface gigabitethernet 1/0/0 gigabitethernet 2/0/0
Info: Succeeded in setting ftp permit interface.

# Restore the default physical interfaces on the FTP server to which clients can connect.

<Huawei> system-view
[Huawei] undo ftp server permit interface

ftp server port

Function

The ftp server port command specifies the listening port number of the FTP server.

The default value is 21.

Format

ftp [ ipv6 ] server port port-number

Parameters

Parameter Description Value
ipv6 Specifies the IPv6 FTP server. -
port port-number Specifies the listening port number of the FTP server. The value is 21 or an integer that ranges from 1025 to 55535.

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

By default, the listening port number of the FTP server is 21. Attackers may frequently access the default listening port, which wastes bandwidth, deteriorates server performance, and prevents authorized users from accessing the FTP server through the listening port. You can run the ftp server port command to specify another listening port number to prevent attackers from accessing the listening port.

Prerequisites

Before running the ftp server port command to specify the listening port number, you must first run the undo ftp server command to disable FTP services.

Precautions

  • After the ftp server port command is executed, the FTP server disconnects all FTP connections and uses the new listening port.

  • If the current listening port number is 21, FTP client users do not need to specify the port number for logging in to the FTP server. If the current listening port number is not 21, FTP client users must use the FTP server's listening port number to log in to the FTP server.

  • After the listening port number is changed, you must run the ftp server enable command to enable FTP services to make the configuration take effect.

Example

# Change the port number of the FTP server to 1028.
<Huawei> system-view
[Huawei] undo ftp server
[Huawei] ftp server port 1028
Related Topics

ftp server-source

Function

The ftp server-source command specifies the source IP address for an FTP server to send packets.

The undo ftp server-source command restores the default source IP address for an FTP server to send packets.

The default source IP address for the FTP server to send packets is 0.0.0.0.

Format

ftp server-source { -a [ ipv6 ] source-ip-address | -i [ ipv6 ] interface-type interface-number }

undo ftp [ ipv6 ] server-source

Parameters

Parameter Description Value
ipv6

Configures the FTP server to support an IPv6 source address.

-
-a source-ip-address

Specifies the source IP address for the FTP server to send packets. The loopback IP address is recommended.

-
-i interface-type interface-number

Specifies the loopback interface of the FTP server as the source interface.

If no loopback interface is configured or no IP address is configured for the source interface, the command fails to be executed.

-

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

If no source IP address is specified, the FTP server uses the source IP address specified by routes to send packets. The source IP address must be configured for an interface with stable performance, such as the loopback interface. Using the loopback interface as the source IP address simplifies the ACL rule and security policy configuration. This shields the IP address differences and interface status impact, filters incoming and outgoing packets, and implements security authentication.

Precautions

  • After the source IP address is specified for the FTP server, you must use the specified IP address to log in to the FTP server.
  • If the FTP service has been enabled, the FTP service restarts after the ftp server-source command is executed.
  • If the specified source interface has been bound to a VPN instance, the server is automatically bound to the same VPN instance.

Example

# Set the source IP address of the FTP server to LoopBack0.

<Huawei> system-view
[Huawei] ftp server-source -i loopback 0
Warning: To make the server source configuration take effect, the FTP server will be restarted. Continue? [Y/N]: y
Info: Succeeded in setting the source interface of the FTP server to LoopBack0.
Info: Succeeded in starting the FTP server.
Info: FTP is insecure, recommended to use SFTP with encryption features.

ftp timeout

Function

The ftp timeout command configures the idle timeout duration of the FTP server.

The undo ftp timeout command restores the default idle timeout duration.

By default, the idle timeout duration of the FTP server is 30 minutes.

Format

ftp [ ipv6 ] timeout minutes

undo ftp [ ipv6 ] timeout

Parameters

Parameter Description Value
ipv6 Specifies the IPv6 FTP server. -
minutes Specifies idle timeout duration. The value is an integer that ranges from 1 to 35791, in minutes. By default, the idle timeout duration is 30 minutes.

Views

System view

Default Level

3: Management level

Usage Guidelines

After a user logs in to the FTP server, a connection is set up between the FTP server and the user's client. The idle timeout duration is configured to release the connection when the connection is interrupted or when the user performs no operation for a specified time.

Example

# Set the idle timeout duration to 36 minutes.

<Huawei> system-view
[Huawei] ftp timeout 36
Related Topics

get (SFTP client view)

Function

The get command downloads a file from the SFTP server and saves the file to the local device.

Format

get remote-filename [ local-filename ]

Parameters

Parameter Description Value
remote-filename Specifies the name of the file to be downloaded from the SFTP server. The value is a string of 1 to 64 case-insensitive characters without spaces.
local-filename Specifies the name of a downloaded file to be saved to the local device. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

SFTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

You can run the get command to download files from the FTP server to upgrade devices.

Precautions

  • If local-filename is not specified on the local device, the original file name is used.

  • If the name of the downloaded file is the same as that of an existing local file, the system prompts you whether to overwrite the existing file.

Example

# Download a file from the SFTP server.

<Huawei> system-view
[Huawei] sftp 10.137.217.201
Please input the username:admin
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201 ...
Enter password:
sftp-client> get test.txt
Remote file: / test.txt --->  Local file: test.txt
Info: Downloading file successfully ended.

get (FTP client view)

Function

The get command downloads a file from the FTP server and saves the file to the local device.

Format

get remote-filename [ local-filename ]

Parameters

Parameter Description Value
remote-filename Specifies the name of the file to be downloaded from the FTP server. The value is a string of 1 to 64 case-insensitive characters without spaces.
local-filename Specifies the name of a downloaded file to be saved to the local device. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

You can run the get command to download system software, backup configuration files, and patch files from the FTP server to upgrade devices.

Precautions

  • If the downloaded file name is not specified on the local device, the original file name is used.

  • If the name of the downloaded file is the same as that of an existing local file, the system prompts you whether to overwrite the existing file.

Example

# Download the system software devicesoft.cc from the FTP server.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] get devicesoft.cc
200 Port command successful.                                                    
150 Opening data connection for devicesoft.cc.                                     
226 File sent ok                                                                
FTP: 6482944 byte(s) received in 54.500 second(s) 1117.40byte(s)/sec.
Related Topics

help (SFTP client view)

Function

The help command displays the help information in the SFTP client view.

Format

help [ all | command-name ]

Parameters

Parameter Description Value
all Displays all commands in the SFTP client view. -
command-name Displays the format and parameters of a specified command in the SFTP client view. -

Views

SFTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

In the SFTP view, you can only enter the question mark (?) to obtain all commands in the SFTP client view. If you enter a command keyword and the question mark (?) to query command parameters, an error message is displayed, as shown in the following:

sftp-client> dir ?
Error: Failed to list files. 

You can run the help command to obtain the help information and display all commands or a command format in the SFTP client view.

Precautions

If you specify no parameter when running the help command, all commands in the SFTP client view are displayed. This has the same effect as the help all command or directly entering the question mark (?) in the SFTP client view.

Example

# Display the format of the command get.

<Huawei> system-view
[Huawei] sftp 10.137.217.201
Please input the username:admin
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201 ...
Enter password:
sftp-client> help get
get Remote file name STRING<1-64>   [Local file name STRING<1-64>]  Download file
Default local file name is the same with remote file.

# Display all commands in the SFTP client view.

sftp-client> help all
cd
cdup
dir
get
help
ls
mkdir
put
pwd
quit
rename
remove
rmdir
Related Topics

lcd

Function

The lcd command displays and changes the local working directory of the FTP client in the FTP client view.

Format

lcd [ local-directory ]

Parameters

Parameter Description Value
local-directory Specifies the local working directory of the FTP client. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

You can run the lcd command to display the local working directory of the FTP client when uploading or downloading files, and set the upload or download path to the path of the local working directory.

Precautions

The lcd command displays the local working directory of the FTP client, while the pwd command displays the working directory of the FTP server. If you specify the parameter local-directory in the lcd command, you can directly change the local working directory in the FTP client view.

Example

# Change the local working directory to flash:/test.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] lcd
The current local directory is flash:.
[Huawei-ftp] lcd flash:/test
The current local directory is flash:/test.
Related Topics

mkdir (FTP client view)

Function

The mkdir command creates a directory on the remote FTP server.

Format

mkdir remote-directory

Parameters

Parameter Description Value
remote-directory Specifies the directory to be created. The value is a string of case-insensitive characters without spaces. The absolute path length ranges from 1 to 64, while the directory name length ranges from 1 to 15.

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

  • You can run the mkdir command to create a subdirectory in a specified directory, and the subdirectory name must be unique.

  • If no path is specified when you create a subdirectory, the subdirectory is created in the current directory.

  • The created directory is stored on the FTP server.

Example

# Create a directory test on the remote FTP server.

<Huawei> ftp 172.16.104.110
Trying 172.16.104.110 ...
Press CTRL+K to abort
Connected to 172.16.104.110.
220 FTP service ready.
User(172.16.104.110:(none)):huawei
331 Password required for huawei
Enter password:
230 User logged in.
[Huawei-ftp] mkdir test
257 "test" new directory created.

mkdir (SFTP client view)

Function

The mkdir command creates a directory on the remote SFTP server.

Format

mkdir remote-directory

Parameters

Parameter Description Value
remote-directory Specifies the directory to be created. The value is a string of case-insensitive characters without spaces. The absolute path length ranges from 1 to 64, while the directory name length ranges from 1 to 15.

Views

SFTP client view

Default Level

3: Management level

Usage Guidelines

  • You can run the mkdir command to create a subdirectory in a specified directory, and the subdirectory name must be unique.

  • If no path is specified when you create a subdirectory, the subdirectory is created in the current directory.

  • The created directory is stored on the SFTP server.

  • After a directory is created, you can run the dir/ls (SFTP client view) command to view the directory.

Example

# Create a directory on the SFTP server.

<Huawei> system-view
[Huawei] sftp 10.137.217.201
Please input the username:admin
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201 ...
Enter password:
sftp-client> mkdir ssh
Info: Succeeded in creating a directory.

mkdir (User view)

Function

The mkdir command creates a directory in the current storage device.

Format

mkdir directory

Parameters

Parameter

Description

Settings

directory

Specifies a directory or directory and its path.

The value is a string of case-insensitive characters in the [ drive ] [ path ] directory format. The absolute path length ranges from 1 to 64, while the directory name length ranges from 1 to 15.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

Characters such as ~, *, /, \, :, ', " cannot be used in the directory name.

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The following describes the drive name.
  • drive is the storage device and is named as flash:.

The path can be an absolute path or relative path.
  • flash:/my/test/ is an absolute path.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

If you only the subdirectory name is specified, a subdirectory is created in the current working directory. You can run the pwd (user view) command to query the current working directory. If the subdirectory name and directory path are specified, the subdirectory is created in the specified directory.

Precautions

  • The subdirectory name must be unique in a directory; otherwise, the message "Error: Directory already exists" is displayed.

  • A maximum of four directory levels are supported when you create a directory.

Example

# Create the subdirectory new in the flash card.

<Huawei> mkdir flash:/new
Info: Create directory flash:/new......Done
Related Topics

more

Function

The more command displays the content of a specified file.

Format

more [ /binary ] filename [ offset ] [ all ]

Parameters

Parameter Description Value
/binary Displays the file content in binary mode.

-

filename Specifies the file name.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

offset Specifies the file offset. The value is an integer that ranges from 0 to 2147483647, in bytes.
all Displays all the file content on one screen. -

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

You can run the more command to display the file content directly on a device.

  • The following describes the drive name.

    • drive is the storage device and is named as flash:.

  • The path can be an absolute path or relative path.
    • flash:/my/test/ is an absolute path.

    • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

Precautions

  • You are not advised to use this command to display non-text files; otherwise, the terminal is shut down or displays garbled characters, which is harmless to the system.

  • Files are displayed in text format.

  • You can display the file content flexibly by specifying parameters before running the more command:
    • You can run the more filename command to view a specified text file. The content of the specified text file is displayed on multiple screens. You can press the spacebar consecutively on the current session GUI to display all content of the file.

      To display the file content on multiple screens, you must ensure that:
      • The number of lines that can be displayed on a terminal screen is greater than 0. (The number of lines that can be displayed on a terminal screen is set by running the screen-length command.)
      • The total number of file lines is greater than the number of lines that can be displayed on a terminal screen. (The number of lines that can be displayed on a terminal screen is set by running the screen-length command.)
    • You can run the more filename offset command to view a specified file. The content of the specified text file starting from offset is displayed on multiple screens. You can press the spacebar consecutively on the current session GUI to display all content of the file.

      To display the file content on multiple screens, you must ensure that:
      • The number of lines that can be displayed on a terminal screen is greater than 0. (The number of lines that can be displayed on a terminal screen is set by running the screen-length command.)
      • The number of lines starting from offset in the file is greater than the number of lines that can be displayed on a terminal screen. (The number of lines that can be displayed on a terminal screen is set by running the screen-length command.)
    • You can run the more file-name all command to view a specified file. The file content is displayed on one screen.

Example

# Display the content of the file test.bat.

<Huawei> more test.bat
rsa local-key-pair create
user-interface vty 12 14
authentication-mode aaa
protocol inbound ssh
user privilege level 5
quit
ssh user sftpuser authentication-type password
sftp server enable
# Display the content of the file log.txt and set the offset to 100.
<Huawei> more log.txt 100
:                CHINA HUAWEI TECHNOLOGY LIMITTED CO.,LTD
#   FILE NAME:                  Product Adapter File(PAF)
#   PURPOSE:                    MAKE VRPV5 SUITABLE FOR DIFFERENT PRODUCT IN LIB
#   SOFTWARE PLATFORM:          V6R2C00
#   DETAIL VERSION:             B283
#   DEVELOPING GROUP:            8090 SYSTEM MAINTAIN GROUP
#   HARDWARE PLATFORM:          8090 (512M Memory)
#   CREATED DATE:               2003/05/10
#   AUTH:                        RAINBOW
#   Updation History:           Kelvin dengqiulin update for 8090(2004.08.18)
#                               lmg update for R3(2006.11.7)
#                               fsr update for R5 (2008.1.18)
#                               qj update for R6 (2008.08.08)
#   COPYRIGHT:                           2003---2008
#----------------------------------------------------------------------------------


#BEGIN FOR RESOURCE DEFINATION
[RESOURCE]
FORMAT: SPECS RESOURCE NAME STRING = CONTROLLABLE(1 : ABLE , 0: NOT ABLE),DEFAUL
T VALUE , MAX VALUE , MIN VALUE
#BEGIN  SPECS RESOURCE FOR TE tunnel Nto1 PS MODULE
PAF_LCS_TUNNEL_SPECS_TE_PS_MAX_PROTECT_NUM = 1, 8, 16, 1
PAF_LCS_TUNNEL_SPECS_TE_PS_REBOOT_TIME     = 1, 180000, 3600000, 60000
  ---- More ----                                                               
# Display the content of the file paf.txt.
<Huawei> more paf.txt all
PAF_LCS_588_IFC_FIFO_DEPTH_ASE = 222
#IFC_FIFO_DEPTH_ASE EXPLAIN (222: NORMAL, 102: DEEP)
PAF_LCS_588_IPE_FIFO_DEPTH_TCM = 659206
#IPE_FIFO_DEPTH_TCM EXPLAIN (659206: NORMAL, 655360: DEEP)
PAF_LCS_588_IFC_FIFO_DEPTH_TCM = 222
#IFC_FIFO_DEPTH_TCM EXPLAIN (222: NORMAL, 102: DEEP)
#END OF SPECS RESOURCE FOR 588 MODULE
#BEGIN  8090 MEM GATE  AND  ISSU MEM GATE
PAF_LCS_8090_BOARD_RESET_MEMORY_GATE           = 90
PAF_LCS_8090_512BOARD_RESET_MEMORY_GATE        = 85
PAF_LCS_8090_BOARD_RESET_MEMORY_GATE_ISSU      = 95
PAF_LCS_ISSU_CHECK_MEMORY_GATE                 = 40
#END  8090 MEM GATE  AND  ISSU MEM GATE
[END CONFIGURE]  

move

Function

The move command moves the source file from a specified directory to a destination directory.

Format

move source-filename destination-filename

Parameters

Parameter

Description

Settings

source-filename

Specifies the directory and name of a source file.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

destination-filename

Specifies the directory and name of a destination file.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The following describes the drive name.

  • drive is the storage device and is named as flash:.

The path can be an absolute path or relative path.
  • flash:/my/test/ is an absolute path.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

Precautions

  • If the destination file has the same name as an existing file, the system prompts you whether to overwrite the existing file. The system prompt is displayed only when file prompt is set to alert.

  • This command cannot be used to move files between storage devices.
  • The move and copy commands have different effects:

    • The move command moves the source file to the destination directory.
    • The copy command copies the source file to the destination directory.

Example

# Move a file from flash:/test/sample.txt to flash:/sample.txt.

<Huawei> move flash:/test/sample.txt flash:/sample.txt
Info: Move flash:/test/sample.txt to flash:/sample.txt ?(y/n)[n]: y
Info: Moved file flash:/test/sample.txt to flash:/sample.txt. 
Related Topics

open

Function

The open command connects the FTP client and server.

Format

# Connect the FTP client to the FTP server based on the IPv4 address.

open [ -a source-ip-address | -i interface-type interface-number ] host-ip [ port-number ] [ public-net | vpn-instance vpn-instance-name ]

# Connect the FTP client to the FTP server based on the IPv6 address.

open ipv6 host-ipv6 [ port-number ]

Parameters

Parameter Description Value
-a source-ip-address

Specifies the source IP address for connecting to the FTP client. You are advised to use the loopback interface IP address.

-
-i interface-type interface-number

Specifies the source interface type and ID. You are advised to use the loopback interface.

The IP address configured for this interface is the source IP address for sending packets. If no IP address is configured for the source interface, the FTP connection cannot be set up.

-
host-ip

Specifies the IP address or host name of the remote IPv4 FTP server.

The value is a string of 1 to 255 case-insensitive characters without spaces.

When quotation marks are used around the string, spaces are allowed in the string.

port-number Specifies the port number of the FTP server. The value is an integer that ranges from 1 to 65535, or 21. The default value is the standard port number 21.
public-net

Specifies the FTP server on the public network.

You must set the public-net parameter when the FTP server IP address is a public network IP address.

-
vpn-instance vpn-instance-name

Specifies the name of the VPN instance where the FTP server is located.

The value is a string of 1 to 31 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.
host-ipv6 Specifies the IP address or host name of the remote IPv6 FTP server.

The value is a string of 1 to 46 case-insensitive characters without spaces.

When quotation marks are used around the string, spaces are allowed in the string.

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

You can run the open command in the FTP client view to connect the FTP client to the server to transmit files and manage files and directories of the FTP server.

Precautions

  • You can run the ftp command in the user view to connect the FTP client and server and enter the FTP client view.

  • You can set the source IP address to the source or destination IP address in the ACL rule when the -a or -i parameter is specified on the IPv4 network. This shields the IP address differences and interface status impact, filters incoming and outgoing packets, and implements security authentication.
  • You can run the set net-manager vpn-instance command to configure the NMS management VPN instance before running the open command to connect the FTP client and server.
    • If public-net or vpn-instance is not specified, the FTP client accesses the FTP server in the VPN instance managed by the NMS.

    • If public-net is specified, the FTP client accesses the FTP server on the public network.

    • If vpn-instance vpn-instance-name is specified, the FTP client accesses the FTP server in a specified VPN instance.

  • If the port number that the FTP server uses is non-standard, you must specify a standard port number; otherwise, the FTP server and client cannot be connected.

  • When you run the open command, the system prompts you to enter the user name and password for logging in to the FTP server. You can log in to the FTP client and enter the FTP client view if the user name and password are correct.

Example

# Connect the FTP client with the FTP server whose IP address is 10.137.217.204.

<Huawei> ftp
[Huawei-ftp] open 10.137.217.204 
Trying 10.137.217.204 ...
Press CTRL+K to abort
Connected to 10.137.217.204.
220 FTP service ready.
User(10.137.217.204:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in.

[Huawei-ftp]
# Connect the FTP client with the FTP server whose IP address is fc00:2001:db8::1.
<Huawei> ftp
[Huawei-ftp] open ipv6 fc00:2001:db8::1
Trying fc00:2001:db8::1 ...
Press CTRL+K to abort
Connected to fc00:2001:db8::1
220 FTP service ready.
User(fc00:2001:db8::1:(none)):huawei
331 Password required for huawei
Enter Password:
230 User logged in.

[Huawei-ftp]
Related Topics

passive

Function

The passive command sets the data transmission mode to passive.

The undo passive command sets the data transmission mode to active.

By default, the data transmission mode is active.

Format

passive

undo passive

Parameters

None

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

The device supports the active and passive data transmission modes. In active mode, the server initiates a connection request, and the client and server need to enable and monitor a port to establish a connection. In passive mode, the client initiates a connection request, and only the server needs to monitor the corresponding port. This command is used together with the firewall function. When the client is configured with the firewall function, FTP connections are restricted between internal clients and external FTP servers if the FTP transmission mode is active. If the FTP transmission mode is passive, FTP connections between internal clients and external FTP servers are not restricted.

Example

# Set the data transmission mode to passive.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[ftp] passive
Info: Succeeded in switching passive on.

put (FTP client view)

Function

The put command uploads a local file to the remote FTP server.

Format

put local-filename [ remote-filename ]

Parameters

Parameter Description Value
local-filename Specifies the local file name of the FTP client. The value is a string of 1 to 64 case-insensitive characters without spaces.
remote-filename Specifies the name of the file to be uploaded to the remote FTP server. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

You can run the put command to upload a local file to the remote FTP server for further check and backup. For example, you can upload the local log file to the FTP server for other users to check, and upload the configuration file to the FTP server as a backup before upgrading the device.

Precautions

  • If the file name is not specified on the remote FTP server , the local file name is used.

  • If the name of the uploaded file is the same as that of an existing file on the FTP server, the system overwrites the existing file.

Example

# Upload the configuration file vrpcfg.zip to the remote FTP server as a backup, and save it as backup.zip.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] put vrpcfg.zip backup.zip 
200 Port command successful.
150 Opening BINARY mode data connection for file transfer.
226 Transfer complete
FTP: 1098 byte(s) sent in 0.131 second(s) 8.38Kbyte(s)/sec.
Related Topics

put (SFTP client view)

Function

The put command uploads a local file to a remote SFTP server.

Format

put local-filename [ remote-filename ]

Parameters

Parameter Description Value
local-filename Specifies a local file name on the SFTP client. The value is a case-insensitive character string without spaces. The file name (including the absolute path) contains 1 to 64 characters.
remote-filename Specifies the name of the file uploaded to the remote SFTP server. The value is a case-insensitive character string without spaces. The file name (including the absolute path) contains 1 to 64 characters.

Views

SFTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

This command enables you to upload files from the local device to a remote SFTP server to view the file contents or back up the files. For example, you can upload log files of a device to an SFTP server and view the logs in the server. During an upgrade, you can upload the configuration file of the device to the SFTP server for backup.

Precautions

  • If remote-filename is not specified, the uploaded file is saved on the remote SFTP server with the original file name.

  • If the specified remote-filename is the same as an existing file name on the SFTP server, the uploaded file overwrites the existing file on the server.

Example

# Upload a file to the SFTP server.

<Huawei> system-view
[Huawei] sftp 10.137.217.201
Please input the username:admin
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201 ...
Enter password:
sftp-client> put wm.cfg
local file: wm.cfg --->  Remote file: /wm.cfg
Info: Uploading file successfully ended.

pwd (FTP client view)

Function

The pwd command displays the FTP client's working directory on the remote FTP server.

Format

pwd

Parameters

None

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

After logging in to the FTP server, you can run the pwd command to display the FTP client's working directory on the remote FTP server.

If the displayed working directory is incorrect, you can run the cd command to change the FTP client's working directory on the remote FTP server.

Example

# Display the FTP client's working directory on the remote FTP server.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] pwd
257 "/" is current directory.
Related Topics

pwd (SFTP client view)

Function

The pwd command displays the SFTP client's working directory on the remote FTP server.

Format

pwd

Parameters

None

Views

SFTP client view

Default Level

3: Management level

Usage Guidelines

After logging in to the SFTP server, you can run the pwd command to display the SFTP client's working directory on the remote SFTP server.

If the displayed working directory is incorrect, you can run the cd command to change the SFTP client's working directory on the remote SFTP server.

Example

# Display the SFTP client's working directory on the remote SFTP server.

<Huawei> system-view
[Huawei] sftp 10.137.217.201
Please input the username:admin
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201 ...
Enter password:
sftp-client> pwd
/
sftp-client> cd test
Current directory is:
/test
sftp-client> pwd
/test
Related Topics

pwd (user view)

Function

The pwd command displays the current working directory.

Format

pwd

Parameters

None

Views

User view

Default Level

3: Management level

Usage Guidelines

You can run the pwd command in any directory to display the current working directory. To change the current working directory, you can run the cd command.

Example

# Display the current working directory.

<Huawei> pwd
flash:/test

remotehelp

Function

The remotehelp command displays the help information about an FTP command when the FTP client and server are connected.

Format

remotehelp [ command ]

Parameters

Parameter Description Value
command Specifies the FTP command. The value is a string of 1 to 16 characters.

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

You can run the remotehelp command to display the help information about an FTP command.

  • The help information is provided by the remote server. Different remote servers may provide different help information for an FTP command.
  • The help information can be displayed for FTP commands user, pass, cwd, cdup, quit, port, pasv, type, retr, stor, dele, rmd, mkd, pwd, list, nlst, syst, help, xcup, xcwd, xmkd, xpwd, and xrmd.

Example

# Display the syntax of the command cdup.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] remotehelp
214-The following commands are recognized (* =>'s unimplemented).                  
   USER   PORT   STOR   MSAM*   RNTO   NLST   MKD   CDUP 
   PASS   PASV   APPE   MRSQ*   ABOR   SITE*  XMKD  XCUP 
   ACCT   TYPE   MLFL*  MRCP*   DELE   SYST   RMD   STOU 
   SMNT*  STRU   MAIL*  ALLO*   CWD    STAT   XRMD  SIZE* 
   REIN   MODE   MSND*  REST*   XCWD   HELP   PWD   MDTM* 
   QUIT   RETR   MSOM*  RNFR    LIST   NOOP   XPWD 
214 Direct comments about WFTPD to alun@texis.com.    

[Huawei-ftp] remotehelp cdup
214 Syntax: CDUP <change to parent directory>.

remove (SFTP client view)

Function

The remove command deletes specified files from the remote SFTP server.

Format

remove remote-filename &<1-10>

Parameters

Parameter Description Value
remote-filename Specifies the name of the file to be deleted from the remote SFTP server. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

SFTP client view

Default Level

3: Management level

Usage Guidelines

  • You can configure a maximum of 10 file names in the command and separate them using spaces and delete them at one time.

  • If the file to be deleted is not in the current directory, you must specify the file path.

Example

# Delete the file 3.txt from the server and backup1.txt from the test directory.

<Huawei> system-view
[Huawei] sftp 10.137.217.201
Please input the username:admin
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201 ...
Enter password:
sftp-client> remove 3.txt test/backup1.txt
Warning: Make sure to remove these files? [y/n][n]:y
Info: Succeeded in removing the file /3.txt.
Info: Succeeded in removing the file /test/backup1.txt.

remove (user view)

Function

The remove command removes a storage device safely.

Format

remove drive

Parameters

Parameter Description Value
drive Specifies the name of the storage device to be removed. The value can be usb0:, usb1: sd0: or usbotg:.

Views

User view

Default Level

3: Management level

Usage Guidelines

You can run the remove command to safely remove a USB disk or an SD card from the device to prevent files in the device from being damaged.

Example

# Remove the storage device USB0.

<Huawei> remove usb0:
…
Info: remove device usb0: successfully

rename (SFTP client view)

Function

The rename command renames a file or directory stored on the SFTP server.

Format

rename old-name new-name

Parameters

Parameter Description Value
old-name

Specifies the name of a file or directory.

The value is a string of 1 to 64 case-insensitive characters without spaces.
new-name

Specifies the new name of the file or directory.

The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

SFTP client view

Default Level

3: Management level

Usage Guidelines

You can run the rename command to rename a file or directory.

Example

# Rename the directory yourtest on the SFTP server.

<Huawei> system-view
[Huawei] sftp 10.137.217.201
Please input the username:admin
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201 ...
Enter password:
sftp-client> rename test/yourtest test/test
Warning: Rename /test/yourtest to /test/test? [y/n][n]:y
Info: Succeeded in renaming file.
sftp-client> cd test
Current directory is:
/test
sftp-client> dir
drwxrwxrwx   1 noone    nogroup         0 Mar 29 22:44 .
drwxrwxrwx   1 noone    nogroup         0 Mar 29 22:39 ..
drwxrwxrwx   1 noone    nogroup         0 Mar 24 00:04 test
-rwxrwxrwx   1 noone    nogroup      5736 Mar 24 18:38 backup.txt

rename (user view)

Function

The rename command renames a file or folder.

Format

rename old-name new-name

Parameters

Parameter

Description

Settings

old-name

Specifies the name of a file or folder.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] filename format.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

new-name

Specifies the new name of the file or directory.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] filename format.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The following describes the drive name:

  • drive is the storage device and is named as flash:.

The path can be an absolute path or relative path.
  • flash:/my/test/ is an absolute path.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

Precautions

  • You must rename a file or directory in its source directory.

  • If the renamed file or directory has the same name as an existing file or directory, an error message is displayed.

  • If you specify old-name or new-name without specifying the file path, the file must be saved in your current working directory.

Example

# Rename the directory mytest to yourtest in the directory flash:/test/.

<Huawei> pwd
flash:/test 
<Huawei> rename mytest yourtest
Info: Rename flash:/test/mytest to flash:/test/yourtest ?(y/n)[n]:y
Info: Rename file flash:/test/mytest to flash:/test/yourtest ......Done 

# Rename the file sample.txt to sample.bak.

<Huawei> rename sample.txt sample.bak
Info: Rename flash:/sample.txt to flash:/sample.bak ?(y/n)[n] :y
Info: Rename file flash:/sample.txt to flash:/sample.bak .......Done
Related Topics

reset recycle-bin

Function

The reset recycle-bin command permanently deletes files from the recycle bin.

Format

reset recycle-bin [ filename | devicename ]

Parameters

Parameter Description Value
filename Specifies the name of a file to be deleted.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

The wildcard (*) character is supported.

devicename Specifies the storage device name.

-

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

If you run the delete command without specifying the /unreserved parameter, the file is moved to the recycle bin and still occupies the memory. To free up the space, you can run the reset recycle-bin command to permanently delete the file from the recycle bin.

The following describes the drive name.

  • drive is the storage device and is named as flash:.

The path can be an absolute path or relative path.
  • flash:/my/test/ is an absolute path.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

Like devicename, drive specifies the storage device name.

Precautions

  • You can run the dir /all command to display all files that are moved to the recycle bin from the current directory, and file names are displayed in square brackets ([ ]).

  • If you delete a specified storage device, all files in the root directory of the storage device are deleted.

  • If you run the reset recycle-bin command directly, all files that are moved to the recycle bin from the current directory are permanently deleted.

Example

# Delete the file test.txt that is moved to the recycle bin from the directory test.

<Huawei> reset recycle-bin flash:/test/test.txt
Info: Squeeze flash:/test/test.txt?(y/n)[n]:y
Info: Cleared file flash:/test/test.txt.

# Delete files that are moved to the recycle bin from the current directory.

<Huawei> pwd
flash:/test 
<Huawei> reset recycle-bin
Info: Squeeze flash:/test/backup.zip?(y/n)[n]:y
Info: Cleared file flash:/test/backup.zip.
Info: Squeeze flash:/test/backup1.zip?(y/n)[n]:y
Info: Cleared file flash:/test/backup1.zip. 

rmdir (FTP client view)

Function

The rmdir command deletes a specified directory from the remote FTP server.

Format

rmdir remote-directory

Parameters

Parameter Description Value
remote-directory Specifies a directory or path on the FTP server. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

You can run the rmdir command to delete a specified directory from the remote FTP server.

Precautions

  • Before running the rmdir command to delete a directory, you must delete all files and subdirectories from the directory.

  • If no path is specified when you delete a subdirectory, the subdirectory is deleted from the current directory.

  • The directory is deleted from the FTP server rather than the FTP client.

Example

# Delete the directory d:/temp1 from the remote FTP server.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] rmdir d:/temp1
250 'D:\temp1': directory removed.

rmdir (user view)

Function

The rmdir command deletes a specified directory from the storage device.

Format

rmdir directory

Parameters

Parameter Description Value
directory

Specifies a directory or directory and its path.

The value is a string of case-insensitive characters in the [ drive ] [ path ] directory format. The absolute path length ranges from 1 to 64, while the directory name length ranges from 1 to 15.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

Characters such as ~, *, /, \, :, ', " cannot be used in the directory name.

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The following describes the drive name.
  • drive is the storage device and is named as flash:.

The path can be an absolute path or relative path.
  • flash:/my/test/ is an absolute path.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

Precautions

  • Before running the rmdir command to delete a directory, you must delete all files and subdirectories from the directory.

  • A deleted directory and its files cannot be restored from the recycle bin.

Example

# Delete the directory test from the current directory.

<Huawei> rmdir test
Remove directory flash:/test?(y/n)[n]:y
Info: Removing directory flash:/test....Done! 
Related Topics

rmdir (SFTP client view)

Function

The rmdir command deletes a specified directory from the remote SFTP server.

Format

rmdir remote-directory &<1-10>

Parameters

Parameter Description Value
remote-directory Specifies the name of a file on the SFTP server. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

SFTP client view

Default Level

3: Management level

Usage Guidelines

  • You can configure a maximum of 10 file names in the command and separate them using spaces and delete them at one time.

  • Before running the rmdir command to delete a directory, you must delete all files and subdirectories from the directory.

  • If the directory to be deleted is not in the current directory, you must specify the file path.

Example

# Delete the directory 1 from the current directory, and the directory 2 from the test directory.

<Huawei> system-view
[Huawei] sftp 10.137.217.201
Please input the username:admin
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201 ...
Enter password:
sftp-client> rmdir 1 test/2
Warning: Make sure to remove these directories? [Y/N]:y
Info: Succeeded in removing the directory /test/1.
Info: Succeeded in removing the directory /test/test/2.

set default ftp-directory

Function

The set default ftp-directory command configures the default FTP working directory.

The undo set default ftp-directory command disables the default FTP working directory.

By default, no default FTP working directory is configured.

Format

set default ftp-directory directory

undo set default ftp-directory

Parameters

Parameter Description Value
directory Specify the default FTP working directory. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

You can run the set default ftp-directory command to configure a default FTP working directory for all FTP users at one time.

Precautions

  • The set default ftp-directory command takes effect only when the device functions as an FTP server and the user function as an FTP client.
  • You can run the local-user ftp-directory command to configure an authorized working directory for a local user.

  • If you have configured the FTP working directory by running the local-user ftp-directory command, you must use this FTP working directory.

  • You can run the lcd command to view the working directory of FTP users.
  • If no FTP working directory is specified on the device, FTP users cannot log in to the device.

Example

# Set the default FTP working directory to flash:/.

<Huawei> system-view
[Huawei] set default ftp-directory flash:/

set default tftp-directory

Function

The set default tftp-directory command configures a working directory for the TFTP server.

The undo set default tftp-directory command deletes the working directory of the TFTP server.

By default, no working directory is configured for the TFTP server.

Format

set default tftp-directory directory

undo set default tftp-directory

Parameters

Parameter Description Value
directory Specifies the working directory for the TFTP server. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

System view

Default Level

3: Management level

Usage Guidelines

You need to configure a working directory for the TFTP server on the device. After that, TFTP clients can obtain files from the specified working directory.

Example

# Set the working directory of the TFTP server to flash:.

<Huawei> system-view
[Huawei] set default tftp-directory flash:
Related Topics

set net-manager vpn-instance

Function

The set net-manager vpn-instance command configures the default VPN instance that the NMS uses on the device.

The undo set net-manager vpn-instance command deletes the default VPN instance from the device.

By default, no VPN instance is configured on the device.

Format

set net-manager vpn-instance vpn-instance-name

undo set net-manager vpn-instance

Parameters

Parameter Description Value
vpn-instance-name Specifies the name of the default VPN instance. The value is a string of 1 to 31 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

If the NMS manages devices on the VPN network, you need to send the device information to the NMS using the VPN instance.

You can run the set net-manager vpn-instance command to configure the default VPN instance for the NMS to manage the device so that the device can use this VPN instance to communicate with the NMS.

Precautions

  • Before running the set net-manager vpn-instance command, you must create VPN instances.

  • After running this command, you can successfully run file transfer commands that you have configured based on the FTP, SFTP commands only in the default VPN instance.

  • If the host has been configured as a log host, the NMS can receive device logs from the default VPN instance.

Example

# Set the default VPN instance to v1.

<Huawei> system-view
[Huawei] set net-manager vpn-instance v1
Related Topics

sftp

Function

The sftp command connects the device to the SSH server so that you can manage files that are stored on the SFTP server.

Format

# Connect the SFTP client to the SFTP server based on IPv4.

sftp [ -a source-address | -i interface-type interface-number ] host-ip [ port ] [ [ public-net | -vpn-instance vpn-instance-name ] | [ identity-key { rsa | ecc } ] | [ user-identity-key { rsa | ecc } ] | [ prefer_kex { dh_group1 | dh_exchange_group } ] | [ prefer_ctos_cipher { 3des | aes128 | aes128-ctr | aes192-ctr | aes256-ctr } ] | [ prefer_stoc_cipher { 3des | aes128 | aes128-ctr | aes192-ctr | aes256-ctr } ] | [ prefer_ctos_hmac { sha1 | sha1_96 | md5 | md5_96 | sha2_256 | sha2_256_96 } ] | [ prefer_stoc_hmac { sha1 | sha1_96 | md5 | md5_96 | sha2_256 | sha2_256_96 } ] ] * [ -ki aliveinterval [ -kc alivecountmax ] ]

# Connect the SFTP client to the SFTP server based on IPv6.

sftp ipv6 [ -a source-address ] host-ipv6 [ -oi interface-type interface-number ] [ port ] [ [ -vpn6-instance vpn-instance-name ] | [ identity-key { rsa | ecc } ] | [ user-identity-key { rsa | ecc } ] | [ prefer_kex { dh_group1 | dh_exchange_group } ] | [ prefer_ctos_cipher { 3des | aes128 | aes128-ctr | aes192-ctr | aes256-ctr } ] | [ prefer_stoc_cipher { 3des | aes128 | aes128-ctr | aes192-ctr | aes256-ctr } ] | [ prefer_ctos_hmac { sha1 | sha1_96 | md5 | md5_96 | sha2_256 | sha2_256_96 } ] | [ prefer_stoc_hmac { sha1 | sha1_96 | md5 | md5_96 | sha2_256 | sha2_256_96 } ] ] * [ -ki aliveinterval [ -kc alivecountmax ] ]

Parameters

Parameter Description Value
ipv6

Specifies an IPv6 address.

-
-a source-address Specifies the source IP address for connecting to the SFTP client. You are advised to use the loopback interface IP address. -
-i interface-type interface-number

Specifies the source interface type and ID. You are advised to use the loopback interface.

The IP address configured for this interface is the source IP address for sending packets. If no IP address is configured for the source interface, the SFTP connection cannot be set up.

-
host-ip Specifies the IP address or host name of the remote IPv4 SFTP server.

The value is a string of 1 to 255 case-insensitive characters without spaces. When quotation marks are used around the string, spaces are allowed in the string.

host-ipv6 Specifies the IPv6 address or host name of the remote IPv6 SFTP server. The value is a string of 1 to 255 case-insensitive characters without spaces. When quotation marks are used around the string, spaces are allowed in the string.
-oi interface-type interface-number

Specifies an outbound interface on the local device.

If the remote host uses an IPv6 address, you must specify the outbound interface on the local device.

-
port

Specifies the port number of the SSH server.

The value is an integer that ranges from ranges from 1 to 65535. The default port number is 22.
public-net

Specifies the SFTP server on the public network.

You must set the public-net parameter when the SFTP server IP address is a public network IP address.

-
-vpn-instance vpn-instance-name

Name of the VPN instance where the IPv4 SFTP server is located.

The value is a string of 1 to 31 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.
-vpn6-instance vpn-instance-name

Name of the VPN instance where the IPv6 SFTP server is located.

The value is a string of 1 to 31 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.
identity-key Specifies the public key for server authentication. The public key algorithm include RSA and ECC.
user-identity-key Specifies the public key algorithm for the client authentication. The public key algorithm include RSA and ECC.
prefer_kex

Specifies the preferred key exchange algorithm. The dh_group1 and dh_exchange_group algorithms are supported currently.

The default key exchange algorithm is dh_group1.

prefer_ctos_cipher Specify an encryption algorithm for transmitting data from the client to the server.

Encryption algorithms 3des, aes128, aes128-ctr, aes192-ctr, and aes256-ctr are supported currently.

The default encryption algorithm is aes128.

prefer_stoc_cipher Specify an encryption algorithm for transmitting data from the server to the client.

Encryption algorithms 3des, aes128, aes128-ctr, aes192-ctr, and aes256-ctr are supported currently.

The default encryption algorithm is aes128.

prefer_ctos_hmac Specify an HMAC algorithm for transmitting data from the client to the server.

HMAC algorithms sha1, sha1_96, md5, sha2_256, sha2_256_96, and md5_96 are supported. The default HMAC algorithm is sha1_96.

prefer_stoc_hmac Specify an HMAC algorithm for transmitting data from the server to the client.

HMAC algorithms sha1, sha1_96, md5, sha2_256, sha2_256_96, and md5_96 are supported. The default HMAC algorithm is sha1_96.

-ki aliveinterval Specifies the interval for sending keepalive packets when no packet is received in reply. The value is an integer that ranges from 1 to 3600, in seconds.
-kc alivecountmax Specifies the times for sending keepalive packets when no packet is received in reply. The value is an integer that ranges from 3 to 10. The default value is 5.

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

SFTP is short for SSH FTP that is a secure FTP protocol. SFTP is on the basis of SSH. It ensures that users can log in to a remote device securely for file management and transmission, and enhances the security in data transmission. In addition, you can log in to a remote SSH server from the device that functions as an SFTP client.

When the connection between the SFTP server and client fails, the SFTP client must detect the fault in time and disconnect from the SFTP server. To ensure this, before being connected to the server in SFTP mode, the client must be configured with the interval and times for sending the keepalive packet when no packet is received in reply. If the client receives no packet in reply within the specified interval, the client sends the keepalive packet to the server again. If the maximum number of times that the client sends keepalive packets exceeds the specified value, the client releases the connection. By default, when no packet is received, the function for sending keepalive packets is not enabled.

Precautions

  • You can set the source IP address to the source or destination IP address in the ACL rule when the -a or -i parameter is specified. This shields the IP address differences and interface status impact, filters incoming and outgoing packets, and implements security authentication.
  • The SSH client can log in to the SSH server with no port number specified only when the port number of the SSH server is 22. If the SSH server uses another port, the port number must be specified when SSH clients log in to the SSH server.

  • You can run the set net-manager vpn-instance command to configure the NMS management VPN instance before running the open command to connect the FTP client and server.
    • If public-net or vpn-instance is not specified, the FTP client accesses the FTP server in the VPN instance managed by the NMS.

    • If public-net is specified, the FTP client accesses the FTP server on the public network.

    • If vpn-instance vpn-instance-name is specified, the FTP client accesses the FTP server in a specified VPN instance.

  • If you cannot run the sftp command successfully when you configured the ACL on the SFTP client, or when the TCP connection fails, an error message is displayed indicating that the SFTP client cannot be connected to the server.

  • 3DES, MD5, MD5_96, SHA1, and SHA1_96 encryption algorithm cannot ensure security. AES128, AES128-CTR, AES192-CTR sha2_256, sha2_256_96 or AES256-CTR encryption algorithm is recommended.

Example

# Set the current listening port number of the SSH server to 1025, and specify the SFTP client on the public network and the SSH server on the private network.

<Huawei> system-view
[Huawei] sftp 10.164.39.223 1025 -vpn-instance ssh
Please input the username: client001
Trying 10.164.39.223 ...
Press CTRL+K to abort
Enter password:
sftp-client>

# Set keepalive parameters when the client is connected to the server in SFTP mode.

<Huawei> system-view
[Huawei] sftp 10.164.39.223 -ki 10 -kc 4
Please input the username: client001
Trying 10.164.39.223 ...
Press CTRL+K to abort
Enter password:
sftp-client>

sftp client-source

Function

The sftp client-source command specifies the source IP address for the SFTP client to send packets.

The undo sftp client-source command restores the default source IP address for the SFTP client to send packets.

The default source IP address for the SFTP client to send packets is 0.0.0.0.

Format

sftp client-source { -a source-ip-address | -i interface-type interface-number }

undo sftp client-source

Parameters

Parameter Description Value
-a source-ip-address

Specifies the source IP address. You are advised to use the loopback interface IP address.

The value is in dotted decimal notation.
-i interface-type interface-number

Specifies the source interface. You are advised to use the loopback interface.

The IP address configured for the source interface is the source IP address for sending packets. If no IP address is configured for the source interface, the FTP connection cannot be set up.

-

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

If no source IP address is specified, the client uses the source IP address that the router specifies to send packets. The source IP address must be configured for an interface with stable performance. The loopback interface is recommended. Using the loopback interface as the source interface simplifies the ACL rule and security policy configuration. This shields the IP address differences and interface status impact, filters incoming and outgoing packets, and implements security authentication.

Precautions

  • You can query the source IP address or primary IP address of the source interface for the SFTP connection on the SFTP server.

  • The sftp command also configures the source IP address whose priority is higher than that of the source IP address specified in the sftp client-source command. If you specify source addresses in the sftp client-source and sftp commands, the source IP address specified in the sftp command is used for data communication. The source address specified in the sftp client-source command applies to all SFTP connections. The source address specified in the sftp command applies only to the current SFTP connection.

  • If the specified source interface has been bound to a VPN instance, the client is automatically bound to the same VPN instance.

Example

# Set the source IP address of the SFTP client to 10.1.1.1.

<Huawei> system-view
[Huawei] sftp client-source -a 10.1.1.1
Info: Succeeded in setting the source address of the SFTP client to 10.1.1.1.

sftp server enable

Function

The sftp server enable command enables the SFTP service on the SSH server.

The undo sftp server enable command disables the SFTP service on the SSH server.

By default, the SFTP service is disabled.

Format

sftp server enable

undo sftp server enable

Parameters

None

Views

System view

Default Level

3: Management level

Usage Guidelines

To connect the client to the SSH server to transfer files in SFTP mode, you must first enable the SFTP server on the SSH server.

Example

# Enable the SFTP service.

<Huawei> system-view
[Huawei] sftp server enable
Info: Succeeded in starting the SFTP server.

# Disable the SFTP service.

<Huawei> system-view
[Huawei] undo sftp server enable
Info: Succeeded in closing the SFTP server.
Related Topics

tftp

Function

The tftp command uploads a file to the TFTP server or downloads a file to the local device.

Format

# Upload a file to the TFTP server or download a file to the local device based on the IPv4 address

tftp [ -a source-ip-address | -i interface-type interface-number ] tftp-server [ public-net | vpn-instance vpn-instance-name ] { get | put } source-filename [ destination-filename ]

# Upload a file to the TFTP server or download a file to the local device based on the IPv6 address

tftp ipv6 [ -a source-ip-address ] tftp-server-ipv6 [ -oi interface-type interface-number ] [ vpn6-instance vpn6-instance-name ] { get | put } source-filename [ destination-filename ]

Parameters

Parameter Description Value
-a source-ip-address Specifies the source IP address for connecting to the TFTP client. You are advised to use the loopback interface IP address.

-

-i interface-type interface-number

Specifies the source interface used by the TFTP client to set up connections. It consists of the interface type and number. It is recommended that you specify a loopback interface.

The IP address configured for this interface is the source IP address for sending packets. If no IP address is configured for the source interface, the TFTP connection cannot be set up.

-
-oi interface-type interface-number

Specifies an outbound interface on the local device.

If the remote host uses an IPv6 address, you must specify the outbound interface on the local device.
tftp-server Specifies the IPv4 address or host name for the TFTP server.

The value is a string of 1 to 255 case-insensitive characters without spaces.

tftp-server-ipv6

Specifies the IPv6 address of the IPv6 TFTP server.

The value is a string of 1 to 255 case-insensitive characters without spaces.

public-net Specifies the TFTP server on the public network. -
vpn-instance vpn-instance-name

Name of the VPN instance where the IPv4 TFTP server is located.

The value is a string of 1 to 31 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.
vpn6-instance vpn6-instance-name

Name of the VPN instance where the IPv6 TFTP server is located.

The value is a string of 1 to 31 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.
get Download a file. -
put Upload a file. -
source-filename Specifies the source file name. The value is a string of 1 to 64 case-insensitive characters without spaces.
destination-filename Specifies the destination file nameand the directory. The value is a string of 1 to 64 case-insensitive characters without spaces.In the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string. In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory. You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name. By default, source and destination file names are the same.

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

When upgrading the system, you can run the tftp command to upload an important file to the TFTP server or download a system software to the local device.

Precautions

  • When you run the tftp command to upload a file to the TFTP server in TFTP mode, files are transferred in binary mode by default. The tftp does not support the ASCII mode for file transfer.
  • After specifying a source IP address, you can use this IP address to communicate with the server and implement packet filtering to ensure data security.
  • You can run the set net-manager vpn-instance command to configure the NMS management VPN instance before running the open command to connect the FTP client and server.
    • If public-net or vpn-instance is not specified, the FTP client accesses the FTP server in the VPN instance managed by the NMS.

    • If public-net is specified, the FTP client accesses the FTP server on the public network.

    • If vpn-instance vpn-instance-name is specified, the FTP client accesses the FTP server in a specified VPN instance.

Example

# Download file vrpcfg.txt from the root directory of the TFTP server to the local device. The IP address of the TFTP server is 10.1.1.1. Save the downloaded file to the local device as file vrpcfg.bak.

<Huawei> tftp 10.1.1.1 get vrpcfg.txt flash:/vrpcfg.bak

# Upload file vrpcfg.txt from the root directory of the storage device to the default directory of the TFTP server. The IP address of the TFTP server is 10.1.1.1. Save file vrpcfg.txt on the TFTP server as file vrpcfg.bak.

<Huawei> tftp 10.1.1.1 put flash:/vrpcfg.txt vrpcfg.bak

# Obtain the link local IP address and interface name from the TFTP server.

<Huawei> tftp ipv6 fc00::1 -oi gigabitethernet 1/0/0 get file1 file2
Related Topics

tftp client-source

Function

The tftp client-source command specifies the source IP address for the TFTP client to send packets.

The undo tftp client-source command restores the default source IP address for the TFTP client to send packets.

The default source IP address for the TFTP client to send packets is 0.0.0.0.

Format

tftp client-source { -a source-ip-address | -i interface-type interface-number }

undo tftp client-source

Parameters

Parameter Description Value
-a source-ip-address

Specifies the source IP address of the TFTP client. You are advised to use the loopback interface IP address.

The value is in dotted decimal notation.
-i interface-type interface-number

Source interface type and ID. You are advised to use the loopback interface.

The IP address configured for this interface is the source IP address for sending packets. If no IP address is configured for the source interface, the TFTP connection cannot be set up.

-

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

If no source IP address is specified, the client uses the source IP address that the router specifies to send packets. The source IP address must be configured for an interface with stable performance. The loopback interface is recommended. Using the loopback interface as the source interface simplifies the ACL rule and security policy configuration. This shields the IP address differences and interface status impact, filters incoming and outgoing packets, and implements security authentication.

Precautions

  • The tftp command also configures the source IP address whose priority is higher than that of the source IP address specified in the tftp client-source command. If you specify source addresses in the tftp client-source and tftp commands, the source IP address specified in the tftp command is used for data communication. The source address specified in the tftp client-source command applies to all TFTP connections. The source address specified in the tftp command applies only to the current TFTP connection.

  • You can query the source IP address or source interface IP address specified in the TFTP connection on the TFTP server.

Example

# Set the source IP address of the TFTP client to 10.1.1.1.

<Huawei> system-view
[Huawei] tftp client-source -a 10.1.1.1
Info: Succeeded in setting the source address of the TFTP client to 10.1.1.1.

tftp-server acl

Function

The tftp-server acl command specifies the ACL number for the local device so that the device can access TFTP servers with the same ACL number.

The undo tftp-server acl command deletes the ACL number from the local device.

By default, no ACL number is specified on the local client.

Format

tftp-server acl acl-number

undo tftp-server acl

Parameters

Parameter Description Value
acl-number Specifies the number of the basic ACL. The value is an integer that ranges from 2000 to 2999.

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

To ensure the security of the local device, you need to run the tftp-server acl command to specify an ACL to specify TFTP servers that the local device can access.

Precautions

  • The tftp-server acl command takes effect only after you run the rule command to configure the ACL rule. If no ACL rule is configured, the local device can access a specified TFTP server in TFTP mode.
  • The TFTP supports only the basic ACL whose number ranges from 2000 to 2999.

Example

# Allow the local device to the access the TFTP server whose ACL number is 2000.

<Huawei> system-view
[Huawei] acl 2000
[Huawei-acl-basic-2000] rule permit source 10.10.10.1 0
[Huawei-acl-basic-2000] quit
[Huawei] tftp-server acl 2000
Related Topics

tftp server enable

Function

The tftp server enable command enables the TFTP server function on the device.

The undo tftp server enable command disables the TFTP server function on the device.

By default, the TFTP server function is disabled.

Format

tftp server enable

undo tftp server enable

Parameters

None

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

To allow a local client to remotely manage files on the device using TFTP, you must run this command to enable the TFTP server function on the device.

NOTE:

The TFTP protocol has security risks; therefore, SFTPv2 is recommended for file management.

Prerequisite

The TFTP working directory has been configured by running the set default tftp-directory directory command.

Example

# Enable the TFTP server function.

<Huawei> system-view
[Huawei] set default tftp-directory flash:
[Huawei] tftp server enable

tftp server port

Function

The tftp server port command configures the port number of the TFTP server.

The undo tftp server port command restores the default port number of the TFTP server.

By default, the port number of the TFTP server is 69.

Format

tftp server port port-number

undo tftp server port

Parameters

Parameter Description Value
port-number Specifies the port number of the TFTP server. The value is an integer that ranges from 69 or 1025 to 55535. The default value is 69.

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

By default, the port number of the TFTP server is 69. Users can directly log in to the device using the default port number. Attackers may access the default port, consuming bandwidth, deteriorating server performance, and causing authorized users unable to access the server. You can run this command to configure another port number for the TFTP server. This can prevent attacks to the TFTP server because attackers cannot obtain the newly configured port number.

Prerequisite

The TFTP service has been disabled by running the undo tftp server enable command.

Precautions

  • When the port number of the TFTP server is 69, a TFTP client can connect to the TFTP server without the need to specify a port number. When the port number of the TFTP server is not 69, you need to specify a port number for the TFTP client before it can connect to the TFTP server, and the specified client port number must be the same as the server port number.

  • After running this command to configure a new port number, you must run the tftp server enable command to enable the TFTP server before the modified port number takes effect.

Example

# Set the port number of the TFTP server to 1028.
<Huawei> system-view
[Huawei] tftp server port 1028
Related Topics

tftp server timeout

Function

The tftp server timeout command configures a packet timeout period for a TFTP server.

The undo tftp server timeout command restores the default packet timeout period for a TFTP server.

By default, the packet timeout period of a TFTP server is 5 seconds.

Format

tftp server timeout timeout-second

undo tftp server timeout

Parameters

Parameter Description Value
timeout-second Specifies the packet timeout period of a TFTP server. The value an integer that ranges from 1 to 300, in seconds. The default value is 5s.

Views

System view

Default Level

3: Management level

Usage Guidelines

If the server does not receive any response within 5 seconds after sending a packet to a client, it considers that the packet times out. The TFTP server will resend a packet twice. If the packet times out three times, the TFTP server disconnects the TFTP connection.

Example

# Set the packet timeout period of a TFTP server to 10s.

<Huawei> system-view
[Huawei] tftp server timeout 10
Related Topics

undelete

Function

The undelete command restores a file that has been has been temporally deleted and moved to the recycle bin.

Format

undelete { filename | devicename }

Parameters

Parameter Description Value
filename Specifies the name of a file to be restored.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

devicename Specifies the storage device name.

-

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

You can run the undelete command to restore a file that has been temporally deleted and moved to the recycle bin. However, files that are permanently deleted by running the delete or reset recycle-bin command with the /unreserved parameter cannot be restored.

The following describes the drive name.

  • drive is the storage device and is named as flash:.

The path can be an absolute path or relative path.
  • flash:/my/test/ is an absolute path.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

Like devicename, drive specifies the storage device name.

Precautions

  • To display information about a temporally deleted file, run the dir /all command. The file name is displayed in square brackets ([ ]).

  • If the name of a file is the same as an existing directory, the file cannot be restored. If the destination file has the same name as an existing file, the system prompts you whether to overwrite the existing file. The system prompt is displayed only when file prompt is set to alert.

Example

# Restore file sample.bak from the recycle bin.

<Huawei> undelete sample.bak
Undelete flash:/sample.bak ?(y/n)[n]:y
Info: Undeleted file flash:/sample.bak.

# Restore a file that has been moved from the root directory to the recycle bin.

<Huawei> undelete flash:
Undelete flash:/test.txt?(y/n)[n]:y
Info: Undeleted file flash:/test.txt.
Undelete flash:/rr.bak?(y/n)[n]:y
Info: Undeleted file flash:/rr.bak.

unzip

Function

The unzip command decompresses a file.

Format

unzip source-filename destination-filename

Parameters

Parameter Description Value
source-filename Specifies the name of a source file to be decompressed.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

destination-filename Specifies the name of a destination file that is decompressed.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

You can decompress files, especially log files that are stored on the storage device and run the more command to query the file.

The following describes the drive name.

  • drive is the storage device and is named as flash:.

The path can be an absolute path or relative path.
  • flash:/my/test/ is an absolute path.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

Precautions

  • If the destination file path is specified while the file name is not specified, the designation file name is the same as the source file name.

  • The source file persists after being decompressed.

  • The compressed file must be a .zip file. If a file to be decompressed is not a zip file, the system displays an error message during decompression.

  • The source file must be a single file. If you attempt to decompress a directory or mutiple files, the decompression cannot succeed.

Example

# Decompress log file syslogfile-2012-02-27-17-47-50.zip that are stored in the syslogfile directory and save it to the root directory as file log.txt.

<Huawei> pwd
flash:/syslogfile
<Huawei> unzip syslogfile-2012-02-27-17-47-50.zip flash:/log.txt
Info: Extract flash:/syslogfile/syslogfile-2012-02-27-17-47-50.zip to flash:/log.txt?(y/n)[n]:y
100%  complete
Info: Decompressed file flash:/syslogfile/syslogfile-2012-02-27-17-47-50.zip flash:/log.txt. 

user

Function

The user command changes the current FTP user when the local device is connected to the FTP server.

Format

user user-name [ password ]

Parameters

Parameter Description Value
user-name Specifies the name of a login user. The value is a string of 1 to 64 case-insensitive characters without space.
password Specifies the login password. The value is a string of 1 to 16 case-sensitive characters without space, single quotation mark, or question mark.

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

You can run the user command to change the current user on the FTP server.

Precautions

After you run the user command to change the current user, a new FTP connection is set up, which is the same as that you specify in the ftp command.

Example

# Log in to the FTP server using the user name tom.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] user tom
331 Password required for tom.
Enter password: 
230 User logged in.
Related Topics

verbose

Function

The verbose command enables the verbose function on the FTP client.

The undo verbose command disables the verbose function.

By default, the verbose function is enabled.

Format

verbose

undo verbose

Parameters

None

Views

FTP client view

Default Level

3: Management level

Usage Guidelines

After the verbose function is enabled, all FTP response messages are displayed on the FTP client.

Example

# Enable the verbose function.

<Huawei> ftp 10.137.217.201
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201.
220 FTP service ready.
User(10.137.217.201:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. 
[Huawei-ftp] verbose
Info: Succeeded in switching verbose on.
[Huawei-ftp] get h1.txt
200 Port command okay.
150 Opening ASCII mode data connection for h1.txt.

226 Transfer complete.
FTP: 69 byte(s) received in 0.160 second(s) 431.25byte(s)/sec.
                                                             

# Disable the verbose function.

[Huawei-ftp] undo verbose
Info: Succeeded in switching verbose off.
[Huawei-ftp] get h1.txt

FTP: 69 byte(s) received in 0.150 second(s) 460.00byte(s)/sec. 

zip

Function

The zip command compresses a file.

Format

zip source-filename destination-filename

Parameters

Parameter Description Value
source-filename Specifies the name of a source file to be compressed.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

destination-filename Specifies the name of a destination file that is compressed.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] file name format. When quotation marks are used around the string, spaces are allowed in the string.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. Characters ~, *, /, \, :, ', " cannot be used in the directory name.

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The following describes the drive name.

  • drive is the storage device and is named as flash:.

The path can be an absolute path or relative path.
  • flash:/my/test/ is an absolute path.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

Precautions

  • If the destination file path is specified while the file name is not specified, the designation file name is the same as the source file name.

  • The source file persists after being compressed.

  • Directories cannot be compressed.

Example

# Compress file log.txt that is stored in the root directory and save it to the test directory as file log.zip.

<Huawei> dir
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName
    0  -rw-            155  Dec 02 2011 01:28:48   log.txt
    1  -rw-          9,870  Oct 01 2011 00:22:46   patch.pat
    2  drw-              -  Mar 22 2012 00:00:48   test
    3  -rw-            836  Dec 22 2011 16:55:46   rr.dat
...

1,927,220 KB total (1,130,464 KB free)
<Huawei> zip log.txt flash:/test/log.zip
Info: Zip flash:/log.txt flash:/test/log.zip? (y/n)[n]:y
100%  complete
Info: Compressed file flash:/log.txt flash:/test/log.zip.
<Huawei> cd test 
<Huawei> dir 
Directory of flash:/test/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName
    0  -rw-            836  Mar 20 2012 19:49:14   test
    1  -rw-            239  Mar 22 2012 20:57:38   test.txt
    2  -rw-          1,056  Dec 02 2011 01:28:48   log.txt
    3  -rw-            240  Mar 22 2012 21:23:46   log.zip

1,927,220 KB total (1,130,463 KB free)
Related Topics
Translation
Download
Updated: 2019-05-29

Document ID: EDOC1000097293

Views: 52305

Downloads: 102

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next