H3C S3600 Series EPON OLT Switches Command Manual-Release 3103-6W100

31-File System Management Commands

Chapters Download  (194.54 KB)

31-File System Management Commands


 

For the qualified filename formats, refer to File System Management Configuration in the System Volume.

 

File System Configuration Commands

cd

Syntax

cd directory

View

User view

Default Level

3: Manage level

Parameters

directory: Name of the target directory.

Description

Use the cd command to change the current working directory.

Examples

# Enter the test folder after logging in to the device.

<Sysname> cd test

# Return to the upper directory (Remember to enter a space after the keyword cd).

<Sysname> cd ..

# Return to the root directory.

<Sysname> cd /

copy

Syntax

copy fileurl-source fileurl-dest

View

User view

Default Level

3: Manage level

Parameters

fileurl-source: Name of the source file.

fileurl-dest: Name of the target file or folder.

Description

Use the copy command to copy a file.

If you specify a target folder, the system will copy the file to the specified folder and use the name of the source file as the file name.

Examples

# Copy file testcfg.cfg under the current folder and save it as testbackup.cfg.

<Sysname> copy testcfg.cfg testbackup.cfg

Copy flash:/test.cfg to flash:/testbackup.cfg?[Y/N]:y

....

%Copy file flash:/test.cfg to flash:/testbackup.cfg...Done.

delete

Syntax

delete [ /unreserved ] file-url

View

User view

Default Level

3: Manage level

Parameters

/unreserved: Permanently deletes the specified file, and the deleted file can never be restored.

file-url: Name of the file to be deleted. Asterisks (*) are acceptable as wildcards. For example, to remove files with the extension of .txt in the current directory, you may use the delete *.txt command.

Description

Use the delete command to move a specified file from a storage device to the recycle bin, where you can restore the file with the undelete command or permanently delete it with the reset recycle-bin command.

The dir /all command can display the files moved to the recycle bin. These files are enclosed in pairs of brackets.

This command supports the wildcard *.

 

If you delete two files in different directories but with the same filename, only the last one is retained in the recycle bin.

 

Examples

# Remove file tt.cfg from the root directory.

<Sysname> delete tt.cfg

Delete flash:/tt.cfg? [Y/N]:y

.

%Delete file flash:/tt.cfg...Done.

dir

Syntax

dir [ /all ] [ file-url ]

View

User view

Default Level

3: Manage level

Parameters

/all: Displays all files (including those in the recycle bin).

file-url: Name of the file or directory to be displayed. Asterisks (*) are acceptable as wildcards. For example, to display files with the .txt extension under the current directory, you may use the dir *.txt command.

Description

Use the dir command to display information about all visible files and folders in the current directory.

Use the dir /all command to display information about all files and folders in the current directory, including hidden files, hidden sub-folders and the files in the recycle bin that originally belong to the current directory. The names of these deleted files are enclosed in pairs of brackets [ ].

The dir file-url command displays information about a file or folder.

This command supports the wildcard *.

Examples

<Sysname> dir /all

Directory of flash:/

 

   0     -rw-   9326176  Apr 26 2000 12:11:45   s3600-v3r1b1d059sp02_a0.app

   1     -rwh       440  Apr 26 2000 12:02:19   private-data.txt

   2     -rw-       776  Apr 26 2000 12:02:29   startup.cfg

   3     -rwh       548  Apr 26 2000 14:09:44   dsakey

 

30226 KB total (21113 KB free)

execute

Syntax

execute filename

View

System view

Default Level

2: System level

Parameters

filename: Name of a batch file with a .bat extension.

Description

Use the execute command to execute the specified batch file.

Batch files are command line files. Executing a batch file is to execute a set of command lines in the file.

l          You should not include invisible characters in a batch file. If an invisible character is found during the execution, the batch process will abort and the commands that have been executed cannot be cancelled.

l          Not every command in a batch file is sure to be executed. For example, if a certain command is not correctly configured, the system omits this command and goes to the next one.

l          The configuration generated after a batch file is executed will not be backed up to the standby main board automatically.

l          Each configuration command in a batch file must be a standard configuration command, meaning that the valid configuration information can be displayed with the display current-configuration command after this command is configured successfully; otherwise, this command may not be executed correctly.

Examples

# Execute the batch file test.bat in the root directory.

<Sysname> system-view

[Sysname] execute test.bat

file prompt

Syntax

file prompt { alert | quiet }

View

System view

Default Level

3: Manage level

Parameters

