01-Fundamentals Command Reference

HomeSupportResource CenterH3C S6520X & S6520-SI & S5560X-HI & S5000-EI Switch Series Command References-R65xx-6W10001-Fundamentals Command Reference
04-FTP and TFTP commands
Title Size Download
04-FTP and TFTP commands 229.17 KB

FTP commands

The device supports the FIPS mode that complies with NIST FIPS 140-2 requirements. Support for features, commands, and parameters might differ in FIPS mode and non-FIPS mode. For more information about FIPS mode, see Security Configuration Guide.

FTP is not supported in FIPS mode.

FTP server commands

display ftp-server

Use display ftp-server to display FTP server configuration and status information.

Syntax

display ftp-server

Views

Any view

Predefined user roles

network-admin

network-operator

Examples

# Display FTP server configuration and status information.

<Sysname> display ftp-server

FTP server is running.

User count:                        1

Idle-timeout timer (in minutes):  30

Table 1 Command output

Field

Description

User count

Number of the current logged-in users.

Idle-timeout timer (in minutes)

If no packet is exchanged between the FTP server and client during this period, the FTP connection is closed.

Related commands

ftp server enable

ftp timeout

display ftp-user

Use display ftp-user to display detailed information about online FTP users.

Syntax

display ftp-user

Views

Any view

Predefined user roles

network-admin

network-operator

Examples

# Display detailed information about online FTP users.

<Sysname> display ftp-user

UserName     HostIP             Port     HomeDir

root         192.168.20.184     46539    flash:

A field value is wrapped if its length exceeds the limit. The segments are left justified.

The following are the length limits for fields:

·     UserName—10 characters.

·     HostIP—15 characters.

·     HomeDir—37 characters.

<Sysname> display ftp-user

UserName     HostIP             Port     HomeDir

user2        2000:2000:2000:    1499     flash:/user2

             2000:2000:2000:

             2000:2000    

administra   100.100.100.100    10001    flash:/123456789/123456789/123456789/

tor                                      123456789/123456789/123456789/1234567

                                         89/123456789                        

Table 2 Command output

Field

Description

UserName

Name of the user.

HostIP

IP address of the user.

Port

Port number of the user.

HomeDir

Authorized directory for the user.

free ftp user

Use free ftp user to manually release the FTP connections established by using a specific user account.

Syntax

free ftp user username

Views

User view

Predefined user roles

network-admin

Parameters

username: Specifies a username. To display online FTP users, execute the display ftp-user command.

Examples

# Release the FTP connections established by using user account ftpuser.

<Sysname> free ftp user ftpuser

Are you sure to free FTP connection? [Y/N]:y

<Sysname>

free ftp user-ip

Use free ftp user-ip to manually release the FTP connections established from a specific IPv4 address.

Syntax

free ftp user-ip ip-address [ port port ]

Views

User view

Predefined user roles

network-admin

Parameters

ip-address: Specifies the source IP address of an FTP connection. To view the source IP addresses of FTP connections, execute the display ftp-user command.

port port: Specifies the source port of an FTP connection. To view the source ports of FTP connections, execute the display ftp-user command.

Examples

# Release the FTP connections established from the IP address 192.168.20.184.

<Sysname> free ftp user-ip 192.168.20.184

Are you sure to free FTP connection? [Y/N]:y

<Sysname>

free ftp user-ip ipv6

Use free ftp user-ip ipv6 to manually release the FTP connections established from a specific IPv6 address.

Syntax

free ftp user-ip ipv6 ipv6-address [ port port ]

Views

User view

Predefined user roles

network-admin

Parameters

ipv6-address: Specifies the source IPv6 address of an FTP connection. To view the source IPv6 addresses of FTP connections, execute the display ftp-user command.

port port: Specifies the source port of an FTP connection. To view the source ports of FTP connections, execute the display ftp-user command.

Examples

# Release the FTP connections established from IPv6 address 2000::154.

<Sysname> free ftp user-ip ipv6 2000::154

Are you sure to free FTP connection? [Y/N]:y

<Sysname>

ftp server acl

Use ftp server acl to use an ACL to control FTP clients' access to the FTP server.

Use undo ftp server acl to restore the default.

Syntax

ftp server acl { advanced-acl-number | basic-acl-number | ipv6 { advanced-acl-number | basic-acl-number } }

undo ftp server acl [ ipv6 ]

Default

No ACL is used to control FTP clients' access to the FTP server.

Views

System view

Predefined user roles

network-admin

Parameters

advanced-acl-number: Specifies an advanced IPv4 ACL number in the range of 3000 to 3999.

basic-acl-number: Specifies a basic IPv4 ACL number in the range of 2000 to 2999.

ipv6 advanced-acl-number: Specifies an advanced IPv6 ACL number in the range of 3000 to 3999.

ipv6 basic-acl-number: Specifies a basic IPv6 ACL number in the range of 2000 to 2999.

Usage guidelines

You can use this command to permit only FTP requests from specific FTP clients. This configuration takes effect only for FTP connections to be established. It does not impact existing FTP connections.

If you execute this command multiple times, the most recent configuration takes effect.

Examples

# Use ACL 2001 to allow only client 1.1.1.1 to access the FTP server.

<Sysname> system-view

[Sysname] acl basic 2001

[Sysname-acl-ipv4-basic-2001] rule 0 permit source 1.1.1.1 0

[Sysname-acl-ipv4-basic-2001] rule 1 deny source any

[Sysname-acl-ipv4-basic-2001] quit

[Sysname] ftp server acl 2001

ftp server acl-deny-log enable

Use ftp server acl-deny-log enable to enable logging for FTP login attempts that are denied by the FTP login control ACL.

Use undo ftp server acl-deny-log enable to disable logging for FTP login attempts that are denied by the FTP login control ACL.

Syntax

ftp server acl-deny-log enable

undo ftp server acl-deny-log enable

Default

Logging is disabled for FTP login attempts that are denied by the FTP login control ACL.

Views

System view

Predefined user roles

network-admin

Usage guidelines

Only clients permitted by the FTP login control ACL can use FTP to access the device. This logging feature generates log messages for FTP login attempts that are denied by the FTP login control ACL.

For information about log message output, see the information center in Network Management and Monitoring Configuration Guide. For information about configuring an FTP login control ACL, see the ftp server acl command.

Examples

# Enable logging for FTP login attempts that are denied by the FTP login control ACL.

<Sysname> system-view

[Sysname] FTP server acl-deny-log enable

Related commands

ftp server acl

ftp server dscp

Use ftp server dscp to set the DSCP value for IPv4 to use for FTP packets sent to an FTP client.

Use undo ftp server dscp to restore the default.

Syntax

ftp server dscp dscp-value

undo ftp server dscp

Default

IPv4 uses the DSCP value 0 for FTP packets sent to an FTP client.

Views

System view

Predefined user roles

network-admin

Parameters

dscp-value: Specifies a DSCP value in the range of 0 to 63.

Usage guidelines

The DSCP value is carried in the ToS field of an IP packet to indicate the transmission priority of the packet.

Examples

# Set the DSCP value for IPv4 to use for outgoing FTP packets to 30 on an FTP server.

<Sysname> system-view

[Sysname] ftp server dscp 30

ftp server enable

Use ftp server enable to enable the FTP server.

Use undo ftp server enable to disable the FTP server.

Syntax

ftp server enable

undo ftp server enable

Default

The FTP server is disabled.

Views

System view

Predefined user roles

network-admin

Examples

# Enable the FTP server.

<Sysname> system-view

[Sysname] ftp server enable

ftp server ipv6 dscp

