- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
03-FTP and TFTP Commands | 188.86 KB |
Contents
FTP server configuration commands
FTP client configuration commands
display ftp client configuration
display tftp client configuration
FTP server configuration commands
display ftp-server
Syntax
display ftp-server [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
3: Manage level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display ftp-server command to display the FTP server configuration.
After configuring FTP server parameters, you may verify them with this command.
Related commands: ftp server enable, ftp timeout, and ftp update.
Examples
# Display the FTP server configuration.
<Sysname> display ftp-server
FTP server is running
Max user number: 1
User count: 1
Timeout value(in minute): 30
Put Method: fast
Table 1 Output description
Field |
Description |
Max user number |
Maximum number of concurrent login users. |
User count |
Number of the current login users. |
Timeout value (in minute) |
Allowed idle time of an FTP connection. If there is no packet exchange between the FTP server and client during this period, the FTP connection will be disconnected. |
Put Method |
File update method of the FTP server, including: · fast · normal |
display ftp-user
Syntax
display ftp-user [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
3: Manage level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display ftp-user command to display the detailed information of current FTP users.
Examples
# Display the detailed information of FTP users.
<Sysname> display ftp-user
UserName HostIP Port Idle HomeDir
ftp 192.168.1.54 1190 0 flash:
# If the name of the logged-in user exceeds 10 characters, the exceeded characters will be displayed in the next line and right justified, for example, if the logged-in user name is administrator, the information is displayed as follows:
<Sysname> display ftp-user
UserName HostIP Port Idle HomeDir
administra
tor 192.168.0.152 1031 0 flash:
Table 2 Output description
Field |
Description |
UserName |
Name of the currently logged-in user |
HostIP |
IP address of the currently logged-in user |
Port |
Port which the currently logged-in user is using |
Idle |
Duration time of the current FTP connection in minutes |
HomeDir |
Authorized path of the present logged-in user |
free ftp user
Syntax
free ftp user username
View
User view
Default level
3: Manage level
Parameters
username: Username. You can use the display ftp-user command to view FTP login user information.
Description
Use the free ftp user command to manually release the FTP connection established by the specified user.
This command releases the FTP connection established by the specified user no matter whether the user is transmitting a file.
Examples
# Manually release the FTP connection established with username ftpuser.
<Sysname> free ftp user ftpuser
Are you sure to free FTP user ftpuser? [Y/N]:y
<Sysname>
ftp server acl
Syntax
ftp server acl acl-number
undo ftp server acl
View
System view
Default level
3: Manage level
Parameters
acl-number: Basic access control list (ACL) number, in the range of 2000 to 2999.
Description
Use the ftp server acl command to use an ACL to control FTP clients’ access to the FTP server.
Use the undo ftp server acl command to restore the default.
By default, no ACL is used to control FTP clients’ access to the FTP server.
An ACL enables the FTP server to permit the FTP requests from specific FTP clients. This configuration only filters the FTP connections to be established, and has no effect on existing FTP connections and operations. If you execute the command multiple times, the last specified ACL takes effect.
Examples
# Associate the FTP service with ACL 2001 to allow only the client 1.1.1.1 to access the FTP server through FTP.
<Sysname> system-view
[Sysname] acl number 2001
[Sysname-acl-basic-2001] rule 0 permit source 1.1.1.1 0
[Sysname-acl-basic-2001] rule 1 deny source any
[Sysname-acl-basic-2001] quit
[Sysname] ftp server acl 2001
ftp server enable
Syntax
ftp server enable
undo ftp server
View
System view
Default level
3: Manage level
Parameters
None
Description
Use the ftp server enable command to enable the FTP server and allow the login of FTP users.
Use the undo ftp server command to disable the FTP server.
By default, the FTP server is disabled.
Examples
# Enable the FTP server.
<Sysname> system-view
[Sysname] ftp server enable
[Sysname]
ftp timeout
Syntax
ftp timeout minute
undo ftp timeout
View
System view
Default level
3: Manage level
Parameters
minute: Idle-timeout timer in minutes, in the range of 1 to 35791.
Description
Use the ftp timeout command to set the idle-timeout timer.
Use the undo ftp timeout command to restore the default.
By default, the FTP idle time is 30 minutes.
If the idle time of an FTP connection exceeds the FTP timeout value, the FTP server breaks the connection to save resources.
Examples
# Set the idle-timeout timer to 36 minutes.
<Sysname> system-view
[Sysname] ftp timeout 36
[Sysname]
ftp update
Syntax
ftp update { fast | normal }
undo ftp update
View
System view
Default level
3: Manage level
Parameters
fast: Fast update. In this mode, the FTP server writes the complete file to the memory before writing it to the storage medium.
normal: Normal update. In this mode, the FTP server writes the data of a file from the memory to the storage medium multiple times, with up to 4096 bytes per time.
Description
Use the ftp update command to set the file update mode that the FTP server uses while receiving data.
Use the undo ftp update command to restore the default.
By default, the file update mode is normal.
Examples
# Set the FTP update mode to normal.
<Sysname> system-view
[Sysname] ftp update normal
[Sysname]
FTP client configuration commands
|
NOTE: · You must use the ftp command to enter FTP client view before making client configurations. For more information, see “ftp.” · Before executing FTP client configuration commands, make sure you have made proper authority configurations for users on the FTP server. Authorized operations include view the files under the current directory, read/download the specified files, create directory/upload files, and rename/remove files). · The prompt information in the following examples varies with FTP server types. |
ascii
Syntax
ascii
View
FTP client view
Default level
3: Manage level
Parameters
None
Description
Use the ascii command to set the file transfer mode to ASCII.
By default, the file transfer mode is ASCII.
The carriage return characters vary with operating systems. For example, H3C and Windows use characters /r/n, and Linux uses characters /n. To transfer files between two systems that use different carriage return characters, determine FTP transfer mode according to the file type.
FTP transfers files in two modes:
· Binary mode: for program file or picture transmission.
· ASCII mode: for text file transmission.
Related commands: binary.
Examples
# Set the file transfer mode to ASCII.
[ftp] ascii
200 Type set to A.
[ftp]
binary
Syntax
binary
View
FTP client view
Default level
3: Manage level
Parameters
None
Description
Use the binary command to set the file transfer mode to binary (flow) mode.
By default, the transfer mode is ASCII mode.
Related commands: ascii.
Examples
# Set the file transfer mode to binary.
[ftp] binary
200 Type set to I.
[ftp]
bye
Syntax
bye
View
FTP client view
Default level
3: Manage level
Parameters
None
Description
Use the bye command to disconnect from the remote FTP server and return to user view.
If no connection is established between the device and the remote FTP server, use this command to return to user view directly.
Related commands: close, disconnect, and quit.
Examples
# Terminate the connection with the remote FTP server and return to user view.
[ftp] bye
221 Server closing.
<Sysname>
cd
Syntax
cd { directory | .. | / }
View
FTP client view
Default level
3: Manage level
Parameters
directory: Name of the target directory, in the format of [drive:][/]path, where drive represents the storage medium name, typically flash or cf. If the target directory does not exist, the cd command does not change the current working directory. If no drive information is provided, the argument represents a folder or subfolder in the current directory. For more information about the drive and path arguments, see Fundamentals Configuration Guide.
..: Returns to an upper directory. The execution of the cd .. command equals the execution of the cdup command. If the current working directory is the FTP root directory, the current working directory does not change when the cd .. command is executed. This argument does not support command line online help.
/: Returns to the FTP root directory. The keyword does not support command line online help.
Description
Use the cd command to change the current working directory on the remote FTP server to access another authorized directory.
Related commands: pwd.
Examples
# Change the working directory to the sub-directory logfile of the current directory.
[ftp] cd logfile
250 CWD command successful.
# Change the working directory to the sub-directory folder of the FTP root directory.
[ftp] cd /folder
250 CWD command successful.
# Change the working directory to the upper directory of the current directory.
[ftp] cd ..
250 CWD command successful.
# Change the working directory to the FTP root directory.
[ftp] cd /
250 CWD command successful.
[ftp]
cdup
Syntax
cdup
View
FTP client view
Default level
3: Manage level
Parameters
None
Description
Use the cdup command to exit the current directory and enter the upper directory of the FTP server.
This command does not change the working directory if the current directory is the FTP root directory.
Related commands: cd and pwd.
Examples
# Change the current working directory path to the upper directory.
[ftp] pwd
257 "/ftp/subdir" is current directory.
[ftp] cdup
200 CDUP command successful.
[ftp] pwd
257 "/ftp" is current directory.
close
Syntax
close
View
FTP client view
Default level
3: Manage level
Parameters
None
Description
Use the close command to terminate the connection to the FTP server, but remain in FTP client view.
This command is equal to the disconnect command.
Examples
# Terminate the connection to the FTP server and remain in FTP client view.
[ftp] close
221 Server closing.
[ftp]
debugging
Syntax
debugging
undo debugging
View
FTP client view
Default level
1: Monitor level
Parameters
None
Description
Use the debugging command to enable FTP client debugging.
Use the undo debugging command to disable FTP client debugging.
By default, FTP client debugging is disabled.
Examples
# The device serves as the FTP client. Enable FTP client debugging and use the active mode to download file sample.file from the current directory of the FTP server.
<Sysname> terminal monitor
<Sysname> terminal debugging
<Sysname> ftp 192.168.1.46
Trying 192.168.1.46 ...
Press CTRL+K to abort
Connected to 192.168.1.46.
220 FTP service ready.
User(192.168.1.46:(none)):ftp
331 Password required for ftp.
Password:
230 User logged in.
[ftp]undo passive
FTP: passive is off
[ftp] debugging
FTP: debugging switch is on
[ftp] get sample.file
---> PORT 192,168,1,44,4,21
200 Port command okay.
The parsed reply is 200
---> RETR sample.file
150 Opening ASCII mode data connection for /sample.file.
The parsed reply is 150
FTPC: File transfer started with the signal light turned on.
FTPC: File transfer completed with the signal light turned off.
.226 Transfer complete.
FTP: 3304 byte(s) received in 4.889 second(s), 675.00 byte(s)/sec.
[ftp]
Table 3 Output description
Field |
Description |
---> PORT 192,168,1,44,4,21 |
FTP command. 192,168,1,44 specifies the destination IP address, and 4,21 is used to calculate the data port number by using the formula 4*256+21. |
The parsed reply is |
The received reply code, defined in RFC 959. |
---> RETR |
Download the file. |
FTPC: File transfer started with the signal light turned on. |
File transfer starts, and the signal light is turned on. |
FTPC: File transfer completed with the signal light turned off. |
File transfer is completed, and the signal light is turned off. |
delete
Syntax
delete remotefile
View
FTP client view
Default level
3: Manage level
Parameters
remotefile: File name.
Description
Use the delete command to permanently delete a specified file on the remote FTP server.
To perform this operation, you must have delete permissions on the FTP server.
Examples
# Delete file temp.c.
[ftp] delete temp.c
250 DELE command successful.
dir
Syntax
dir [ remotefile [ localfile ] ]
View
FTP client view
Default level
3: Manage level
Parameters
remotefile: Name of the file or directory on the remote FTP server.
localfile: Name of the local file to save the displayed information.
Description
Use the dir command to view the detailed information of the files and subdirectories under the current directory on the remote FTP server.
Use the dir remotefile command to display the detailed information of the specified file or directory on the remote FTP server.
Use the dir remotefile localfile command to display the detailed information of the specified file or directory on the remote FTP server, and save the displayed information into a local file specified by the localfile argument.
|
NOTE: The Is command can only display the names of files and directories, whereas the dir command can display other related information of the files and directories, such as the size, and the date they were created. |
Examples
# View the detailed information of the files and subdirectories under the current directory on the remote FTP server.
[ftp] dir
227 Entering Passive Mode (192,168,1,46,5,68).
125 ASCII mode data connection already open, transfer starting for /*.
drwxrwxrwx 1 noone nogroup 0 Aug 08 2006 logfile
-rwxrwxrwx 1 noone nogroup 20471748 May 11 10:21 test.bin
-rwxrwxrwx 1 noone nogroup 4001 Dec 08 2007 config.cfg
-rwxrwxrwx 1 noone nogroup 3608 Jun 13 2007 startup.cfg
drwxrwxrwx 1 noone nogroup 0 Dec 03 2007 test
-rwxrwxrwx 1 noone nogroup 299 Oct 15 2007 key.pub
226 Transfer complete.
FTP: 394 byte(s) received in 0.189 second(s), 2.00K byte(s)/sec.
[ftp]
# View the information of the file router.cfg, and save the result to aa.txt.
[ftp] dir router.cfg aa.txt
227 Entering Passive Mode (192,168,1,50,17,158).
125 ASCII mode data connection already open, transfer starting for /router.cfg.
....226 Transfer complete.
FTP: 67 byte(s) received in 4.600 second(s), 14.00 byte(s)/sec.
# View the content of aa.txt.
[ftp] quit
<Sysname> more aa.txt
-rwxrwxrwx 1 noone nogroup 3077 Jun 20 15:34 router.cfg
disconnect
Syntax
disconnect
View
FTP client view
Default level
3: Manage level
Parameters
None
Description
Use the disconnect command to disconnect from the remote FTP server but remain in FTP client view.
This command is equal to the close command.
Examples
# Disconnect from the remote FTP server but remain in FTP client view.
[ftp] disconnect
221 Server closing.
[ftp]
display ftp client configuration
Syntax
display ftp client configuration [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
1: Monitor level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display ftp client configuration command to display the source IP address configuration of the FTP client.
Related commands: ftp client source.
Examples
# Display the source IP address configuration of the FTP client.
<Sysname> display ftp client configuration
The source IP address is 192.168.0.123
|
NOTE: The display ftp client configuration command displays the source IP address configuration of the FTP client. If the specified source IP address is active, this command displays the source IP address. If the specified source interface is active, this command displays the source interface. |
ftp
Syntax
ftp [ server-address [ service-port ] [ vpn-instance vpn-instance-name ] [ source { interface interface-type interface-number | ip source-ip-address } ] ]
View
User view
Default level
3: Manage level
Parameters
server-address: IP address or host name (a string of 1 to 20 characters) of a remote FTP server.
service-port: TCP port number of the remote FTP server, in the range of 0 to 65535. The default value is 21.
vpn-instance vpn-instance-name: Specifies the MPLS L3VPN that the FTP server belongs to. The vpn-instance-name argument is a case-sensitive string of 1 to 31 characters. If the FTP server is on the public network, do not specify this option.
source { interface interface-type interface-number | ip source-ip-address }: Specifies the source address used to establish an FTP connection.
· interface interface-type interface-number: Specifies the source interface by its type and number. The primary IP address configured on this interface is the source address of the transmitted FTP packets. If no primary IP address is configured on the source interface, the connection fails.
· ip source-ip-address: The source IP address of the transmitted FTP packets. This source address must be the one that has been configured on the device.
Description
Use the ftp command to log in to the remote FTP server and enter FTP client view.
This command applies to IPv4 networks only.
If you use this command without specifying any parameters, you will simply enter the FTP client view without logging in to the FTP server.
If you specify the parameters, you will be prompted to enter the username and password for accessing the FTP server.
Examples
# Log in the server 192.168.0.211. The source IP address of sent FTP packets is 192.168.0.212.
<Sysname> ftp 192.168.0.211 source ip 192.168.0.212
Trying 192.168.0.211 ...
Press CTRL+K to abort
Connected to 192.168.0.211.
220 FTP Server ready.
User(192.168.0.211:(none)):abc
331 Password required for abc
Password:
230 User logged in.
[ftp]
ftp client source
Syntax
ftp client source { interface interface-type interface-number | ip source-ip-address }
undo ftp client source
View
System view
Default level
2: System level
Parameters
interface interface-type interface-number: Specifies the source interface for establishing FTP connections. The primary IP address of the source interface is used as the source IP address of packets sent to an FTP server. If the source interface has no primary IP address specified, no FTP connection can be established.
ip source-ip-address: Specifies the source IP address of packets sent to an FTP server, which is one of the IP addresses of the device.
Description
Use the ftp client source command to specify the source IP address of packets sent to an FTP server.
Use the undo ftp client source command to restore the default.
By default, the source IP address is the IP address of the output interface of the route to the server is used as the source IP address.
If you use the ftp client source command to first configure a source interface and then a source IP address, the source IP address overwrites the source interface, and vice versa.
If you first use the ftp client source command to specify a source IP address and then use the ftp command to specify another source IP address, the latter is used.
The source IP address specified with the ftp client source command applies to all FTP connections while the one specified with the ftp command applies to the current FTP connection only.
Related commands: display ftp client configuration.
Examples
# Specify the source IP address of packets sent to an FTP server as 2.2.2.2.
<Sysname> system-view
[Sysname] ftp client source ip 2.2.2.2
# Specify the IP address of interface GigabitEthernet 3/0/1 as the source IP address of packets sent to an FTP server. (The interface must work at Layer 3.)
<Sysname> system-view
[Sysname] ftp client source interface GigabitEthernet 3/0/1
[Sysname]
ftp ipv6
Syntax
ftp ipv6 [ server-address [ service-port ] [ vpn-instance vpn-instance-name ] [ source ipv6 source-ipv6-address ] [ -i interface-type interface-number ] ]
View
User view
Default level
3: Manage level
Parameters
server-address: IP address or host name of the remote FTP server.
service-port: TCP port number of the FTP server, in the range of 0 to 65535. The default value is 21.
source ipv6 source-ipv6-address: Specifies a source IPv6 address for transmitted FTP packets. This address must be an IPv6 address that has been configured on the device.
-i interface-type interface-number: Specifies an output interface by its type and number. This parameter 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 the configuration of link local addresses, see Layer 3—IP Services Configuration Guide.
vpn-instance vpn-instance-name: Specifies the MPLS L3VPN that the FTP server belongs to. The vpn-instance-name argument is a case-sensitive string of 1 to 31 characters. If the FTP server is on the public network, do not specify this option.
Description
Use the ftp ipv6 command to log in to the FTP server and enter FTP client view.
This command applies to IPv6 networks only.
If you use this command without specifying any parameters, you will simply enter the FTP client view without logging in to an FTP server.
If you specify the parameters, enter the username and password for accessing the FTP server.
Examples
# Log in to the FTP server with IPv6 address 3000::200.
<Sysname> ftp ipv6 3000::200
Trying 3000::200 ...
Press CTRL+K to abort
Connected to 3000::200.
220 Welcome!
User(3000::200:(none)): MY_NAME
331 Please specify the password.
Password:
230 Login successful.
[ftp]
# Log in to the FTP server with IPv6 address 3000::200 in VPN 1.
<Sysname> ftp ipv6 3000::200 vpn-instance vpn1
Trying 3000::200 ...
Press CTRL+K to abort
Connected to 3000::200.
220 Welcome!
User(3000::200:(none)): MY_NAME
331 Please specify the password.
Password:
230 Login successful.
[ftp]
get
Syntax
get remotefile [ localfile ]
View
FTP client view
Default level
3: Manage level
Parameters
remotefile: Name of the file to be downloaded.
localfile: File name used after a file is downloaded and saved locally. If this argument is not specified, the local file uses the name of the source file on the FTP server by default.
Description
Use the get command to download a file from a remote FTP server and save it.
Examples
# Download file testcfg.cfg and save it as aa.cfg.
[ftp] get testcfg.cfg aa.cfg
227 Entering Passive Mode (192,168,1,50,17,163).
125 ASCII mode data connection already open, transfer starting for /testcfg.cfg.
.....226 Transfer complete.
FTP: 5190 byte(s) received in 7.754 second(s), 669.00 byte(s)/sec.
lcd
Syntax
lcd
View
FTP client view
Default level
3: Manage level
Parameters
None
Description
Use the lcd command to display the local working directory of the FTP client.
Examples
# Display the local working directory.
[ftp] lcd
FTP: Local directory now flash:/clienttemp.
The output shows that the working directory of the FTP client before execution of the ftp command is flash:/clienttemp.
ls
Syntax
ls [ remotefile [ localfile ] ]
View
FTP client view
Default level
3: Manage level
Parameters
remotefile: Filename or directory on the remote FTP server.
localfile: Name of a local file used to save the displayed information.
Description
Use the ls command to view the information of all the files and subdirectories in the current directory of the remote FTP server. The file names and subdirectory names are displayed.
Use the ls remotefile command to view the information of a specified file or subdirectory.
Use the ls remotefile localfile command to view the information of a specified file or subdirectory, and save the result to a local file specified by the localfile argument.
|
NOTE: The ls command can only display the names of files and directories on the FTP server, whereas the dir command can display other related information of the files and directories, such as the size, and the date they were created. |
Examples
# View the information of all files and subdirectories under the current directory of the FTP server.
[ftp] ls
227 Entering Passive Mode (192,168,1,50,17,165).
125 ASCII mode data connection already open, transfer starting for /*.
router.cfg
logfile
mainar.bin
arbasicbtm.bin
ftp
test
bb.cfg
testcfg.cfg
226 Transfer complete.
FTP: 87 byte(s) received in 0.132 second(s) 659.00 byte(s)/sec.
# View the information of directory logfile.
[ftp] ls logfile
227 Entering Passive Mode (192,168,1,50,10,49).
125 ASCII mode data connection already open, transfer starting for /logfile/*.
logfile.log
a.cfg
226 Transfer complete.
FTP: 20 byte(s) received in 0.075 second(s), 266.00 byte(s)/sec.
# Save the result to file aa.txt.
[ftp] ls logfile aa.txt
227 Entering Passive Mode (192,168,1,50,4,3).
125 ASCII mode data connection already open, transfer starting for /logfile/*.
....226 Transfer complete.
FTP: 20 byte(s) received in 3.962 second(s), 5.00 byte(s)/sec.
# View the content of file aa.txt.
[ftp] quit
221 Server closing.
<Sysname> more aa.txt
logfile.log
a.cfg
<Sysname>
mkdir
Syntax
mkdir directory
View
FTP client view
Default level
3: Manage level
Parameters
directory: Name of the directory to be created.
Description
Use the mkdir command to create a subdirectory in the current directory on the remote FTP server.
You can do this only if you have permissions on the FTP server.
Examples
# Create subdirectory mytest on the current directory of the remote FTP server.
[ftp] mkdir mytest
257 "/mytest" new directory created.
[ftp]
open
Syntax
open server-address [ service-port ]
View
FTP client view
Default level
3: Manage level
Parameters
server-address: IP address or host name of a remote FTP server.
service-port: Port number of the remote FTP server, in the range of 0 to 65535. The default value is 21.
Description
Use the open command to log in to the IPv4 FTP server under FTP client view.
At login, enter the username and password. If your input is correct, the login succeeds.
If you have logged in to the IPv4 FTP server, you cannot use the open command to log in to another server. To do so, you must disconnect from the current server first.
Related commands: close.
Examples
# In FTP client view, log in to the FTP server with the IP address of 192.168.1.50.
<Sysname> ftp
[ftp] open 192.168.1.50
Trying 192.168.1.50 ...
Press CTRL+K to abort
Connected to 192.168.1.50.
220 FTP service ready.
User(192.168.1.50:(none)):aa
331 Password required for aa.
Password:
230 User logged in.
[ftp]
open ipv6
Syntax
open ipv6 server-address [ service-port ] [ -i interface-type interface-number ]
View
FTP client view
Default level
3: Manage level
Parameters
server-address: IP address or host name of the remote FTP server.
service-port: Port number of the remote FTP server, in the range of 0 to 65535. The default value is 21.
-i interface-type interface-number: Specifies an output interface by its type and number. This parameter 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 the configuration of link local addresses, see Layer 3—IP Services Configuration Guide.
Description
Use the open ipv6 command to log in to the IPv6 FTP server in FTP client view.
At login, enter the username and password for accessing the FTP server. If your input is correct, the login succeeds.
Related commands: close.
Examples
# Log in to the FTP server (with IPv6 address 3000::200) in FTP client view.
<Sysname> ftp
[ftp] open ipv6 3000::200
Trying 3000::200 ...
Press CTRL+K to abort
Connected to 3000::200.
220 Welcome!
User(3000::200:(none)): MY_NAME
331 Please specify the password.
Password:
230 Login successful.
[ftp]
passive
Syntax
passive
undo passive
View
FTP client view
Default level
3: Manage level
Parameters
None
Description
Use the passive command to set the data transmission mode to passive.
Use the undo passive command to set the data transmission mode to active.
The default transmission mode is passive.
Data transmission modes fall into the passive mode and the active mode. In active mode, the FTP server initiates a data connection request. In passive mode, the FTP client initiates a data connection request. This command is mainly used in conjunction with a firewall to restrict FTP session establishment between private and public network users.
Examples
# Set the data transmission mode to passive.
[ftp] passive
FTP: passive is on
[ftp]
put
Syntax
put localfile [ remotefile ]
View
FTP client view
Default level
3: Manage level
Parameters
localfile: Name of the local file to be uploaded.
remotefile: File name used after a file is uploaded and saved on the FTP server.
Description
Use the put command to upload a file on the client to the remote FTP server.
By default, if no name is assigned to the file to be saved on the FTP server, the name of the source file is used.
After a file is uploaded, it will be saved under the user’s authorized directory, which can be set with the authorization-attribute command on the remote server.
Examples
# Upload source file cc.txt to the remote FTP server and save it as dd.txt.
[ftp] put cc.txt dd.txt
227 Entering Passive Mode (192,168,1,50,17,169).
125 ASCII mode data connection already open, transfer starting for /dd.txt.
226 Transfer complete.
FTP: 9 byte(s) sent in 0.112 second(s), 80.00 byte(s)/sec.
pwd
Syntax
pwd
View
FTP client view
Default level
3: Manage level
Parameters
None
Description
Use the pwd command to display the currently accessed directory on the remote FTP server.
Examples
# Display the currently accessed directory on the remote FTP server.
[ftp] cd servertemp
[ftp] pwd
257 "/servertemp" is current directory.
The output shows that the servertemp folder under the FTP root directory is being accessed by the user.
quit
Syntax
quit
View
FTP client view
Default level
3: Manage level
Parameters
None
Description
Use the quit command to disconnect the FTP client from the remote FTP server and exit to user view.
Examples
# Disconnect from the remote FTP server and exit to user view.
[ftp] quit
221 Server closing.
<Sysname>
remotehelp
Syntax
remotehelp [ protocol-command ]
View
FTP client view
Default level
3: Manage level
Parameters
protocol-command: FTP command.
Description
Use the remotehelp command to display the help information of FTP-related commands supported by the remote FTP server.
If no argument is specified, FTP-related commands supported by the remote FTP server are displayed.
Examples
# Display FTP commands supported by the remote FTP server.
[ftp] remotehelp
214-Here is a list of available ftp commands
Those with '*' are not yet implemented.
USER PASS ACCT* CWD CDUP SMNT* QUIT REIN*
PORT PASV TYPE STRU* MODE* RETR STOR STOU*
APPE* ALLO* REST* RNFR* RNTO* ABOR* DELE RMD
MKD PWD LIST NLST SITE* SYST STAT* HELP
NOOP* XCUP XCWD XMKD XPWD XRMD
214 Direct comments to H3C company.
# Display the help information for the user command.
[ftp] remotehelp user
214 Syntax: USER <sp> <username>.
[ftp]
Table 4 Output description
Field |
Description |
USER |
Username |
PASS |
Password |
CWD |
Change the current working directory |
CDUP |
Change to parent directory |
SMNT* |
File structure setting |
QUIT |
Quit |
REIN* |
Re-initialization |
PORT |
Port number |
PASV |
Passive mode |
TYPE |
Request type |
STRU* |
File structure |
MODE* |
Transmission mode |
RETR |
Download a file |
STOR |
Upload a file |
STOU* |
Store unique |
APPE* |
Appended file |
ALLO* |
Allocation space |
REST* |
Restart |
RNFR* |
Rename the source |
RNTO* |
Rename the destination |
ABOR* |
Abort the transmission |
DELE |
Delete a file |
RMD |
Delete a folder |
MKD |
Create a folder |
PWD |
Print working directory |
LIST |
List files |
NLST |
List file description |
SITE* |
Locate a parameter |
SYST |
Display system parameters |
STAT* |
State |
HELP |
Help |
NOOP* |
No operation |
XCUP |
Extension command, the same meaning as CDUP |
XCWD |
Extension command, the same meaning as CWD |
XMKD |
Extension command, the same meaning as MKD |
XPWD |
Extension command, the same meaning as PWD |
XRMD |
Extension command, the same meaning as RMD |
Syntax: USER <sp> <username>. |
Syntax of the user command: user (keyword) + space + username |
rmdir
Syntax
rmdir directory
View
FTP client view
Default level
3: Manage level
Parameters
directory: Directory name on the remote FTP server.
Description
Use the rmdir command to remove a specified directory from the FTP server.
|
NOTE: · Only authorized users are allowed to use this command. · Delete all files and subdirectories under a directory before you delete the directory. For how to delete files, see the delete command. · When you execute the rmdir command, the files in the remote recycle bin in the directory will be automatically deleted. |
Examples
# Delete the temp1 directory from the FTP root directory.
[ftp] rmdir /temp1
200 RMD command successful.
[ftp]
user
Syntax
user username [ password ]
View
FTP client view
Default level
3: Manage level
Parameters
username: Login username.
password: Login password. You can input this argument a space after the username argument; or you can input this argument when the “Password:” prompt appears after you input the username and then press Enter.
Description
Use the user command to relog in to the currently accessed FTP server with another username.
|
NOTE: Before using this command, you must configure the corresponding username and password on the FTP server or the login will fail and the FTP connection will close. |
Examples
# User ftp1 has logged in to the FTP server. Use username ftp2 to log in to the current FTP server. (Suppose username ftp2 and password 123123123123 have been configured on the FTP server).
· Method 1
[ftp] user ftp2
331 Password required for ftp2.
Password:
230 User logged in.
[ftp]
· Method 2
[ftp] user ftp2 123123123123
331 Password required for ftp.
230 User logged in.
[ftp]
verbose
Syntax
verbose
undo verbose
View
FTP client view
Default level
3: Manage level
Parameters
None
Description
Use the verbose command to enable display of detailed prompt information received from the server.
Use the undo verbose command to disable display of detailed prompt information.
By default, the display of detailed prompt information is enabled.
Examples
# Enable display of detailed prompt information.
[ftp] verbose
FTP: verbose is on
# Disable display of detailed prompt information. and perform a Get operation.
[ftp] undo verbose
FTP: verbose is off
[ftp] get startup.cfg bb.cfg
FTP: 3608 byte(s) received in 0.052 second(s), 69.00K byte(s)/sec.
[ftp]
# Enable display of detailed prompt information. and perform a Get operation.
[ftp] verbose
FTP: verbose is on
[ftp] get startup.cfg aa.cfg
227 Entering Passive Mode (192,168,1,46,5,85).
125 ASCII mode data connection already open, transfer starting for /startup.cfg.
226 Transfer complete.
FTP: 3608 byte(s) received in 0.193 second(s), 18.00K byte(s)/sec.
display tftp client configuration
Syntax
display tftp client configuration [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
1: Monitor level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display tftp client configuration command to display source IP address configuration of the TFTP client.
Related commands: tftp client source.
Examples
# Display the source IP address configuration of the TFTP client.
<Sysname> display tftp client configuration
The source IP address is 192.168.0.123
|
NOTE: The display tftp client configuration command displays the source IP address configuration of the TFTP client. If the specified source IP address is active, this command displays the source IP address. If the specified source interface is active, this command displays the source interface. |
tftp-server acl
Syntax
tftp-server [ ipv6 ] acl acl-number
undo tftp-server [ ipv6 ] acl
View
System view
Default level
3: Manage level
Parameters
ipv6: References an IPv6 ACL. If it is not specified, an IPv4 ACL is referenced.
acl-number: Number of a basic ACL, in the range of 2000 to 2999.
Description
Use the tftp-server acl command to control the device’s access to a specific TFTP server using an ACL.
Use the undo tftp-server acl command to restore the default.
By default, no ACL is used to control the device’s access to TFTP servers.
You can use an ACL to deny or permit the device’s access to a specific TFTP server.
For more information about ACL, see ACL and QoS Configuration Guide.
Examples
# Allow the device to access the TFTP server with the IP address of 1.1.1.1 only (in IPv4 networking environment).
<Sysname> system-view
[Sysname] acl number 2000
[Sysname-acl-basic-2000] rule permit source 1.1.1.1 0
[Sysname-acl-basic-2000] quit
[Sysname] tftp-server acl 2000
# Allow the device to access the TFTP server with the IP address of 2001::1 only (in IPv6 networking environment).
<Sysname> system-view
[Sysname] acl ipv6 number 2001
[Sysname-acl6-basic-2001] rule permit source 2001::1/128
[Sysname-acl6-basic-2001] quit
[Sysname] tftp-server ipv6 acl 2001
[Sysname]
tftp
Syntax
tftp server-address { get | put | sget } source-filename [ destination-filename ] [ vpn-instance vpn-instance-name ] [ source { interface interface-type interface-number | ip source-ip-address } ]
View
User view
Default level
3: Manage level
Parameters
server-address: IP address or host name of a TFTP server.
get: Downloads a file in normal mode.
put: Uploads a file.
sget: Downloads a file in secure mode.
source-filename: Source file name.
destination-filename: Destination file name. If this argument is not specified, the file uses the source file name, and is saved in the directory where the user performed the TFTP operation.
vpn-instance vpn-instance-name: Specifies the MPLS L3VPN where the TFTP server belongs. The vpn-instance-name argument is a case-sensitive string of 1 to 31 characters. If the TFTP server is on the public network, do not specify this option.
source: Configures parameters for source address binding.
· interface interface-type interface-number: Specifies the source interface by its type and number. The primary IP address configured on the source interface is the source IP address of the packets sent by TFTP. If no primary IP address is configured on the source interface, the transmission fails.
· ip source-ip-address: Specifies the source IP address for the current TFTP client to transmit packets. This source address must be an IP address that has been configured on the device.
Description
Use the tftp command to download a specified file from the TFTP server to the local device or upload a specified local file to the TFTP server in an IPv4 network.
Examples
· In standalone mode
# Download the config.cfg file from the TFTP server with the IP address of 192.168.0.98 and save it as config.bak. Specify the source IP address to be 192.168.0.92.
<Sysname> tftp 192.168.0.98 get config.cfg config.bak source ip 192.168.0.92
...
File will be transferred in binary mode
Downloading file from remote TFTP server, please wait....
TFTP: 372800 bytes received in 1 second(s)
File downloaded successfully.
· In IRF mode
# To upgrade the device, download the newest.bin file from the TFTP server with the IP address of 192.168.1.26 and save it to both the root directory on the flash of the AMB and the root directory on the flash of the SMB.
<Sysname> tftp 192.168.1.26 get newest.bin startup.bin
.
File will be transferred in binary mode
Downloading file from remote TFTP server, please wait..................
TFTP: 2737556 bytes received in 13 second(s)
File downloaded successfully.
// Download the file from the TFTP server to the root directory on the flash of the master.
<Sysname> tftp 192.168.1.26 get newest.bin chassis2#slot1#flash:/startup.bin
File will be transferred in binary mode
Downloading file from remote TFTP server, please wait...|
TFTP: 2737556 bytes received in 14 second(s)
File downloaded successfully.
// Download the file from the TFTP server to the root directory on the flash of the SMB.
tftp client source
Syntax
tftp client source { interface interface-type interface-number | ip source-ip-address }
undo tftp client source
View
System view
Default level
2: System level
Parameters
interface interface-type interface-number: Specifies the source interface for establishing TFTP connections. The primary IP address of the source interface is used as the source IP address of packets sent to a TFTP server. If the source interface has no primary IP address specified, no TFTP connection can be established.
ip source-ip-address: Specifies the source IP address of packets sent to a TFTP server, which is one of the IP addresses configured on the device.
Description
Use the tftp client source command to specify the source IP address of packets sent to a TFTP server.
Use the undo tftp client source command to restore the default.
By default, the source IP address is the IP address of the output interface of the route to the server is used as the source IP address..
If you use the tftp client source command to first configure a source interface and then a source IP address, the source IP address overwrites the source interface, and vice versa.
If you first use the tftp client source command to specify a source IP address and then use the tftp command to specify another source IP address, the latter is used.
The source IP address specified with the tftp client source command applies to all TFTP connections while the one specified with the tftp command applies to the current TFTP connection only.
Related commands: display tftp client configuration.
Examples
# Specify the source IP address of packets sent a TFTP server as 2.2.2.2.
<Sysname> system-view
[Sysname] tftp client source ip 2.2.2.2
# Specify the IP address of interface GigabitEthernet 3/0/1 as the source IP address of packets sent to a TFTP server. (The interface must work at Layer 3.)
<Sysname> system-view
[Sysname] tftp client source interface GigabitEthernet 3/0/1
[Sysname]
tftp ipv6
Syntax
tftp ipv6 tftp-ipv6-server [ -i interface-type interface-number ] { get | put } source-filename [ destination-filename ] [ vpn-instance vpn-instance-name ]
View
User view
Default level
3: Manage level
Parameters
tftp-ipv6-server: IPv6 address or host name (a string of 1 to 46 characters) of a TFTP server.
-i interface-type interface-number: Specifies an output interface by its type and number. This parameter 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 the configuration of a link local address, see IPv6 basics configuration in the Layer 3—IP Services Configuration Guide.
get: Downloads a file.
put: Uploads a file.
source-file: Source filename.
destination-file: Destination filename. If not specified, this filename is the same as the source filename.
vpn-instance vpn-instance-name: Specifies the MPLS L3VPN that the TFTP server belongs to. The vpn-instance-name argument is a case-sensitive string of 1 to 31 characters. If the TFTP server is on the public network, do not specify this option.
Description
Use the tftp ipv6 command to download a specified file from a TFTP server or upload a specified local file to a TFTP server in an IPv6 network.
Examples
# Download filetoget.txt from the TFTP server.
<Sysname> tftp ipv6 fe80::250:daff:fe91:e058 -i GigabitEthernet3/0/1 get filetoget.txt
...
File will be transferred in binary mode
Downloading file from remote TFTP server, please wait....
TFTP: 411100 bytes received in 2 second(s)