alert: Enables the system to warn you about operations that may bring undesirable results such as file corruption or data loss.

quiet: Disables the system from warning you about any operation.

Description

Use the file prompt command to set a prompt mode for file operations.

By default, the prompt mode is alert.

Note that when the prompt mode is set to quiet, the system does not warn for any file operation. To avoid undesirable consequences resulting from misoperation, you are recommended to use the alert mode.

Examples

# Set the file operation prompt mode to alert.

<Sysname> system-view

[Sysname] file prompt alert

fixdisk

Syntax

fixdisk device

View

User view

Default Level

3: Manage level

Parameters

device: Storage device name.

Description

Use the fixdisk command to restore the space of a storage device when it becomes unavailable because of some abnormal operation.

Examples

# Restore the space of the flash.

<Sysname> fixdisk flash:

format

Syntax

format device

View

User view

Default Level

3: Manage level

Parameters

device: Name of a storage device.

Description

Use the format command to format a storage device.

 

l          Formatting a storage device results in loss of all the files on the storage device and these files cannot be restored. In particular, if there is a startup configuration file on a storage device, formatting the storage device results in loss of the startup configuration file.

 

Examples

# Format the flash.

<Sysname> format flash:

All data on flash: will be lost, proceed with format? [Y/N]:y

./

%Format flash: completed.

mkdir

Syntax

mkdir directory

View

User view

Default Level

3: Manage level

Parameters

directory: Name of a folder.

Description

Use the mkdir command to create a folder under a specified directory on the storage device.

Note that:

l          The name of the folder to be created must be unique under the specified directory. Otherwise, you will fail to create the folder under the directory.

l          To use this command to create a folder, the specified directory must exist. For instance, to create folder flash:/test/mytest, the test folder must exist. Otherwise, you will fail to create folder mytest.

Examples

# Create a folder named test.

<Sysname> mkdir test

....

%Created dir flash:/test

# Create folder test/subtest.

<Sysname> mkdir test/subtest

....

%Created dir flash:/test/subtest

more

Syntax

more file-url

View

User view

Default Level

3: Manage level

Parameters

file-url: File name.

Description

Use the more command to display the contents of the specified file.

So far, this command is valid only for text files.

Examples

# Display the contents of file test.txt.

<Sysname> more test.txt

Welcome to H3C.

# Display the contents of file testcfg.cfg.

<Sysname> more testcfg.cfg

 

#

 version 5.20, Beta 1201, Standard

#

 sysname Sysname

#

vlan 2

#

return

<Sysname>

move

Syntax

move fileurl-source fileurl-dest

View

User view

Default Level

3: Manage level

Parameters

fileurl-source: Name of the source file.

fileurl-dest: Name of the target file or folder.

Description

Use the move command to move a file.

If you specify a target folder, the system will move the source file to the specified folder, with the file name unchanged.

Examples

# Move file flash:/test/sample.txt to flash:/, and save it as 1.txt.

<Sysname> move test/sample.txt 1.txt

Move flash:/test/sample.txt to flash:/1.txt?[Y/N]:y

...

% Moved file flash:/test/sample.txt to flash:/1.txt

# Move file b.cfg to the subfolder test2.

<Sysname> move b.cfg test2

Move flash:/b.cfg to flash:/test2/b.cfg?[Y/N]:y

.

%Moved file flash:/b.cfg to flash:/test2/b.cfg.

pwd

Syntax

pwd

View

User view

Default Level

3: Manage level

Parameters

None

Description

Use the pwd command to display the current path.

Examples

# Display the current path.

<Sysname> pwd

flash:

rename

Syntax

rename fileurl-source fileurl-dest

View

User view

Default Level

3: Manage level

Parameters

fileurl-source: Name of the source file or folder.

fileurl-dest: Name of the target file or folder.

Description

Use the rename command to rename a file or folder.

The target file name must be unique under the current path.

Examples

# Rename file sample.txt as sample.bak.

<Sysname> rename sample.txt sample.bak

Rename flash:/sample.txt to flash:/sample.bak? [Y/N]:y

 

% Renamed file flash:/sample.txt to flash:/sample.bak

reset recycle-bin

Syntax

reset recycle-bin [ /force ]

View

User view

Default Level

3: Manage level

Parameters

/force: Deletes all files in the recycle bin, including files that cannot be deleted by the command without the /force keyword.

Description

Use the reset recycle-bin command to permanently delete the files in the recycle bin in the current directory.