Use ftp server ipv6 dscp to set the DSCP value for IPv6 to use for FTP packets sent to an FTP client.

Use undo ftp server ipv6 dscp to restore the default.

Syntax

ftp server ipv6 dscp dscp-value

undo ftp server ipv6 dscp

Default

IPv6 uses the DSCP value 0 for FTP packets sent to an FTP client.

Views

System view

Predefined user roles

network-admin

Parameters

dscp-value: Specifies a DSCP value in the range of 0 to 63.

Usage guidelines

The DSCP value is carried in the Traffic class field of an IPv6 packet to indicate the transmission priority of the packet.

Examples

# Set the DSCP value for IPv6 to use for outgoing FTP packets to 30 on an FTP server.

<Sysname> system-view

[Sysname] ftp server ipv6 dscp 30

ftp server ssl-server-policy

Use ftp server ssl-server-policy to associate an SSL server policy with the FTP server.

Use undo ftp server ssl-server-policy to restore the default.

Syntax

ftp server ssl-server-policy policy-name

undo ftp server ssl-server-policy

Default

No SSL server policy is associated with the FTP server.

Views

System view

Predefined user roles

network-admin

Parameters

policy-name: Specifies an SSL server policy by its name, a string of 1 to 31 characters.

Usage guidelines

After you associate an SSL server policy with the device, a client that supports SFTP will establish a secure connection to the device to ensure data security.

Examples

# Associate SSL server policy myssl with the FTP server.

<Sysname> system-view

[Sysname] ftp server ssl-server-policy myssl

Related commands

ftp server enable

ssl server-policy (Security Command Reference)

ftp timeout

Use ftp timeout to set the FTP connection idle-timeout timer.

Use undo ftp timeout to restore the default.

Syntax

ftp timeout minute

undo ftp timeout

Default

The FTP connection idle-timeout timer is 30 minutes.

Views

System view

Predefined user roles

network-admin

Parameters

minute: Specifies a time interval in the range of 1 to 35791 minutes.

Usage guidelines

If no data transfer occurs on an FTP connection within the idle-timeout interval, the FTP server closes the FTP connection to release resources.

Examples

# Set the FTP connection idle-timeout timer to 36 minutes.

<Sysname> system-view

[Sysname] ftp timeout 36

FTP client commands

For FTP users to execute FTP client configuration commands, you must configure authorization settings for users on the FTP server. Authorized operations include viewing the files in the working directory, reading/downloading/uploading/renaming/removing files, and creating directories.

The FTP client commands in this section are supported by the device, but whether they can be executed successfully depends on the FTP server.

The output in the examples of this section varies by FTP server type.

?

Use ? to display all commands supported by an FTP client.

Use ? command-name to display the help information for a command.

Syntax

