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

CLI-based Configuration Guide - Basic Configuration

AR500, AR510, AR531, AR550, AR1500, and AR2500 V200R010

This document provides the basic concepts, configuration procedures, and configuration examples in different application scenarios of the Basic configuration supported by the device.
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).
Managing Files When the Device Functions as an FTP Client

Managing Files When the Device Functions as an FTP Client

The device functions as an FTP client and connects to an FTP server remotely to transfer files and manage files and directories on the FTP server.

Pre-configuration Tasks

Before connecting to a device as an FTP client to manage files, complete the following tasks:

  • Ensure that routes are reachable between the current device and the FTP server.
  • Obtain the host name or IP address of the FTP server, FTP user name, and password.
  • Obtain the listening port number of the FTP server if the default listening port number is not used.

Configuration Process

The FTP protocol will bring risk to device security. The SFTPv2 mode is recommended.

Table 11-23 describes the procedure for managing files when the device functions as an FTP client.

Table 11-23  Procedure for managing files when the device functions as an FTP client
No. Task Description Remarks
1 (Optional) Configure the FTP client source address

Configure the FTP client source address. To ensure communication security, the source address can be set to a source IP address or source interface.

Perform steps 1 and 2 in sequence. After the FTP connection is established, perform steps 3 and 4 in any sequence. To disconnect from the FTP server, perform step 5.
2 Run FTP commands to connect to the FTP server

-

3 Run FTP commands to perform file-related operations

Run FTP commands to perform file-related operations including performing operations on directories and files, configuring the file transfer mode, and viewing the online help about FTP commands.

4 (Optional) Change the login user

-

5 Disconnect the FTP client from the FTP server

-

Procedure

  • (Optional) Configure the FTP client source address.

    When you specify the source address in an ACL, use the address of an interface in stable state, for example, a loopback interface. This simplifies the ACL rule and security policy configuration. After the client source address is configured as the source or destination address in the ACL rule, IP address differences and interface status impact are shielded, and incoming and outgoing packets are filtered.

    The FTP client source address must be set to the loopback interface IP address or loopback interface.

    Table 11-24  Configuring the FTP client source address
    Operation Command Description
    Enter the system view. system-view -
    Configure the FTP client source address. ftp client-source { -a source-ip-address | -i interface-type interface-number }

    You are advised to use the loopback interface IP address.

    When the FTP client source address is set to loopback interface, configure an IP address for the loopback interface for establishing FTP connections.

  • Run FTP commands to connect to the FTP server.

    Run the corresponding command in the user view or FTP client view to connect to the FTP server.

    Perform the following operations based on the server IP address types.

    Table 11-25  Running FTP commands to connect to the FTP server (with an IPv4 address)
    Operation Command Description

    Connect to the FTP server in the user view when the server uses an IPv4 address.

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

    Select one of them.

    To enter the FTP client view, run the ftp command.

    Connect to the FTP server in the FTP client view when the server uses an IPv4 address.

    ftp
    open [ -a source-ip-address | -i interface-type interface-number ] host-ip [ port-number ] [ public-net | vpn-instance vpn-instance-name ]
    NOTE:
    • Before connecting to the FTP server, run the set net-manager vpn-instance command to set the VPN instance to the default VPN instance.

    • The source address specified in the ftp command has a higher priority than that specified in the ftp client-source command on an IPv4 network. If you specify different source addresses in the ftp client-source and ftp commands, the source address specified in the ftp command takes effect. The source address specified in the ftp client-source command applies to all TFTP connections. The source address specified in the ftp command applies only to the current TFTP connection.

    Table 11-26  Running FTP commands to connect to the FTP server (with an IPv6 address)
    Operation Command Description

    Connect to the FTP server in the user view when the server uses an IPv6 address.

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

    Select one of them.

    To enter the FTP client view, run the ftp command.

    Connect to the FTP server in the FTP client view when the server uses an IPv6 address.

    ftp
    open ipv6 host-ipv6 [ port-number ]

    Users must enter the correct user name and password to connect to the server.

  • Run FTP commands to perform file-related operations.

    After connecting to the FTP server, users can run FTP commands to perform file-related operations including performing operations on directories and files, configuring the file transfer mode, and viewing the online help about FTP commands.

    NOTE:

    User rights are configured on the FTP server.

    Users can perform the following operations in any sequence.

    Table 11-27  Running FTP commands to perform file-related operations
    Operation Command Description
    Change the working directory on the server. cd remote-directory -
    Change the current working directory to its parent directory. cdup -
    Display the working directory on the server. pwd -
    Display or change the local working directory. lcd [ local-directory ]

    The lcd command displays the local working directory on the client, and the pwd command displays the working directory on the remote server.

    Create a directory on the server. mkdir remote-directory

    The directory name can consist of letters and digits. The following special characters are not supported: < > ? \ :

    Delete a directory from the server. rmdir remote-directory -
    Display information about the specified directory or file on the server. dir/ls [ remote-filename [ local-filename ] ]
    • The ls command displays only the directory or file name, and the dir command displays detailed directory or file information such as name, size, and date when the directory or file is created.
    • If no directory is specified in the command, the system searches for the file in user's authorized directories.
    Delete a file from the server. delete remote-filename -

    Upload a file.

    put local-filename [ remote-filename ]

    -

    Download a file.

    get remote-filename [ local-filename ]

    -

    Set the file transfer mode to ASCII. ascii

    Select one of them.

    • The default file transfer mode is ASCII.

    • The ASCII mode is used to transfer text files, and the binary mode is used to transfer programs, system software, and database files.

    Set the file transfer mode to Binary. binary
    Set the data transmission mode to passive. passive

    Select one of them.

    The default data transmission mode is active.

    Set the data transmission mode to active. undo passive
    View the online help about FTP commands. remotehelp [ command ] -
    Enable the verbose function. verbose

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

  • (Optional) Change the login user.

    The current user can switch to another user in the FTP client view. The new FTP connection is the same as that established by running the ftp command.

    Operation Command Description

    Change the current user in the FTP client view.

    user user-name [ password ]

    When the login user is switched to another user, the original user is disconnected from the FTP server.

  • Disconnect the FTP client from the FTP server.

    Users can run different commands in the FTP client view to disconnect the FTP client from the FTP server.

    Operation Command Description

    Disconnect the FTP client from the FTP server and return to the user view.

    bye or quit Select one of them.

    Disconnect the FTP client from the FTP server and return to the FTP client view.

    close or disconnect

Verifying the Configuration

  • Run the display ftp-client command to check source interface of the FTP client.
Translation
Download
Updated: 2019-05-20

Document ID: EDOC1100034225

Views: 44755

Downloads: 100

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