If a file is corrupted, you may not be able to delete the file using the reset recycle-bin command. In this case, you can use the reset recycle-bin /force command, which can delete all the files in the recycle bin forcibly.

Unlike this command, the delete file-url command only moves a file to the recycle bin. To delete the file in the recycle bin, you need to execute the reset recycle-bin command in the original directory of the file.

Examples

# There are three files flash:/a.cfg, flash:/b.cfg, and flash:/test/c.cfg in the recycle bin. Permanently delete file flash:/a.cfg and flash:/b.cfg.

l          Display all the files in the recycle bin in directory flash:.

<Sysname> dir /all

Directory of flash:/

 

   0     -rwh      3080  Apr 26 2000 16:41:43   private-data.txt

   1     -rw-      2416  Apr 26 2000 13:45:36   config.cfg

   2     -rw-   8036197  May 14 2000 10:13:18   main.bin

   3     -rw-      2386  Apr 26 2000 13:30:30   back.cfg

   4     drw-         -  May 08 2000 09:49:25   test

   5     -rwh       716  Apr 24 2007 16:17:30   hostkey

   6     -rwh       572  Apr 24 2007 16:17:44   serverkey

   7     -rw-      2386  May 08 2000 11:14:20   [a.cfg]

   8     -rw-      3608  Dec 03 2007 17:29:30   [b.cfg]

 

30226 KB total (21110 KB free)

//The above information indicates that in directory flash:, there are two files a.cfg and b.cfg in the recycle bin.

l          Delete the files in directory flash: that are already in the recycle bin.

<Sysname> reset recycle-bin

Clear flash:/~/a.cfg ?[Y/N]:y

Clearing files from flash may take a long time. Please wait...

....

%Cleared file flash:/~/a.cfg.

Clear flash:/~/b.cfg ?[Y/N]:y

Clearing files from flash may take a long time. Please wait...

......

%Cleared file flash:/~/b.cfg...

l          In directory flash:, check whether all the files in the recycle bin are deleted.

<Sysname> dir /all

Directory of flash:/

 

   0     -rwh      3080  Apr 26 2000 16:41:43   private-data.txt

   1     -rw-      2416  Apr 26 2000 13:45:36   config.cfg

   2     -rw-   8036197  May 14 2000 10:13:18   main.bin

   3     -rw-      2386  Apr 26 2000 13:30:30   back.cfg

   4     drw-         -  May 08 2000 09:49:25   test

   5     -rwh       716  Apr 24 2007 16:17:30   hostkey

   6     -rwh       572  Apr 24 2007 16:17:44   serverkey

 

30226 KB total (6734 KB free)

// The above information indicates that file flash:/a.cfg and flash:/b.cfg are deleted permanently.

l          In directory flash:/test, see whether the file in the recycle bin is deleted or not.

<Sysname> cd test

<Sysname> dir /all

Directory of flash:/test/

 

   0     drw-         -  Dec 03 2007 18:19:09   subtest

   1     -rw-      2386  Dec 03 2007 18:43:41   [c.cfg]

 

30226 KB total (6734 KB free)

// The above information indicates that file flash:/test/c.cfg is not deleted permanently and is still in the recycle bin.

rmdir

Syntax

rmdir directory

View

User view

Default Level

3: Manage level

Parameters

directory: Name of the folder.

Description

Use the rmdir command to remove a folder.

l          The folder must be an empty one. If not, you need to delete all files and subfolders under it with the delete command.

l          After you execute the rmdir command successfully, the files in the recycle bin under the folder will be automatically deleted.

Examples

# Remove folder mydir.

<Sysname> rmdir mydir

Rmdir flash:/mydir?[Y/N]:y

 

%Removed directory flash:/mydir.

undelete

Syntax

undelete file-url

View

User view

Default Level

3: Manage level

Parameters

file-url: Name of the file to be restored.

Description

Use the undelete command to restore a file from the recycle bin.

If another file with the same name exists under the same path, the undelete operation will cause it to be overwritten and the system will prompt you whether to continue.

Examples

# Restore file a.cfg in directory flash: from the recycle bin.

<Sysname> undelete a.cfg

Undelete flash:/a.cfg?[Y/N]:y

.....

%Undeleted file flash:/a.cfg.

# Restore file b.cfg in directory flash:/test from the recycle bin.

<Sysname> undel flash:/test/b.cfg

Undelete flash:/test/b.cfg?[Y/N]:y

.......

%Undeleted file flash:/test/b.cfg.

Or, you can use the following steps to restore file flash:/test/b.cfg.