? [ command-name ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

command-name: Specifies a command supported by the FTP client.

Usage guidelines

In FTP client view, entering ? is the same as executing the help command.

Examples

# Display all commands supported by the FTP client.

ftp> ?

Commands may be abbreviated.  Commands are:

 

append          delete          ls              quit            rmdir

ascii           debug           mkdir           reget           status

binary          dir             newer           rstatus         system

bye             disconnect      open            rhelp           user

cd              get             passive         rename          verbose

cdup            help            put             reset           ?

close           lcd             pwd             restart

# Display the help information for the dir command.

ftp> ? dir

dir              list contents of remote directory

Related commands

help

append

Use append to add the content of a file on the FTP client to a file on the FTP server.

Syntax

append localfile [ remotefile ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

localfile: Specifies a file on the FTP client.

remotefile: Specifies a file on the FTP server.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

Examples

# Append the content of the local a.txt file to the b.txt file on the FTP server.

ftp> append a.txt b.txt

227 Entering Passive Mode (192,168,1,84,8,145)

150 Accepted data connection

226 File successfully transferred

1657 bytes sent in 0.000736 seconds (2.15 Mbyte/s)

ascii

Use ascii to set the file transfer mode to ASCII.

Syntax

ascii

Default

The file transfer mode is binary.

Views

FTP client view

Predefined user roles

network-admin

Usage guidelines

You can perform this operation only after you log in to the FTP server.

FTP transfers files in either of the following modes:

·     Binary mode—Transfers non-text files.

·     ASCII mode—Transfers text files.

When the device acts as the FTP server, the transfer mode is determined by the FTP client. When the device acts as the FTP client, you can set the transfer mode. The transfer mode is binary by default.

Examples

# Set the file transfer mode to ASCII.

ftp> ascii

200 TYPE is now ASCII

Related commands

binary

binary

Use binary to set the file transfer mode to binary, which is also called the flow mode.

Syntax

binary

Default

The file transfer mode is binary.

Views

FTP client view

Predefined user roles

network-admin

Usage guidelines

You can perform this operation only after you log in to the FTP server.

FTP transfers files in either of the following modes:

·     Binary mode—Transfers program file or pictures.

·     ASCII mode—Transfers text files.

When the device acts as the FTP server, the transfer mode is determined by the FTP client. When the device acts as the FTP client, you can set the transfer mode. The default transfer mode is binary.

Examples

# Set the file transfer mode to binary.

ftp> binary

200 TYPE is now 8-bit binary

Related commands

ascii

bye

Use bye to terminate the connection to the FTP server and return to user view. If no connection is established between the device and the FTP server, use this command to return to user view.

Syntax

bye

Views

FTP client view

Predefined user roles

network-admin

Examples

# Terminate the connection to the FTP server and return to user view.

ftp> bye

221-Goodbye. You uploaded 2 and downloaded 2 kbytes.

221 Logout.

<Sysname>

Related commands

quit

cd

Use cd to change the current working directory to another directory on the FTP server.

Syntax

cd { directory | .. | / }

Views

FTP client view

Predefined user roles

network-admin

Parameters

directory: Specifies the target directory. If the target directory does not exist, the cd command does not change the current working directory.

..: Specifies the upper directory. Executing the cd .. command is the same as executing the cdup command. If the current working directory is the FTP root directory, the cd .. command does not change the current working directory.

/: Specifies the FTP root directory.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

The directory that can be accessed must be authorized by the FTP server.

Examples

# Change the working directory to the logfile subdirectory of the current directory.

ftp> cd logfile

250 OK. Current directory is /logfile

# Change the working directory to the folder subdirectory of the FTP root directory.

ftp> cd /folder

250 OK. Current directory is /folder

# Change the working directory to the upper directory of the current directory.

ftp> cd ..

250 OK. Current directory is /

# Change the working directory to the FTP root directory.

ftp> cd /

250 OK. Current directory is /

Related commands

cdup

pwd

cdup

Use cdup to enter the upper directory of the FTP server.

Syntax

cdup

Views

FTP client view

Predefined user roles

network-admin

Usage guidelines

You can perform this operation only after you log in to the FTP server.

This command does not change the working directory if the current directory is the FTP root directory.

Examples

# Change the working directory to the upper directory.

ftp> pwd

257 "/ftp/subdir" is your current location

ftp> cdup

250 OK. Current directory is /ftp

ftp> pwd

257 "/ftp" is your current location

Related commands

cd

pwd

close

Use close to terminate the connection to the FTP server without exiting FTP client view.

Syntax

close

Views

FTP client view

Predefined user roles

network-admin

Usage guidelines

You can perform this operation only after you log in to the FTP server.

Examples

# Terminate the connection to the FTP server without exiting the FTP client view.

ftp> close

221-Goodbye. You uploaded 0 and downloaded 0 kbytes.

221 Logout.

ftp>

Related commands

disconnect

debug

Use debug to enable or disable FTP client debugging.

Syntax

debug

Default

FTP client debugging is disabled.

Views

FTP client view

Predefined user roles

network-admin

Usage guidelines

When FTP client debugging is enabled, executing this command disables FTP client debugging.

When FTP client debugging is disabled, executing this command enables FTP client debugging.

Examples

# Enable and then disable FTP client debugging.

ftp> debug

Debugging on (debug=1).

ftp> debug

Debugging off (debug=0).

delete

Use delete to permanently delete a file from the FTP server.

Syntax

delete remotefile

Views

FTP client view

Predefined user roles

network-admin

Parameters

remotefile: Specifies a file on the FTP server.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

To perform this operation, you must have delete permission on the FTP server.

Examples

# Delete the b.txt file.

ftp> delete b.txt

250 Deleted b.txt

dir

Use dir to display or save detailed information about files and directories on the FTP server.

Syntax

dir [ remotefile [ localfile ] ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

remotefile: Specifies a file or directory on the FTP server.

localfile: Specifies the name of the local file used to save the displayed information.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

To display detailed information about the files and subdirectories in the working directory on the FTP server, use the dir command.

To display detailed information about a file or directory on the FTP server, use the dir remotefile command.

To save detailed information about a file or directory on the FTP server to a local file, use the dir remotefile localfile command.

In FTP client view, executing the dir command is the same as executing the ls command.

Examples

# Display detailed information about the files and subdirectories in the working directory on the FTP server.

ftp> dir

150 Connecting to port 50201

-rwxr-xr-x    1 0          0                1481 Jul  7 15:36 a.txt

drwxr-xr-x    2 0          0                8192 Jul  2 14:33 diagfile

drwxr-xr-x    3 0          0                8192 Jul  7 15:21 ftp

drwxr-xr-x    2 0          0                8192 Jul  5 09:15 logfile

drwxr-xr-x    2 0          0                8192 Jul  2 14:33 seclog

-rwxr-xr-x    1 0          0            40808448 Jul  2 14:33 system-a1801.bin

-rwxr-xr-x    1 0          0                3050 Jul  7 12:26 startup.cfg

-rwxr-xr-x    1 0          0               54674 Jul  4 09:24 startup.mdb

-rwxr-xr-x    1 0          0                1481 Jul  7 12:34 x.cfg

226 9 matches total

# Save detailed information about file a.txt to s.txt.

ftp> dir a.txt s.txt

output to local-file: s.txt ? [Y/N]y

150 Connecting to port 50203

226-Glob: a.txt

# Display the content of the file s.txt.

ftp> bye

221-Goodbye. You uploaded 0 and downloaded 2 kbytes.

221 Logout.

<Sysname> more s.txt

-rwxr-xr-x    1 0          0                1481 Jul  7 12:34 a.txt

Related commands

ls

disconnect

Use disconnect to terminate the connection to the FTP server without exiting FTP client view.

Syntax

disconnect

Views

FTP client view

Predefined user roles

network-admin

Usage guidelines

You can perform this operation only after you log in to the FTP server.

Examples

# Terminate the connection to the FTP server without exiting the FTP client view.

ftp> disconnect

221-Goodbye. You uploaded 0 and downloaded 0 kbytes.

221 Logout.

ftp>

Related commands

close

display ftp client source

Use display ftp client source to display the source address settings on the FTP client.

Syntax

display ftp client source

Views

Any view

Predefined user roles

network-admin

network-operator

Examples

# Display the source address settings on the FTP client.

<Sysname> display ftp client source

The source IP address of the FTP client is 1.1.1.1.

ftp

Use ftp to log in to an IPv4 FTP server and enter FTP client view.

Syntax

ftp [ ftp-server [ service-port ] [ vpn-instance vpn-instance-name ] [ dscp dscp-value | source { interface interface-type interface-number | ip source-ip-address } | -d ] * ]

Views

User view

Predefined user roles

network-admin

Parameters

ftp-server: Specifies the IPv4 address or host name of an FTP server. A host name can be a case-insensitive string of 1 to 253 characters. Valid characters for a host name include letters, digits, hyphens (-), underscores (_), and dots (.).

service-port: Specifies the TCP port number of the FTP server, in the range of 0 to 65535. The default is 21.

vpn-instance vpn-instance-name: Specifies the MPLS L3VPN instance to which the FTP server belongs. The vpn-instance-name argument represents the VPN instance name, a case-sensitive string of 1 to 31 characters. If the FTP server belongs to the public network, do not specify this option.

dscp dscp-value: Specifies the DSCP value for IPv4 to use in outgoing FTP packets to indicate the packet transmission priority. The value range is 0 to 63. The default is 0.

source { interface interface-type interface-number | ip source-ip-address }: Specifies the source address used to establish the FTP connection.

·     interface interface-type interface-number: Specifies an interface by its type and number. The device will use the interface's primary IPv4 address as the source address. To establish the FTP connection successfully, make sure the interface is up and has the primary IPv4 address configured.

·     ip source-ip-address: Specifies an IPv4 address. To establish the FTP connection successfully, make sure this address is the IPv4 address of an interface in up state on the device.

-d: Enables FTP client debugging.

Usage guidelines

This command is only applicable to IPv4 networks.

If no parameters are specified, this command enters the FTP client view without logging in to an FTP server.

If the server parameters are specified, you are prompted to enter the username and password for logging in to the FTP server.

Examples

# Log in to FTP server 192.168.0.211. Use 192.168.0.212 as the source IPv4 address for outgoing FTP packets.

<Sysname>ftp 192.168.0.211 source ip 192.168.0.212

Press CTRL+C to abort.

Connected to 192.168.0.211 (192.168.0.211).

220 WFTPD 2.0 service (by Texas Imperial Software) ready for new user

User (192.168.0.211:(none)): abc

331 Give me your password, please

Password:

230 Logged in successfully

Remote system type is MSDOS.

ftp>

# Log in to FTP server 192.168.0.211 and enable FTP client debugging.

<Sysname> ftp 192.168.0.211 –d

Press CTRL+C to abort.

Connected to 192.168.0.211 (192.168.0.211).

220 FTP service ready.

User (192.168.0.211:(none)): abc

*Apr 10 09:02:24:139 2017 Sysname FTPC/7/EVENT: PAM initialization result: 0.

*Apr 10 09:02:24:150 2017 Sysname FTPC/7/EVENT: PAM: Sent a start-accounting request. Result: 0.

*Apr 10 09:02:24:860 2017 Sysname FTPC/7/COMMAND: USER abc

331 Password required for abc.

Password:

*Apr 10 09:02:25:575 2017 Sysname FTPC/7/COMMAND: PASS XXXX

230 User logged in.

215 UNIX Type: L8

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> *Apr 10 09:02:25:640 2017 SIMWARE FTPC/7/COMMAND: SYST

ftp>

ftp client ipv6 source

Use ftp client ipv6 source to specify the source IPv6 address for FTP packets sent to an IPv6 FTP server.

Use undo ftp client ipv6 source to restore the default.

Syntax

ftp client ipv6 source { interface interface-type interface-number | ipv6 source-ipv6-address }

undo ftp client ipv6 source

Default

No source address is specified for FTP packets sent to an IPv6 FTP server. The device selects a source IPv6 address as defined in RFC 3484.

Views

System view

Predefined user roles

network-admin

Parameters

interface interface-type interface-number: Specifies an interface by its type and number. The device will use the interface's IPv6 address as the source address. For successful FTP packet transmission, make sure the interface is up and is configured with an IPv6 address.

ipv6 source-ipv6-address: Specifies an IPv6 address. For successful FTP packet transmission, make sure this address is the IPv6 address of an interface in up state on the device.

Usage guidelines

If you execute this command multiple times, the most recent configuration takes effect.

The source address specified with the ftp ipv6 command takes precedence over the source address specified with the ftp client ipv6 source command.

The source address specified with the ftp client ipv6 source command applies to all FTP connections. The source address specified with the ftp ipv6 command applies only to the FTP connection that is being established.

Examples

# Specify the source IPv6 address of 2000::1 for FTP packets sent to an IPv6 FTP server.

<Sysname> system–view

[Sysname] ftp client ipv6 source ipv6 2000::1

Related commands

ftp ipv6

ftp client source

Use ftp client source to specify the source IPv4 address for FTP packets sent to an IPv4 FTP server.

Use undo ftp client source to restore the default.

Syntax

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

undo ftp client source

Default

No source IPv4 address is specified for FTP packets sent to an IPv4 FTP server. The device uses the primary IPv4 address of the output interface for the route to the server as the source address.

Views

System view

Predefined user roles

network-admin

Parameters

interface interface-type interface-number: Specifies an interface by its type and number. The device will use the interface's primary IPv4 address as the source address. For successful FTP packet transmission, make sure the interface is up and has the primary IPv4 address configured.

ip source-ip-address: Specifies an IPv4 address. For successful FTP packet transmission, make sure this address is the IPv4 address of an interface in up state on the device.

Usage guidelines

If you execute this command multiple times, the most recent configuration takes effect.

The source address specified with the ftp command takes precedence over the source address specified with the ftp client source command.

The source address specified with the ftp client source command applies to all FTP connections. The source address specified with the ftp command applies only to the FTP connection that is being established.

Examples

# Specify the source IPv4 address of 192.168.20.222 for FTP packets sent to an IPv4 FTP server.

<Sysname> system-view

[Sysname] ftp client source ip 192.168.20.222

Related commands

ftp

ftp ipv6

Use ftp ipv6 to log in to an IPv6 FTP server and enter FTP client view.

Syntax

ftp ipv6 [ ftp-server [ service-port ] [ vpn-instance vpn-instance-name ] [ dscp dscp-value | source { ipv6 source-ipv6-address | interface interface-type interface-number } | -d ] * [ -i interface-type interface-number ] ]

Views

User view

Predefined user roles

network-admin

Parameters

ftp-server: Specifies the IPv6 address or host name of an FTP server. A host name can be a case-insensitive string of 1 to 253 characters. Valid characters for a host name include letters, digits, hyphens (-), underscores (_), and dots (.).

service-port: Specifies the TCP port number of the FTP server, in the range of 0 to 65535. The default is 21.

dscp dscp-value: Specifies the DSCP value for IPv6 to use in outgoing FTP packets to indicate the packet transmission priority. The value range is 0 to 63. The default is 0.

source { ipv6 source-ipv6-address | interface interface-type interface-number }: Specifies the source address used to establish the FTP connection.

·     interface interface-type interface-number: Specifies an interface by its type and number. This option can be used only when the FTP server address is a link local address and the specified output interface has a link local address. For information about link local addresses, see Layer 3—IP Services Configuration Guide.

·     ipv6 source-ipv6-address: Specifies an IPv6 address. To establish the FTP connection successfully, make sure this address is the IPv6 address of an interface in up state on the device.

vpn-instance vpn-instance-name: Specifies the MPLS L3VPN instance to which the FTP server belongs. The vpn-instance-name argument represents the VPN instance name, a case-sensitive string of 1 to 31 characters. If the FTP server belongs to the public network, do not specify this option.

-i interface-type interface-number: Specifies an output interface by its type and number. This option can be used only when the FTP server address is a link local address and the specified output interface has a link local address.

-d: Enables FTP client debugging.

Usage guidelines

This command is only applicable to IPv6 networks.

If no parameters are specified, this command enters the FTP client view.

If the FTP server parameters are specified, you are prompted to enter the username and password for logging in to the FTP server.

Examples

# Log in to FTP server 2000::154.

<Sysname>ftp ipv6 2000::154

Press CTRL+C to abort.

Connected to 2000::154 (2000::154).

220 FTP service ready.

User (2000::154): root

331 Password required for root.

Password:

230 User logged in

Remote system type is H3C

# Log in to FTP server 2000::154 and enable FTP client debugging.

<Sysname> ftp ipv6 2000::154 –d

Press CTRL+C to abort.

Connected to 2000::154 (2000::154).

220 FTP service ready.

User (2000::154:(none)): root

*Apr 10 09:03:24:139 2017 Sysname FTPC/7/EVENT: PAM initialization result: 0.

*Apr 10 09:03:24:150 2017 Sysname FTPC/7/EVENT: PAM: Sent a start-accounting request. Result: 0.

*Apr 10 09:03:24:860 2017 Sysname FTPC/7/COMMAND: USER root

331 Password required for root.

Password:

*Apr 10 09:03:25:575 2017 Sysname FTPC/7/COMMAND: PASS XXXX

230 User logged in.

215 UNIX Type: L8

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> *Apr 10 09:03:25:640 2017 SIMWARE FTPC/7/COMMAND: SYST

ftp>

get

Use get to download a file from the FTP server and save the file.

Syntax

get remotefile [ localfile ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

remotefile: Specifies the file to be downloaded.

localfile: Specifies a name for the downloaded file. If you do not specify this argument, the system uses the name of the source file.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

To save the downloaded file to the working directory accessed by the ftp command, perform one of the following tasks:

·     Execute the command without specifying the localfile argument.

·     Specify a file name without any path information for the localfile argument, for example, a.cfg.

To save the downloaded file to some other directory, you must specify a fully qualified file name for the localfile argument, for example, flash:/subdirectory/a.cfg.

Examples

# Download the a.txt file and save it as b.txt in the working directory accessed by the ftp command.

ftp> get a.txt b.txt

local: b.txt remote: a.txt

150 Connecting to port 47457

226 File successfully transferred

1569 bytes received in 0.00527 seconds (290.6 kbyte/s)

# Download the a.txt file to the test directory in the working directory accessed by the ftp command.

ftp> get a.txt flash:/test/b.txt

local: flash:/test/b.txt remote: a.txt

150 Connecting to port 47457

226 File successfully transferred

1569 bytes received in 0.00527 seconds (290.6 kbyte/s)

# Download the a.txt file to the root directory of the flash memory on a member device. Save the file as c.txt.

ftp> get a.txt slot1#flash:/c.txt

local: slot1#flash:/c.txt remote: a.txt

150 Connecting to port 47460

226 File successfully transferred

1569 bytes received in 0.0564 seconds (27.2 kbyte/s)

Related commands

put

help

Use help to display all commands supported by the FTP client.

Use help command-name to display the help information for a command.

Syntax

help [ command-name ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

command-name: Specifies a command supported by the FTP client.

Usage guidelines

In FTP client view, executing the help command is the same as entering ?.

Examples

# Display all commands supported by the FTP client.

ftp> help

 

append          delete          ls              quit            rmdir

ascii           debug           mkdir           reget           status

binary          dir             newer           rstatus         system

bye             disconnect      open            rhelp           user

cd              get             passive         rename          verbose

cdup            help            put             reset           ?

close           lcd             pwd             restart

# Display the help information for the dir command.

ftp> help dir

dir              list contents of remote directory

Related commands

?

lcd

Use lcd to display or change the local working directory of the FTP client.

Syntax

lcd [ directory | / ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

directory: Changes the local working directory of the FTP client to the specified local directory. There must be a slash sign (/) before the name of the storage medium, for example, /flash:/logfile.

/: Changes the local working directory of the FTP client to the local root directory.

Usage guidelines

To display the local working directory of the FTP client, do not specify the directory or / argument.

Examples

# Display the local working directory.

ftp> lcd

Local directory now /flash:

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

ftp> lcd /flash:/logfile

Local directory now /flash:/logfile

ls

Use ls to display or save detailed information about files and directories on the FTP server.

Syntax

ls [ remotefile [ localfile ] ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

remotefile: Specifies a file or directory on the FTP server.

localfile: Specifies the name of the local file used to save the displayed information.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

To display detailed information about the files and subdirectories in the working directory on the FTP server, use the ls command.

To display detailed information about a file or directory on the FTP server, use the ls remotefile command.

To save detailed information about a file or directory on the FTP server to a local file, use the ls remotefile localfile command.

In FTP client view, executing the ls command is the same as executing the dir command.

Examples

# Display detailed information about the files and subdirectories in the working directory on the FTP server.

ftp> ls

150 Connecting to port 50201

-rwxr-xr-x    1 0          0                1481 Jul  7 15:36 a.txt

drwxr-xr-x    2 0          0                8192 Jul  2 14:33 diagfile

drwxr-xr-x    3 0          0                8192 Jul  7 15:21 ftp

drwxr-xr-x    2 0          0                8192 Jul  5 09:15 logfile

drwxr-xr-x    2 0          0                8192 Jul  2 14:33 seclog

-rwxr-xr-x    1 0          0            40808448 Jul  2 14:33 system-a1801.bin

-rwxr-xr-x    1 0          0                3050 Jul  7 12:26 startup.cfg

-rwxr-xr-x    1 0          0               54674 Jul  4 09:24 startup.mdb

-rwxr-xr-x    1 0          0                1481 Jul  7 12:34 x.cfg

226 9 matches total

# Save detailed information about the file a.txt to s.txt.

ftp> ls a.txt s.txt

output to local-file: s.txt ? [Y/N]y

150 Connecting to port 50203

226-Glob: s.txt

# Display the content of the file s.txt.

ftp> bye

221-Goodbye. You uploaded 0 and downloaded 2 kbytes.

221 Logout.

<Sysname> more s.txt

-rwxr-xr-x    1 0          0                1481 Jul  7 12:34 a.txt

Related commands

dir

mkdir

Use mkdir to create a subdirectory in the current directory on the FTP server.

Syntax

mkdir directory

Views

FTP client view

Predefined user roles

network-admin

Parameters

directory: Specifies the name for the directory to be created.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

You must have permission to perform this operation on the FTP server.

Examples

# Create a subdirectory named newdir in the current directory of the FTP server.

ftp> mkdir newdir

257 "newdir" : The directory was successfully created

newer

Use newer to update a local file by using a file on the FTP server.

Syntax

newer remotefile [ localfile ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

remotefile: Specifies a file on the FTP server.

localfile: Specifies the local file to be updated.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

If the local file does not exist, this command downloads the file from the FTP server and saves it locally.

If the file on the FTP server is not newer than the local file, this command does not update the local file.

Examples

# Update the local file with the a.txt file on the FTP server.

ftp> newer a.txt

local: a.txt remote: a.txt

150 Connecting to port 63513

226 File successfully transferred

1573 bytes received in 0.0293 seconds (52.3 kbyte/s)

open

Use open to log in to an FTP server from FTP client view.

Syntax

open server-address [ service-port ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

server-address: Specifies the IPv4 address, IPv6 address, or host name of the FTP server.

service-port: Specifies the TCP port number of the FTP server, in the range of 0 to 65535. The default is 21.

Usage guidelines

After you issue this command, the system will prompt you to enter the username and password.

After you log in to one FTP server, you must disconnect from the server before you can use the open command to log in to another server.

Examples

# In FTP client view, log in to FTP server 192.168.40.7.

<Sysname>ftp

ftp> open 192.168.40.7

Press CTRL+C to abort.

Connected to 192.168.40.7 (192.168.40.7).

220 FTP service ready.

User (192.168.40.7:(none)): root

331 Password required for root.

Password:

230 User logged in.

Remote system type is H3C.

ftp>

passive

Use passive to change the FTP operation mode.

Syntax

passive

Default

The FTP operation mode is passive.

Views

FTP client view

Predefined user roles

network-admin

Usage guidelines

FTP can operate in either of the following modes:

·     Active mode—The FTP server initiates the TCP connection.

·     Passive mode—The FTP client initiates the TCP connection.

When the FTP operation mode is passive, executing this command changes the mode to active.

When the FTP operation mode is active, executing this command changes the mode to passive.

This command is typically used together with a firewall to control FTP session establishment between private network users and public network users.

Examples

# Change the FTP operation mode to passive.

ftp> passive

Passive mode on.

ftp> passive

Passive mode off.

put

Use put to upload a file from the FTP client to the FTP server.

Syntax

put localfile [ remotefile ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

localfile: Specifies the local file to be uploaded.

remotefile: Specifies the name of the file for saving the uploaded file on the FTP server.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

To upload a file in the current working directory, specify a file name without the path for the localfile argument, for example, a.cfg.

To upload a file in some other directory, specify a fully qualified file name for the localfile argument, for example, flash:/subdirectory/a.cfg.

Examples

# Upload the a.txt file from the local working directory to the FTP server. Save the file as b.txt.

ftp> put a.txt b.txt

local: a.txt remote: b.txt

150 Connecting to port 47461

226 File successfully transferred

1569 bytes sent in 0.000671 seconds (2.23 Mbyte/s)

# Upload the a.txt file from the test directory of the local working directory to the FTP server. Save the file as b.txt.

ftp> put flash:/test/a.txt b.txt

local: flash:/test/a.txt remote: b.txt

150 Connecting to port 47461

226 File successfully transferred

1569 bytes sent in 0.000671 seconds (2.23 Mbyte/s)

# Upload file a.txt from the test directory of the storage medium on a member device. Save the file as b.txt on the FTP server.

ftp> put slot2#flash:/test/a.txt b.txt

local: slot2#flash:/test/a.txt remote: b.txt

150 Connecting to port 47461

226 File successfully transferred

1569 bytes sent in 0.000671 seconds (2.23 Mbyte/s)

Related commands

get

pwd

Use pwd to display the currently accessed directory on the FTP server.

Syntax

pwd

Views

FTP client view

Predefined user roles

network-admin

Usage guidelines

You can perform this operation only after you log in to the FTP server.

Examples

# Display the currently accessed directory on the FTP server.

ftp> cd subdir

250 OK. Current directory is /subdir

ftp> pwd

257 "/subdir" is your current location

quit

Use quit to terminate the connection to the FTP server and return to user view.

Syntax

quit

Views

FTP client view

Predefined user roles

network-admin

Examples

# Terminate the connection to the FTP server and return to user view.

ftp> quit

221-Goodbye. You uploaded 0 and downloaded 0 kbytes.

221 Logout.

<Sysname>

Related commands

bye

reget

Use reget to get the missing part of a file from the FTP server.

Syntax

reget remotefile [ localfile ]

Views

FTP client view

Predefined user roles

network-admin

network-operator

Parameters

remotefile: Specifies a file on the FTP server.

localfile: Specifies a local file.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

If a file download is not completed due to network or storage space problems, use this command to get the part that has not been downloaded yet.

Examples

# Get the part of the s.bin file that has not been downloaded yet.

ftp> reget s.bin

local: s.bin remote: s.bin

350 Restarting at 1749706

150-Connecting to port 47429

150 38143.3 kbytes to download

226 File successfully transferred

39058742 bytes received in 66.2 seconds (576.1 kbyte/s)

rename

Use rename to rename a file.

Syntax

rename [ oldfilename [ newfilename ] ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

oldfilename: Specifies the original file name.

newfilename: Specifies the new file name.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

Examples

# Rename the a.txt file as b.txt.

·     Method 1:

ftp> rename

(from-name) a.txt

(to-name) b.txt

350 RNFR accepted - file exists, ready for destination

250 File successfully renamed or moved

·     Method 2:

ftp> rename a.txt

(to-name) b.txt

350 RNFR accepted - file exists, ready for destination

250 File successfully renamed or moved

·     Method 3:

ftp> rename a.txt b.txt

350 RNFR accepted - file exists, ready for destination

250 File successfully renamed or moved

reset

Use reset to clear the reply information received from the FTP server in the buffer.

Syntax

reset

Views

FTP client view

Predefined user roles

network-admin

Examples

# Clear the reply information received from the FTP server.

ftp> reset

restart

Use restart to specify the file retransmission offset.

Syntax

restart marker

Views

FTP client view

Predefined user roles

network-admin

Parameters

marker: Specifies the retransmission offset, in bytes.

Usage guidelines

Use this command to continue with a file retransmission. The file retransmission starts from the (offset+1)th byte.

You can perform this operation only after you log in to the FTP server.

Support for this command depends on the FTP server.

Examples

# Set retransmission offset to 2 bytes and retransmit the h.c file. The file has 82 bytes in total.

ftp> restart 2

restarting at 2. execute get, put or append to initiate transfer

ftp> put h.c h.c

local: h.c remote: h.c

350 Restart position accepted (2).

150 Ok to send data.

226 File receive OK.

80 bytes sent in 0.000445 seconds (175.6 kbyte/s)

ftp> dir

150 Here comes the directory listing.

-rw-r--r--    1 0        0              82 Jul 18 02:58 h.c

rhelp

Use rhelp to display the FTP commands supported by the FTP server.

Use rhelp protocol-command to display the help information for an FTP command supported by the FTP server.

Syntax

rhelp [ protocol-command ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

protocol-command: Specifies an FTP command.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

Examples

# Display the FTP-related commands supported by the FTP server.

ftp> rhelp

214-The following FTP commands are recognized

 USER PASS NOOP QUIT SYST TYPE

 HELP CWD  XCWD PWD  CDUP XCUP

 XPWD LIST NLST MLSD PORT EPRT

 PASV EPSV REST RETR STOR APPE

 DELE MKD  XMKD RMD  XRMD ABOR

 SIZE RNFR RNTO

214 UNIX Type: L8

Table 3 Command output

Field

Description

USER

Username.

PASS

Password.

NOOP

Null operation.

SYST

System parameters.

TYPE

Request type.

CWD

Changes the current working directory.

XCWD

Extended command with the meaning of CWD.

PWD

Prints the working directory.

CDUP

Changes the directory to the upper directory.

XCUP

Extended command with the meaning of CDUP.

XPWD

Extended command with the meaning of PWD.

LIST

Lists files.

NLST

Lists brief file description.

MLSD

Lists file content.

PORT

Active mode (IPv4).

EPRT

Active mode (IPv6).

PASV

Passive mode (IPv4).

EPSV

Passive mode (IPv6).

REST

Restarts.

RETR

Downloads files.

STOR

Uploads files.

APPE

Appends uploading.

DELE

Deletes files.

MKD

Creates folders.

XMKD

Extended command with the meaning of MKD.

RMD

Deletes folders.

XRMD

Extended command with the meaning of RMD.

ABOR

Aborts the transmission.

SIZE

Size of the transmission file.

RNFR

Original name.

RNTO

New name.

rmdir

Use rmdir to permanently delete a directory from the FTP server.

Syntax

rmdir directory

Views

FTP client view

Predefined user roles

network-admin

Parameters

directory: Specifies a directory on the FTP server.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

To perform this operation, you must have delete permission on the FTP server.

Delete all files and subdirectories in a directory before you delete the directory. For more information about how to delete files, see the delete command.

The rmdir command does not delete the files of the specified directory from the recycle bin.

Examples

# Delete empty directory subdir1.

ftp>rmdir subdir1

250 The directory was successfully removed

Related commands

delete

rstatus

Use rstatus to display FTP server status information.

Use rstatus remotefile to display detailed information about a directory or file on the FTP server.

Syntax

rstatus [ remotefile ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

remotefile: Specifies a directory or file on the FTP server.

Usage guidelines

You can perform this operation only after you log in to the FTP server.

Support for this command depends on the FTP server.

Examples

# Display FTP server status information.

ftp> rstatus

211-FTP server status:

     Connected to 192.168.20.177

     Logged in as root

     TYPE: ASCII

     No session bandwidth limit

     Session timeout in seconds is 300

     Control connection is plain text

     Data connections will be plain text

     At session startup, client count was 1

     vsFTPd 2.0.6 - secure, fast, stable

211 End of status

Table 4 Command output

Filed

Description

211-FTP server status:

Beginning of the display of FTP server status, where 211 specifies the FTP command.

Connected to 192.168.20.177

IP address of the FTP client.

Logged in as root

Login username root.

TYPE: ASCII

File transfer mode ASCII.

Session timeout in seconds is 300

FTP connection idle-timeout interval is 300 seconds.

Control connection is plain text

Control connection type is plain text.

Data connections will be plain text

Data connection type is plain text.

At session startup, client count was 1

FTP connection number is 1.

vsFTPd 2.0.6 - secure, fast, stable

FTP version is 2.0.6.

211 End of status

End of the display of FTP server status.

# Display the file a.txt.

ftp> rstatus a.txt

213-Status follows:

-rw-r--r--    1 0        0              80 Jul 18 02:58 a.txt

213 End of status

Table 5 Command output

Field

Description

213-Status follows:

Beginning of the display of the file, where 213 specifies the FTP command.

-rw-r--r--

The first bit specifies the file type.

·     -—Common.

·     B—Block.

·     c—Character.

·     d—Directory.

·     l—Symbol connection file.

·     p—Pipe.

·     s—socket.

The second bit through the tenth bit are divided into three groups. Each group contains three characters, representing the access permission of the owner, group, and other users.

·     -—No permission.

·     r—Read permission.

·     w—Write permission.

·     x—Execution permission.

1

Number of connections.

0

Name of the file owner.

0

Group number of the file owner.

80

File size, in bytes.

Jul 18 02:58

Date and time when the file was most recently modified.

a.txt

File name.

213 End of status

End of the display of the file information.

status

Use status to display FTP status information.

Syntax

status

Views

FTP client view

Predefined user roles

network-admin

Examples

# Display FTP status information.

ftp> status

Connected to 192.168.1.56.

No proxy connection.

Not using any security mechanism.

Mode: stream; Type: ascii; Form: non-print; Structure: file

Verbose: on; Bell: off; Prompting: on; Globbing: off

Store unique: off; Receive unique: off

Case: off; CR stripping: on

Ntrans: off

Nmap: off

Hash mark printing: off; Use of PORT cmds: on

Table 6 Command output

Field

Description

Connected to 192.168.1.56.

IP address of the FTP server that is connected to the FTP client.

Verbose: on; Bell: off; Prompting: on; Globbing: off

Displays debugging information.

Store unique: off; Receive unique: off

The name of the file on the FTP server is unique and the name of the local file is unique.

Case: off; CR stripping: on

Does not support obtaining multiple files once and deletes "\r" when downloading text files.

Ntrans: off

Does not use the input-output transmission table.

Nmap: off

The file name does not use the input-to-output mapping template.

Hash mark printing: off; Use of PORT cmds: on

Does not end with a pound sign (#) and uses "PORT" data transmission.

system

Use system to display the system information of the FTP server.

Syntax

system

Views

FTP client view

Predefined user roles

network-admin

Usage guidelines

You can perform this operation only after you log in to the FTP server.

Examples

# Display the system information of the FTP server.

ftp> system

215 UNIX Type: L8

user

Use user to initiate an FTP authentication on the current FTP connection.

Syntax

user username [ password ]

Views

FTP client view

Predefined user roles

network-admin

Parameters

username: Specifies the username.

password: Specifies the password.

Usage guidelines

If you tried to access an FTP server but failed to pass the authentication, you can use this command to try again before the connection to the FTP server expires.

After you log in to an FTP server, you can initiate an FTP authentication to change to a new account. By changing to a new account, you can get a different privilege without re-establishing the FTP connection.

Make sure the specified username and password have been configured on the FTP server. If the username or password is not configured, this command fails and the FTP connection is closed.

Examples

# After logging in to the FTP server, use username ftp and password 123456 to log in again to the FTP server.

·     Method 1:

ftp> user ftp 123456

331 Password required for ftp.

230 User logged in.

·     Method 2:

ftp> user ftp

331 Password required for ftp.

Password:

230 User logged in.

verbose

Use verbose to enable or disable the device to display detailed information about FTP operations.

Syntax

verbose

Default

The device displays detailed information about FTP operations.

Views

FTP client view

Predefined user roles

network-admin

Usage guidelines

This command affects only the current FTP session.

Examples

# Disable the device from displaying detailed information about FTP operations.

ftp> verbose

Verbose mode off.

# Execute the get command.

ftp> get a.cfg 1.cfg

# Enable the device to display detailed information about FTP operations.

ftp> verbose

Verbose mode on.

# Execute the get command.

ftp> get a.cfg 2.cfg

227 Entering Passive Mode (192,168,1,58,68,14)

150-Accepted data connection

150 The computer is your friend. Trust the computer

226 File successfully transferred

3796 bytes received in 0.00762 seconds (486.5 kbyte/s)


TFTP commands

The device supports the FIPS mode that complies with NIST FIPS 140-2 requirements. Support for features, commands, and parameters might differ in FIPS mode and non-FIPS mode. For more information about FIPS mode, see Security Configuration Guide.

TFTP is not supported in FIPS mode.

TFTP server commands

tftp server enable

Use tftp server enable to enable the TFTP server.

Use undo tftp server enable to disable the TFTP server.

Syntax

tftp server enable

undo tftp server enable

Default

The TFTP server is disabled.

Views

System view

Predefined user roles

network-admin

Examples

# Enable the TFTP server.

<Sysname> system-view

[Sysname] tftp server enable

Related commands

tftp server work-directory

tftp server work-directory

Use tftp server work-directory to set the TFTP server working directory.

Use undo tftp server work-directory to restore the default.

Syntax

tftp server work-directory directory

undo tftp server work-directory

Default

The TFTP server working directory is the root directory of the default file system.

Views

System view

Predefined user roles

network-admin

Parameters

directory: Specifies a directory on the TFTP server. It must be the absolute path of an existing directory, a case-insensitive string of 1 to 255 characters.

Usage guidelines

TFTP clients have read and write rights to all files and directories in the TFTP server working directory.

Examples

# Set the TFTP server working directory to flash:/tftp.

<Sysname> system-view

[Sysname] tftp server work-directory flash:/tftp

Related commands

tftp server enable

TFTP client commands

tftp

Use tftp to download a file from a TFTP server or upload a file to a TFTP server in an IPv4 network.

Syntax

tftp tftp-server { get | put | sget } source-filename [ destination-filename ] [ vpn-instance vpn-instance-name ] [ dscp dscp-value | source { interface interface-type interface-number | ip source-ip-address } ] *

Views

User view

Predefined user roles

network-admin

Parameters

tftp-server: Specifies the IPv4 address or host name of a TFTP server. The host name can be a case-insensitive string of 1 to 253 characters and can contain only letters, digits, hyphens (-), underscores (_), and dots (.).

get: Downloads a file and writes the file directly to the destination folder. If the destination folder already has a file with the same name, the system deletes the existing file before starting the download operation. The existing file is permanently deleted even if the download operation fails.

put: Uploads a file.

sget: Downloads a file and saves the file to memory before writing it to the destination folder. The system starts to write the file to the destination folder only after the file is downloaded and saved to memory successfully. If the destination folder already has a file with the same name, the system overwrites the existing file. If the download or save-to-memory operation fails, the existing file in the destination folder is not overwritten.

source-filename: Specifies the source file name, a case-insensitive string of 1 to 1 to 255 characters.

destination-filename: Specifies the destination file name, a case-insensitive string of 1 to 255 characters. If this argument is not specified, the file uses the source file name.

vpn-instance vpn-instance-name: Specifies the MPLS L3VPN instance to which the TFTP server belongs. The vpn-instance-name argument represents the VPN instance name, a case-sensitive string of 1 to 31 characters. If the TFTP server belongs to the public network, do not specify this option.

dscp dscp-value: Specifies the DSCP value for IPv4 to use for outgoing TFTP packets to indicate the packet transmission priority. The value range is 0 to 63. The default is 0.

source { interface interface-type interface-number | ip source-ip-address }: Specifies the source address for outgoing TFTP packets. If you do not specify this option, the device uses the primary IPv4 address of the output interface for the route to the TFTP server as the source address.

·     interface interface-type interface-number: Specifies an interface by its type and number. The device will use the interface's primary IPv4 address as the source IPv4 address. For successful TFTP packet transmission, make sure the interface is up and has the primary IPv4 address configured.

·     ip source-ip-address: Specifies an IPv4 address. For successful TFTP packet transmission, make sure this address is the IPv4 address of an interface in up state on the device.

Usage guidelines

The source address specified with the tftp command takes precedence over the source address specified with the tftp client source command.

The source address specified with the tftp client source command applies to all TFTP connections. The source address specified with the tftp command applies only to the current TFTP connection.

Examples

# Download the new.bin file from TFTP server 192.168.1.1 and save the file as new.bin.

<Sysname> tftp 192.168.1.1 get new.bin

Press CTRL+C to abort.

   % Total    % Received % Xferd  Average Speed   Time    Time     Time   Current

                                  Dload  Upload   Total   Spent    Left   Speed

100 13.9M  100 13.9M    0     0  1206k      0  0:00:11  0:00:11  --:--:-- 1206k

Writing file...Done.

<Sysname>

Table 7 Command output

Field

Description

%

Percentage of file transmission progress.

Total

Size of files to be transmitted, in bytes.

%

Percentage of received file size to total file size.

Received

Received file size, in bytes.

%

Percentage of sent file size to total file size.

Xferd

Sent file size, in bytes.

Average Dload

Average download speed, in bps.

Speed Upload

Average upload speed, in bps.

Writing file…

The system was writing the downloaded file to the storage medium. This field is displayed only when the get or sget keyword is specified.

If the operation succeeded, this command displays Done at the end of this field. If the operation failed, this command displays Failed.

Related commands

tftp client source

tftp client ipv6 source

Use tftp client ipv6 source to specify the source IPv6 address for TFTP packets sent to an IPv6 TFTP server.

Use undo tftp client ipv6 source to restore the default.

Syntax

tftp client ipv6 source { interface interface-type interface-number | ipv6 source-ipv6-address }

undo tftp client ipv6 source

Default

No source address is specified for TFTP packets sent to an IPv6 TFTP server. The device selects a source IPv6 address as defined in RFC 3484.

Views

System view

Predefined user roles

network-admin

Parameters

interface interface-type interface-number: Specifies an interface by its type and number. The device will use the interface's IPv6 address as the source address. For successful TFTP packet transmission, make sure the interface is up and is configured with an IPv6 address.

ipv6 source-ipv6-address: Specifies an IPv6 address . For successful TFTP packet transmission, make sure this address is the IPv6 address of an interface in up state on the device.

Usage guidelines

If you execute this command multiple times, the most recent configuration takes effect.

The source address specified with the tftp ipv6 command takes precedence over the source address specified with the tftp client ipv6 source command.

The source address specified with the tftp client ipv6 source command applies to all TFTP connections. The source address specified with the tftp ipv6 command applies only to the TFTP connection that is being established.

Examples

# Specify the source IPv6 address of 2000::1 for TFTP packets sent to an IPv6 TFTP server.

<Sysname> system–view

[Sysname] tftp client ipv6 source ipv6 2000::1

Related commands

tftp ipv6

tftp client source

Use tftp client source to specify the source IPv4 address for TFTP packets sent to an IPv4 TFTP server.

Use undo tftp client source to restore the default.

Syntax

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

undo tftp client source

Default

No source IPv4 address is specified for TFTP packets sent to an IPv4 TFTP server. The device uses the primary IPv4 address of the output interface for the route to the server as the source address.

Views

System view

Predefined user roles

network-admin

Parameters

interface interface-type interface-number: Specifies an interface by its type and number. The device will use the interface's primary IPv4 address as the source address. For successful TFTP packet transmission, make sure the interface is up and has the primary IPv4 address configured.

ip source-ip-address: Specifies an IPv4 address. For successful TFTP packet transmission, make sure this address is the IPv4 address of an interface in up state on the device.

Usage guidelines

If you execute this command multiple times, the most recent configuration takes effect.

The source address specified with the tftp command takes precedence over the source address specified with the tftp client source command.

The source address specified with the tftp client source command applies to all TFTP connections. The source address specified with the tftp command applies only to the TFTP connection that is being established.

Examples

# Specify the source IP address of 192.168.20.222 for TFTP packets sent to an IPv4 TFTP server.

<Sysname> system-view

[Sysname] tftp client source ip 192.168.20.222

Related commands

tftp

tftp ipv6

Use tftp ipv6 to download a file from a TFTP server or upload a file to a TFTP server in an IPv6 network.

Syntax

tftp ipv6 tftp-server [ -i interface-type interface-number ] { get | put | sget } source-filename [ destination-filename ] [ vpn-instance vpn-instance-name ] [ dscp dscp-value | source { interface interface-type interface-number | ipv6 source-ipv6-address } ] *

Views

User view

Predefined user roles

network-admin

Parameters

tftp-server: Specifies the IPv6 address or host name of a TFTP server. The host name can be a case-insensitive string of 1 to 253 characters and can contain only letters, digits, hyphens (-), underscores (_), and dots (.).

-i interface-type interface-number: Specifies an output interface by its type and number. This option can be used only when the TFTP server address is a link local address and the specified output interface has a link local address. For information about link local addresses, see Layer 3—IP Services Configuration Guide.

get: Downloads a file and writes the file directly to the destination folder. If the destination folder already has a file with the same name, the system deletes the existing file before starting the download operation. The existing file is permanently deleted even if the download operation fails.

put: Uploads a file.

sget: Downloads a file and saves the file to memory before writing it to the destination folder. The system starts to write the file to the destination folder only after the file is downloaded and saved to memory successfully. If the destination folder already has a file using the same name, the system overwrites the existing file. If the download or save-to-memory operation fails, the existing file in the destination folder is not overwritten.

source-filename: Specifies the source file name, a case-insensitive string of 1 to 255 characters.

destination-filename: Specifies the destination file name, a case-insensitive string of 1 to 255 characters. If this argument is not specified, the file uses the source file name.

vpn-instance vpn-instance-name: Specifies the MPLS L3VPN instance to which the TFTP server belongs. The vpn-instance-name argument represents the VPN instance name, a case-sensitive string of 1 to 31 characters. If the TFTP server belongs to the public network, do not specify this option.

dscp dscp-value: Specifies the DSCP value for IPv6 to use in outgoing TFTP packets to indicate the packet transmission priority. The value range is 0 to 63. The default is 0.

source { interface interface-type interface-number | ipv6 source-ipv6-address }: Specifies the source address for outgoing TFTP packets. If you do not specify this option, the device selects a source IPv6 address as defined in RFC 3484.

·     interface interface-type interface-number: Specifies an interface by its type and number. The device will use the interface's IPv6 address as the source IPv6 address. For successful TFTP packet transmission, make sure the interface is up and is configured with an IPv6 address.

·     ipv6 source-ipv6-address: Specifies an IPv6 address. For successful TFTP packet transmission, make sure this address is the IPv6 address of an interface in up state on the device.

Usage guidelines

The source address specified with the tftp ipv6 command takes precedence over the source address specified with the tftp client ipv6 source command.

The source address specified with the tftp client ipv6 source command applies to all TFTP connections. The source address specified with the tftp ipv6 command applies only to the current TFTP connection.

Examples

# Download the new.bin file from TFTP server 2001::1 and save the file as new.bin.

<Sysname> tftp ipv6 2001::1 get new.bin new.bin

Press CTRL+C to abort.

   % Total    % Received % Xferd  Average Speed   Time    Time     Time   Current

                                  Dload  Upload   Total   Spent    Left   Speed

100 13.9M  100 13.9M    0     0  1206k      0  0:00:11  0:00:11  --:--:-- 1206k

Writing file...Done.

For more information about the command output, see Table 7.

tftp-server acl

Use tftp-server acl to use an ACL to control the device's access to TFTP servers in an IPv4 network.

Use undo tftp-server acl to restore the default.

Syntax

tftp-server acl acl-number

undo tftp-server acl

Default

No ACL is used to control the device's access to TFTP servers.

Views

System view

Predefined user roles

network-admin

Parameters

acl-number: Specifies the number of a basic ACL, in the range of 2000 to 2999.

Usage guidelines

You can use an ACL to deny or permit the device's access to specific TFTP servers.

Examples

# Allow the device to access only TFTP server 1.1.1.1.

<Sysname> system-view

[Sysname] acl basic 2000

[Sysname-acl-ipv4-basic-2000] rule permit source 1.1.1.1 0

[Sysname-acl-ipv4-basic-2000] quit

[Sysname] tftp-server acl 2000

tftp-server ipv6 acl

Use tftp-server ipv6 acl to use an ACL to control the device's access to TFTP servers in an IPv6 network.

Use undo tftp-server ipv6 acl to restore the default.

Syntax

tftp-server ipv6 acl ipv6-acl-number

undo tftp-server ipv6 acl

Default

No ACL is used to control the device's access to TFTP servers.

Views

System view

Predefined user roles

network-admin

Parameters

ipv6-acl-number: Specifies the number of a basic ACL, in the range of 2000 to 2999.

Usage guidelines

You can use an ACL to deny or permit the device's access to specific TFTP servers.

Examples

# Allow the device to access only TFTP server 2001::1.

<Sysname> System-view

[Sysname] acl ipv6 basic 2001

[Sysname-acl-ipv6-basic-2001] rule permit source 2001::1/128

[Sysname-acl-ipv6-basic-2001] quit

[Sysname] tftp-server ipv6 acl 2001