<Sysname> cd test

<Sysname> undelete b.cfg

Undelete flash:/test/b.cfg?[Y/N]:y

.....

%Undeleted file flash:/test/b.cfg.

Configuration File Management Commands

backup startup-configuration

Syntax

backup startup-configuration to dest-addr [ dest-filename ]

View

User view

Default Level

2: System level

Parameters

dest-addr: IP address or name of a TFTP server. The address cannot be an IPv6 address.

dest-filename: Target filename used to save the startup configuration file for the next system startup on the server.

Description

Use the backup startup-configuration command to back up the startup configuration file (used at the next system startup) using a filename you specify. If you do not specify this filename, the original filename is used.

Presently, the device uses TFTP to back up configuration files.

Examples

# Back up the startup configuration file of the device to the TFTP server with IP address 2.2.2.2, using filename 192-168-1-26.cfg.

<Sysname> display startup

  Current startup saved-configuration file:          flash:/config.cfg

  Next startup saved-configuration file:             flash:/test.cfg

<Sysname> backup startup-configuration to 2.2.2.2 192-168-1-26.cfg

Backup next startup-configuration file to 2.2.2.2, please wait…

finished!

<Sysname>

After the above operation, the device backs up file test.cfg to TFTP server 2.2.2.2, where the file is saved as 192-168-1-26.cfg.

display saved-configuration

Syntax

display saved-configuration [ by-linenum ]

View

Any view

Default Level

2: System level

Parameters

by-linenum: Identifies each line of displayed information with a line number.

Description

Use the display saved-configuration command to display the contents of the configuration file saved for the next startup of the device.

During device management and maintenance, you can use this command to check whether important configurations are saved to the configuration file to be used for the next startup of the device.

l          For a distributed device, this command displays the contents of the configuration file saved on the AMB for the next system startup.

l          For a device supporting main and backup configuration files, this command displays the main configuration file to be used for the next system startup.

l          For a device not supporting main and backup configuration files, this command displays the configuration file to be used for the next system startup.

If the system is not specified with a configuration file for the next startup or the specified configuration file does not exist, no information will be displayed when you execute the display saved-configuration command.

Related commands: save, reset saved-configuration; display current-configuration in Basic System Configuration Commands in the System Volume.

Examples

# Display the configuration file saved for the next startup of the device.

<Sysname> display saved-configuration

#

 version 5.20, Test 5310

#

 sysname Sysname

#

 domain default enable system

#

 telnet server enable

#

 multicast routing-enable

#

vlan 1

#

vlan 999

#

domain system

 access-limit disable

 state active

 idle-cut disable

 self-service-url disable

#

interface NULL0

#

  ---- More ----

The configurations are displayed in the order of global, port, and user interface. “  ---- More ----” means that all information on this screen has been displayed, and if you press the Space key, the next screen will be displayed.

# Display the contents of the configuration file saved for the next startup of the device with a number identifying each line.

<Sysname> display saved-configuration by-linenum

    1:  #

    2:   version 5.20, Test 5310

    3:  #

    4:   sysname Sysname

    5:  #

    6:   domain default enable system

    7:  #

    8:   telnet server enable

    9:  #

   10:   multicast routing-enable

   11:  #

   12:  vlan 1

   13:  #

   14:  vlan 999

   15:  #

   16:  domain system

   17:   access-limit disable

   18:   state active

   19:   idle-cut disable

   20:   self-service-url disable

   21:  #

   22:  interface NULL0

   23:  #

  ---- More ----

 “  ---- More ----” means that all information on this screen has been displayed, and if you press the Space key, the next screen will be displayed.

display startup

Syntax

display startup

View

Any view

Default Level

1: Monitor level

Parameters

None

Description

Use the display startup command to display the configuration file used at the current system startup and the configuration file(s) to be used at the next system startup, and also the enabled/disabled status of the Boot ROM access control function if the function is supported on the device.

Note that, for a distributed device:

l          The SMB is started and runs based on the current configurations of the AMB; therefore the current startup configuration files displayed on the AMB and SMB are always the same.

l          After a switchover between the AMB and SMB, the new AMB does not restart using the configuration file but runs with the current configuration instead. Therefore, when you execute the display startup command, the startup configuration file used for the current startup of the new AMB is displayed as NULL and that of the new SMB is also NULL to keep consistent with the new AMB.

Related commands: startup saved-configuration.

Examples

# Display the configuration file used at the current system startup and the one to be used at the next system startup.

<Sysname> display startup

  Current startup saved-configuration file:          flash:/config.cfg

  Next main startup saved-configuration file:        flash:/config.cfg

  Next backup startup saved-configuration file:      NULL

Table 1-1 display startup command output description

Field

Description

Current Startup saved-configuration file

The configuration file used for the current startup

Next main startup saved-configuration file

Main configuration file used for the next startup

Next backup startup saved-configuration file

Backup configuration file used for the next startup

 

reset saved-configuration

Syntax

reset saved-configuration [ backup | main ]

View

User view

Default Level

2: System level

Parameters

backup: Deletes the backup startup configuration file. Support for this keyword depends on the device model.

main: Deletes the main startup configuration file. Support for this keyword depends on the device model.

Description

Use the reset saved-configuration command to delete the startup configuration file saved on the storage medium of the device.

Note that:

l          This command will permanently delete the configuration file from the device. Use it with caution. On a device that has the main and backup startup configuration files, you can choose to delete either the main or backup startup configuration file. However, in the case that the main and backup startup configuration files are the same, if you perform the delete operation for once, the system will not delete the configuration file but only set the corresponding startup configuration file (main or backup, according to which one you specified in the command) to NULL.

l          For a device that supports the main and backup keywords, the execution of the reset saved-configuration command and that of the reset saved-configuration main command have the same effect, that is, they will delete the main startup configuration file.

Related commands: save, display saved-configuration.

Examples

# Delete the backup startup configuration file from the storage medium of the device.

<Sysname> reset saved-configuration backup

The saved configuration file will be erased. Are you sure? [Y/N]:y

Configuration file in cf is being cleared.

Please wait ...

........

 Configuration file in cf is cleared.

restore startup-configuration

Syntax

restore startup-configuration from src-addr src-filename

View

User view

Default Level

2: System level

Parameters

src-addr: IP address or name of a TFTP server. The address cannot be an IPv6 address.

src-filename: Filename of the configuration file to be downloaded from the specified server.

Description

Use the restore startup-configuration command to download a configuration file from the specified TFTP server to the device and specify the configuration file as the startup configuration file to be used at the next startup of the device.

l          This command downloads the configuration file and specifies the file as the startup configuration file to be used at the next startup of the device.

l          The file downloaded is set as the main startup configuration file to be used at the next system startup.

Examples

# Download configuration file test.cfg from the TFTP server whose IP address is 2.2.2.2, and the configuration file is to be used at the next startup of the device.

<Sysname> restore startup-configuration from 2.2.2.2 test.cfg

Restore next startup-configuration file from 2.2.2.2. Please wait..............

finished!

save

Syntax

save file-url

save [ safely ] [ backup | main ]

View

Any view

Default Level

2: System level

Parameters

filename: File name, whose extension must be .cfg.

safely: Sets the configuration saving mode to safe. If this argument is not specified, the configuration file is saved in fast mode.

backup: Saves the current configuration to the backup startup configuration file. In the interactive mode,

main: Saves the current configuration to the main startup configuration file. In the interactive mode,

Description

Use the save filename command to save the current configuration to the specified configuration file, but the system will not specify the file as the startup configuration file for the next system startup. If the file specified by filename does not exist, the system will create the file and then save the configuration to the file.

Use the save [ safely ] [ backup | main ] command to save the current configuration to a configuration file and specify the file as the startup configuration file for the next system startup.

Related commands: reset saved-configuration, display current-configuration, display saved-configuration.

Examples

# Save the current configuration to the backup startup configuration file to be used at the next system startup.

<Sysname> save backup

The current configuration will be written to the device.

Are you sure? [Y/N]:y

Please input the file name(*.cfg)[flash:/text.cfg](To leave the

existing filename unchanged, press the enter key):bb.cfg

 

Validating file. Please wait...

Now saving current configuration to the device.

Saving configuration flash:/bb.cfg. Please wait...

....

Configuration is saved to flash successfully.

<Sysname>

startup saved-configuration

Syntax

startup saved-configuration cfgfile [ backup | main ]

undo startup saved-configuration

View

User view

Default Level

2: System level

Parameters

cfgfile: Configuration file name.

backup: Sets the configuration file as the backup startup configuration file that will be used at the next startup of the device.

main: Sets the configuration file as the main startup configuration file that will be used at the next startup of the device.

Description

Use the startup saved-configuration command to specify a startup configuration file (the configuration file to be used at the next system startup).

Use the undo startup saved-configuration command to configure the system to start up with the null configuration, that is, the factory configuration.

The specified file must be ended with a .cfg extension and saved in the root directory of the storage device (For a storage device that has been partitioned, the file must be saved on the first partition).

When a device that supports main/backup keyword:

l          The startup saved-configuration and startup saved-configuration main commands have the same effect: Both of them are used to specify the main startup configuration file.

l          The main and backup startup configuration files can be specified as the same file. However, it is recommended you use different files, or, save the same configuration as two files using different file names, one specified as the main startup configuration file, and the other specified as the backup.

l          If you execute the undo startup saved-configuration command, the system will set the main and backup startup configuration file as NULL, but will not delete the two configuration files.

Related commands: display startup.

Examples

# Specify a backup startup configuration file for the next system startup.

<Sysname> startup saved-configuration testcfg.cfg backup

Please wait......Done!

 


FTP Configuration Commands

FTP Server Configuration Commands

display ftp-server

Syntax

display ftp-server

View

Any view

Default Level

3: Manage level

Parameters

None

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, 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 2-1 display ftp-server command output description

Field

Description

Max user number

Maximum number of login users at a time

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 the whole period, the FTP connection will be disconnected.

Put Method

File update method of the FTP server, including:

l      fast: Fast update

l      normal: Normal update

 

display ftp-user

Syntax

display ftp-user

View

Any view

Default Level

3: Manage level

Parameters

None

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 left 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-2 display ftp-user command 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 the logged-in user name of the current FTP connection.

Description

Use the free ftp user command to manually release the FTP connection established with the specified username.

Note that if the user to be released is transmitting a file, the connection between the user and the FTP server is terminated after the file transmission.

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 2000 to 2999.

Description

Use the ftp server acl command to configure the association between FTP service and an ACL.

Use the undo ftp server acl command to cancel the configuration.

By default, no ACL is associated with the FTP service.

Associated with an ACL, the FTP server can deny the FTP requests of some FTP clients and only permit the access of clients allowed by the ACL rules. This configuration only filters the FTP connections to be established, and has no effect on the established FTP connections and operations. If you execute the command for 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 device 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 to prevent attacks.

Examples

# Disable the FTP server.

<Sysname> system-view

[Sysname] undo ftp server

% Close FTP server

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 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.

After you log in to an FTP server, if the connection is disrupted and the FTP server is not notified, the system will maintain the connection, which will cause the occupation of the system resources and affect the login of other FTP users. To address this problem, you can set an idle-timeout timer so that the FTP server can disconnect from the user if no information is received or/and transmitted before the timer expires.

Examples

# Set the idle-timeout timer to 36 minutes.

<Sysname> system-view

[Sysname] ftp timeout 36

ftp update

Syntax

ftp update { fast | normal }

undo ftp update

View

System view

Default Level

3: Manage level

Parameters

fast: Fast update.

normal: Normal update.

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, namely, the normal mode.

Examples

# Set the FTP update mode to normal.

<Sysname> system-view

[Sysname] ftp update normal

FTP Client Configuration Commands

 

l          In this section, the configuration procedure of entering FTP client view is omitted. You must use the ftp command to enter FTP client view for configurations under this view. For details, refer to ftp.

l          Before executing the FTP client configuration commands in this section, make sure you have configured the proper authority for users on the FTP server, such as view the files under the current directory, read/download the specified file, create directory/upload files, rename/remove files, and so on.

l          The prompt information in the examples of this section 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.

FTP provides two file transfer modes: ASCII and binary. To transfer text files, use the ASCII mode; to transfer program files, use the binary mode.

By default, the file transfer mode is ASCII.

Examples

# Set the file transfer mode to ASCII.

[ftp] ascii

200 Type set to A.

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 (also called flow mode).

FTP provides two file transfer modes: ASCII and binary. To transfer text files, use the ASCII mode; to transfer program files, use the binary mode.

By default, the transfer mode is ASCII mode.

Examples

# Set the file transfer mode to binary.

[ftp] binary

200 Type set to I.

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.

Examples

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

[ftp] bye

221 Server closing.

cd

Syntax

cd directory

View

FTP client view

Default Level

3: Manage level

Parameters

directory: Target directory name.

Description

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

You can use this command to access another authorized directory on the FTP server.

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 authorized directory.

[ftp] cd /folder

250 CWD command successful.

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.

Execution of this command will not change the working directory if the current directory is already the authorized directory (that is, work-directory).

Related commands: cd, pwd.

Examples

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

[ftp] cdup

200 CDUP command successful.

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

3: Manage 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] debugging

[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 2-3 debugging command output description

Field

Description

---> PORT

Give an FTP order, with data port numbers being…

The parsed reply is

The received reply code, which is 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 do this, you must be a user with the delete permission 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.

 

You can use the dir command to display the folder- and file-related information, such as the size, and the date they were created. If you only need to view the name of all the files and subdirectories under the current directory, you can use the Is command.

 

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 ar-router.cfg, and save the result to aa.txt.

[ftp] dir ar-router.cfg aa.txt

227 Entering Passive Mode (192,168,1,50,17,158).

125 ASCII mode data connection already open, transfer starting for /ar-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 ar-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.

display ftp client configuration

Syntax

display ftp client configuration

View

Any view

Default Level

1: Monitor level

Parameters

None

Description

Use the display ftp client configuration command to display the configuration information of the FTP client.

 

Currently this command displays the configured source IP address or source interface of the FTP client.

 

Related commands: ftp client source.

Examples

# Display the current configuration information of the FTP client.

<Sysname> display ftp client configuration

The source IP address is 192.168.0.123

ftp

Syntax

ftp [ server-address [ service-port ] [ 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 0 to 65535. The default value is 21.

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 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 current FTP client. 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.

Note that:

l          This command applies to IPv4 networks.

l          If you use this command without specifying any parameters, you will simply enter the FTP client view without logging in to the FTP server.

l          If you specify the parameters, you will be prompted to enter the username and password for accessing the FTP server.

l          The priority of the source address specified with this command is higher than that with the ftp client source command. If you specify the source address with the ftp client source command first and then with the ftp command, the source address specified with the ftp command is used to communicate with the FTP server.

Related commands: ftp client source.

Examples

# Log in from the current device Sysname1 to the device Sysname2 with the IP address of 192.168.0.211. The source IP address of the packets sent 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: Source interface for the FTP connection, including interface type and interface number. The primary IP address configured on the source interface is the source IP address of the packets sent by FTP. If no primary IP address is configured on the source interface, the connection fails.

ip source-ip-address: Source IP address of the FTP connection. It must be an IP address that has been configured on the device.

Description

Use the ftp client source command to configure the source address of the transmitted FTP packets from the FTP client.

Use the undo ftp client source command to restore the default.

By default, a device uses the IP address of the interface determined by the matched route as the source IP address to communicate with an FTP server.

Note that:

l          The source address can be specified as the source interface and the source IP address. If you use the ftp client source command to specify the source interface and then the source IP address, the newly specified source IP address overwrites the configured source interface and vice versa.

l          If the source address is specified with the ftp client source command and then with the ftp command, the source address specified with the latter one is used to communicate with the FTP server.

l          The source address specified with the ftp client source command is valid for all FTP connections and the source address specified with the ftp command is valid only for the current FTP connection.

Related commands: display ftp client configuration.

Examples

# Specify the source IP address of the FTP client as 2.2.2.2.

<Sysname> system-view

[Sysname] ftp client source ip 2.2.2.2

# Specify the source interface of the FTP client as Vlan-interface1.

<Sysname> system-view

[Sysname] ftp client source interface Vlan-interface1

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 above information indicates 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 under 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.

 

The Is 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 /*.

ar-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, and save the result to file aa.txt.

[ftp] ls logfile aa.txt

227 Entering Passive Mode (192,168,1,46,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

<Sysname> more aa.txt

.

..

logfile.log

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 under the current directory on the remote FTP server.

To do this, you must be a user with the permission 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.

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 0 to 65535, with the default value of 21.

Description

Use the open command to log in to the IPv4 FTP server under FTP client view.

At login, you will be asked to enter the username and password for accessing the FTP server. If your input is correct, the login succeeds; otherwise, it fails.

If you have logged in to the IPv4 FTP server currently, you cannot use the open command to log in to another server. You need to disconnect with the current server first, and then try to connect with another one.

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]

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. The active mode means that the data connection request is initiated by a server. The passive mode means that the data connection request is initiated by a client. This command is mainly used in conjunction with a firewall to restrict the FTP session connection between private and public network users.

Examples

# Set the data transmission mode to passive.

[ftp] passive

FTP: passive is on

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.

If no name is assigned to the file to be saved on the FTP server, the name of the source file is used by default.

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 above information indicates that the servertemp folder under the root directory of the remote FTP server 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 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 2-4 remotehelp command output description

Field

Description

214-Here is a list of available ftp commands

The following is an available FTP command list.

Those with '*' are not yet implemented.

Those commands with “*” are not yet implemented.

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 CUP

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 that only authorized users are allowed to use this command.

Note that:

l          The directory to be deleted must be empty, meaning you should delete all files and subdirectories under the directory before you delete a directory. For the deletion of files, refer to the delete command.

l          After you execute the rmdir command successfully, the files in the remote recycle bin under the directory will be automatically deleted.

Examples

# Delete the temp1 directory from the authorized directory on the FTP server.

[ftp] rmdir /temp1

200 RMD command successful.

user

Syntax

user username [ password ]

View

FTP client view

Default Level

3: Manage level

Parameters

username: Login username.

password: Login password.

Description

Use the user command to relog in to the currently accessed FTP server with another username.

Before using this command, you must configure the corresponding username and password on the FTP server; otherwise, your login fails and the FTP connection is closed.

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).

[ftp] user ftp2

331 Password required for ftp2.

Password:

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 the protocol information function to display detailed prompt information.

Use the undo verbose command to disable the protocol information function.

By default, the protocol information function is enabled.

Examples

# Enable the protocol information function.

[ftp] verbose

FTP: verbose is on

# Disable the protocol information function and perform the 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 the protocol information function and perform the 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.

 


TFTP Configuration Commands

TFTP Client Configuration Commands

display tftp client configuration

Syntax

display tftp client configuration

View

Any view

Default Level

1: Monitor level

Parameters

None

Description

Use the display tftp client configuration command to display the configuration information of the TFTP client.

Related commands: tftp client source.

Examples

# Display the current configuration information of the TFTP client.

<Sysname> display tftp client configuration

The source IP address is 192.168.0.123

 

Currently this command displays the configured source IP address or source interface of the TFTP client.

 

tftp-server acl

Syntax

tftp-server acl acl-number

undo tftp-server acl

View

System view

Default Level

3: Manage level

Parameters

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

Description

Use the tftp-server acl command to reference an ACL to control TFTP server access. Use the undo tftp-server acl command to remove the access restriction.

For more information about ACL, refer to ACL Configuration in the Security Volume.

Examples

# In IPv4 networking environment, allow the device to access the TFTP server with the IP address of 1.1.1.1 only.

<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

tftp

Syntax

tftp server-address { get | put | sget } source-filename [ destination-filename ] [ 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.

source: Configures parameters for source address binding.

l          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.

l          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 upload files from the local device to a TFTP server or download files from the TFTP server to the local device.

l          If no destination file name is specified, the saved file uses the source file name.

l          The priority of the source address specified with this command is higher than that specified with the tftp client source command. If you use the tftp client source command to specify the source address first and then with the tftp command, the latter one is adopted.

This command applies to IPv4 networks.

Related commands: tftp client source.

Examples

# 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.

# Upload the config.cfg file from the local device to the default path of the TFTP server with the IP address of 192.168.0.98 and save it as config.bak. Specify the source IP interface to be Vlan-interface 1.

<Sysname> tftp 192.168.0.98 put config.cfg config.bak source interface Vlan-interface 1

 

  File will be transferred in binary mode

  Sending file to remote TFTP server. Please wait...

  TFTP:        345600 bytes sent in 1 second(s).

File uploaded successfully.

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 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: The source IP address of TFTP connections. It must be an IP address that has been configured on the device.

Description

Use the tftp client source command to configure the source address of the TFTP packets from the TFTP client.

Use the undo telnet client source command to restore the default.

By default, a device uses the IP address of the interface determined by the matched route as the source IP address to communicate with a TFTP server.

Note that:

l          The source address can be specified as the source interface and the source IP; if you use the tftp client source command to specify the source interface and then the source IP, the newly specified source IP overwrites the configured source interface and vice versa.

l          If the source address is specified with the tftp client source command and then with the tftp command, the source address specified with the latter one is used to communicate with the TFTP server.

l          The source address specified with the tftp client source command is valid for all tftp connections and the source address specified with the tftp command is valid for the current tftp command.

Related commands: display tftp client configuration.

Examples

# Specify the source IP address of the TFTP client as 2.2.2.2.

<Sysname> system-view

[Sysname] tftp client source ip 2.2.2.2

# Specify the source interface of the TFTP client as Vlan-interface 1.

<Sysname> system-view

[Sysname] tftp client source interface Vlan-interface 1

H3C reserves the right to modify its collaterals without any prior notice. For the latest information of the collaterals, please consult H3C sales or call 400 hotline.