H3C S9500 Operation Manual-Release2132[V2.03]-08 System Volume

HomeSupportSwitchesH3C S9500 Series SwitchesConfigure & DeployConfiguration GuidesH3C S9500 Operation Manual-Release2132[V2.03]-08 System Volume
10-File System Management Configuration
Title Size Download
10-File System Management Configuration 186.4 KB

Chapter 1  File System Management Configuration

 

&  Note:

Throughout this document, a filename can be entered as either of the following:

l      A fully qualified filename with the path included to indicate a file under a specific path. The filename can be 1 to 135 characters in length.

l      A short filename with the path excluded to indicate a file in the current path. The filename can be 1 to 91 characters in length.

 

When configuring the file system management, go to these sections for information you are interested in:

l           File System Management

l           Configuration File Management

l           Displaying and Maintaining Device Configuration

1.1  File System Management

This section covers these topics:

l           File System Overview

l           Directory Operations

l           File Operations

l           Storage Device Operations

l           File System Prompt Mode Setting

l           File System Operations Examples

1.1.1  File System Overview

A major function of the file system is to manage storage devices. It allows you to perform operations such as directory create and delete, and file copy and display. If an operation, delete or overwrite for example, may cause problems such as data loss or corruption, the file system will ask you to confirm the operation by default.

Depending on the managed object, file system operations fall into Directory Operations, File Operations, Storage Device Operations, and File System Prompt Mode Setting.

1.1.2  Directory Operations

Directory operations include create, delete, display the current path, display specified directory or file information as shown in the following table:

To do…

Use the command…

Remarks

Create a directory

mkdir directory

Optional

Remove a directory

rmdir directory

Optional

Display the current path

pwd

Optional

Display files or directories

dir [ /all ] [ file-url ]

Optional

Change the current path

cd directory

Optional

 

&  Note:

l      The directory to be removed must be empty, meaning before you remove a directory, you must delete all the files and the subdirectory under this directory. For file deletion, refer to the delete command.

l      After the execution of the rmdir command, the files in this directory will be automatically deleted forever.

 

1.1.3  File Operations

File operations include delete (removing files into the recycle bin), restore the deleted, permanently delete (deleting files from the recycle bin), display, rename, copy, and move files, and display specified directory or file information as shown in the following table:

To do…

Use the command…

Remarks

Remove a file to the recycle bin or delete it permanently

delete [ /unreserved ] file-url

Optional

Restore a file from the recycle bin

undelete file-url

Optional

Empty the recycle bin

reset recycle-bin [ file-url ] [ /force ]

Optional

Display the contents of a file

more file-url

Optional

Currently only a .txt file can be displayed.

Rename a file

rename fileurl-source fileurl-dest

Optional

Copy a file

copy fileurl-source fileurl-dest

Optional

Move a file

move fileurl-source fileurl-dest

Optional

Display files or directories

dir [ /all ] [ file-url ]

Optional

Enter system view

system-view

Execute the batch file

execute filename

Optional

 

&  Note:

You can create a file by copying or downloading or using the save command.

 

  Caution:

l      Timely empty the recycle bin with the reset recycle-bin command to save memory space.

l      As the delete /unreserved file-url command deletes a file permanently and the action cannot be undone, use it with caution.

l      The original and target directory of the file to be moved must be on the same device. The move command does not support cross-device file moving.

l      The execute command cannot ensure the execution of each command. For example, if a certain command is not correctly configured, the system will omit this command and go to the next one. Therefore, each configuration command in a batch file must be a standard configuration command, meaning the valid configuration information which can be displayed with the display current-configuration command after this command is configured successfully; otherwise, this command may not be executed correctly.

 

1.1.4  Storage Device Operations

I. Naming rules

If storage device partitioning is supported, the name of the partition device is composed of the physical device name and partition number. The serial numbers of partitions are displayed in numbers such as 0, 1 or 2. For example, the second partition of a CF card is cf1. If there is only one partition on the CF card, the partition name is the physical device name followed by 0.

II. Memory space management

You can use the fixdisk command to restore the space of a storage device or the format command to format a specified storage device as shown in the following table:

To do…

Use the command…

Remarks

Restore the space of a storage device

fixdisk device

Optional

Format a storage device

format device type

Optional

 

You may use the two commands when some space of a storage device becomes inaccessible due to abnormal operations for example.

 

  Caution:

l      When you format a storage device, all the files stored on it are erased and cannot be restored. In particular, if there is a startup configuration file on the storage device, formatting the storage device results in loss of the startup configuration file. Format a file under the directions of technical support engineers.

l      When you format a partition of a storage device, the type argument can only be set to FAT16 or FAT32, and the English letters must be in uppercase.

l      Because switches support partitioning, you can only format a partition device rather than the whole storage device.

 

III. Mounting/unmounting a storage device

S9500 series switches support hot swappable storage devices, such as CF card, USB device, etc (excluding Flash), you can use the mount and umount command to mount or unmount the storage device.

When a device is unmounted, it is in a logically disconnected state, you can then remove the storage device from the system safely. To mount a device, you are reconnecting the logically disconnected device to the system.

Follow the steps below to mount/unmount a storage device:

To do…

Use the command…

Remarks

Mount a storage device

mount device

Optional

A storage device is in mounted state when it is connected to the system by default.

Unmount a storage device

umount device

Optional

A storage device is in mounted state by default. Before unplugging a storage device, unmount it.

 

  Caution:

l      Do not remove the storage device or swap the board when mounting or unmounting the device, or when you are processing files on the storage device. Otherwise, the file system could be damaged.

l      When a storage device is connected to a low version system, the system may not be able to recognize the device automatically; you need to use the mount command for the storage device to function normally.

l      Before removing a mounted storage device from the system, you should first unmount it to avoid damaging the device.

l      If one or more partitions of a CF card are not unmounted through the umount command, the CF card will still be powered on. Therefore, make sure you have unmounted all the partitions before removing the CF card from the system to avoid storage device damage caused by charged operations.

 

IV. Partitioning a CF card

The CF card partitioning function enables you to divide a CF card into several different logical devices called partitions and you can perform file operations on each partition respectively. This prevents interaction of files on each partition.

The following two partitioning modes are supported on a CF card:

l           Simple: In this mode, you should specify the number of partitions. The system divides a CF card into the specified number of partitions with the same size.

l           Interactive: In this mode, you need not specify the number of partitions. The system partitions the CF card according to user input. Each partition, however, must be 32 MB at least.

Follow these steps to partition a CF card:

To do…

Use the command…

Remarks

Partition a storage device

fdisk device [ partition-number ]

Required

A CF card has only one partition cf0:/ by default.

 

  Caution:

l      Partitioning a CF card will clear all data on the CF card. Backup the files on the CF card before partitioning it.

l      CF card partitioning may add or remove partition devices. You need reset the path of the application program as needed.

l      If a switch starts from the CF card, the startup file and the configuration file must be in the first partition of the CF card.

l      To prevent log file from affecting the startup file and configuration file, you are recommended to set the path of the log file to a partition other than the first partition if there are multiple partitions on the CF card. By default, the system automatically sets the path of the log file to the second partition. If the path does not exist on the CF card, you can use the info-center logfile switch-directory command to change the path to avoid loss of the log files. For details of this command, refer to Information Center Commands in the System Volume.

l      After partitioning is completed, the sizes of the partitions are not necessarily consistent with those specified in an interactive way. The dispersion, however, is smaller than 5% of the total memory of the CF card.

 

1.1.5  File System Prompt Mode Setting

The file system provides the following two prompt modes:

l           alert: where the system warns you about operations that may bring undesirable consequence such as file corruption or data loss.

l           quiet: where the system does not do that in any cases.

Follow these steps to set the operation prompt mode of the file system:

To do…

Use the command…

Remarks

Enter system view

system-view

Set the operation prompt mode of the file system

file prompt { alert | quiet }

Required

The default is alert.

 

1.1.6  File System Operations Examples

# Display the files under the root directory.

<Sysname> dir

Directory of flash:/

   0   drw-         -  May 08 2006 21:27:24   hafile

   1   -rw-       248  May 08 2006 21:40:44   manuinfo.txt

   2   -rw-       118  Jun 16 2006 10:16:05   ls.pwd

   3   -rw-      3530  Oct 16 2006 16:39:53   config.cfg

   4   -rw-    326944  Jul 24 2006 14:03:04   lsbSRP1N43202.app

   5   -rw-    207624  Jul 07 2006 14:27:30   lsblmcua0110y.app

   6   -rw-    326944  Jul 07 2006 11:05:39   srpbt.app

   7   -rw-    326944  Jul 10 2006 10:40:42   switch.app

15621 KB total (14363 KB free)

# Create a new folder called mytest under the test directory.

<Sysname> cd test

<Sysname> mkdir mytest

..

%Created dir flash:/test/mytest.

# Display the files under the test directory.

<Sysname> dir

Directory of flash:/test/

 

   0   drw-         -  Feb 16 2006 15:28:14   mytest

 

2540 KB total (2519 KB free)

# Return to the upper directory.

<Sysname> cd ..

1.2  Configuration File Management

This section covers these topics:

l           Configuration File Management Overview

l           Saving the Current Configuration

l           Synchronizing Configuration Files Saved on the AMB to SMB

l           Erasing the Startup Configuration File

l           Specifying a Configuration File for Next Startup

l           Backing up/Restoring the Configuration File for Next Startup

1.2.1  Configuration File Management Overview

I. Types of configuration

The configuration of a device falls into two types:

l           Saved configuration, a configuration file used for initialization. If this file does not exist, the default parameters are used.

l           Current configuration, which refers to the user’s configuration during the operation of a device. This configuration is stored in dynamic random-access memory (DRAM). It is removed when the device is rebooting.

II. Format of configuration file

Configuration files are saved as text files for ease of reading. They:

l           Save configuration in the form of commands.

l           Save only non-default configuration settings.

l           List commands in sections by view in this view order: system, interface, routing protocol, and so on. Sections are separated with one or multiple blank lines or comment lines that start with a pound sign (#).

l           End with a return.

The operating interface provided by the configuration file management function is user-friendly. With it, you can easily manage your configuration files.

1.2.2  Saving the Current Configuration

You can modify the configuration on your device at the command line interface (CLI). To use the modified configuration for your subsequent startups, you must save it (using the save command) as a configuration file.

Modes in saving the configuration:

l           Fast saving mode. This is the mode when you use the save command without the safely keyword. The mode saves the file faster but is likely to lose the configuration file if the device reboots or the power fails during the saving process.

l           Safe mode. This is the mode when you use the save command with the safely keyword. The mode saves the file slower but can retain the configuration file on the device even if the device reboots or the power fails during the saving process.

 

  Caution:

Device reboot or the power failure during configuration file saving may result in loss of the configuration file for next startup. In this case, the device will be started with empty configuration, and after the device starts, you need to re-specify a configuration file for next startup.

 

Follow the step below to save the current configuration:

To do…

Use the command…

Remarks

Save the current configuration

save [ file-name | safely ]

Available in any view

 

&  Note:

l      When you use the save file-name command, if you specify the saving directory in the file-name, the configuration will be saved in the specified directory; if you do not specify a saving directory in the file-name, the configuration will be saved in the current directory.

l      In interactive mode, if you specify a saving directory in the file name, the directory to be specified must be the directory of the saving device on the active main board (AMB).

l      To save the configuration file, you can specify either the filename argument or the safely keyword.

l      Fast saving mode is suitable for environments where power supply is stable. The safe mode, however, is preferred where stable power supply is unavailable or remote maintenance is involved.

l      The extension name of the configuration file must be .cfg.

 

1.2.3  Synchronizing Configuration Files Saved on the AMB to SMB

For an S9500 series switch, you can only execute commands on the active main board (AMB) instead of a standby main board (SMB). After the configuration file saving synchronization function is enabled, when you use the save command on the AMB to save the current configuration, the SMB will automatically save the current configuration to its configuration files to keep the consistency of the configuration files on the AMB and SMB.

Follow these steps to configure configuration file saving synchronization on the AMB and SMB:

To do…

Use the command…

Remarks

Enter system view

system-view

Enable configuration file saving synchronization for the AMB and SMB

slave auto-update config

Optional

Enabled by default.

 

1.2.4  Erasing the Startup Configuration File

With the configuration file erased, your device will boot up with the default configuration next time it is powered on.

You may need to erase the configuration file for one of these reasons:

l           After you upgrade software, the original configuration file does not match the new software.

l           The startup configuration file is corrupted or not the one you need.

Follow the step below to erase the configuration file:

To do…

Use the command…

Remarks

Erase the startup configuration file from the storage device

reset saved-configuration

Required

Available in user view

 

  Caution:

This command will permanently delete the configuration file from the device. Use it with caution.

 

1.2.5  Specifying a Configuration File for Next Startup

Follow the step below to specify a configuration file for next startup:

To do…

Use the command…

Remarks

Specify a configuration file for next startup

startup saved-configuration cfgfile

Required

Available in user view

 

  Caution:

The configuration file must use “.cfg” as its extension name and the startup configuration file must be saved under the root directory of the device.

 

1.2.6  Backing up/Restoring the Configuration File for Next Startup

I. Backup/restore function overview

The backup/restore function allows you to backup or restore a configuration file for next startup through operations at the CLI. TFTP is used for intercommunication between the device and the server. The backup function enables you to backup a configuration file to the TFTP server, while the restore function enables you to download the configuration file from the TFTP server for next startup.

For an S9500 series switch, when you execute the restore command on your AMB, you are restoring the startup configuration file for both the AMB and the SMB. However, when you execute the backup command on your AMB, your operation has no effect on the SMB.

 

&  Note:

The backup/restore operation applies to the next startup configuration file.

 

II. Backing up the configuration file for next startup

To do…

Use the command…

Remarks

Back up the configuration file for next startup

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

Required

Available in user view

 

&  Note:

Before backup, you should:

l      Ensure that the server is reachable, the server is enabled with TFTP service, and the client has permission to read and write.

l      Use the display startup command (in user view) to verify if you have set the startup configuration file, and use the dir command to verify if this file exists. If the file is set as NULL or does not exist, the backup will be unsuccessful.

 

III. Restoring the startup configuration file

To do…

Use the command…

Remarks

Restore the startup configuration file

restore startup-configuration from src-addr src-filename

Required

Available in user view

 

&  Note:

l      Before restoring a configuration file, you should ensure that the server is reachable, the server is enabled with TFTP service, and the client has permission to read and write.

l      After the command is successfully executed, you can use the display startup command (in user view) to verify if the filename of the startup configuration file is the same with the src-filename argument, and use the dir command to verify if the restored file exists.

 

1.3  Displaying and Maintaining Device Configuration

To do…

Use the command…

Remarks

Display the configuration file saved in the storage device

display saved-configuration [ by-linenum ]

Available in any view

Display the configuration file used for this and next startup

display startup

Available in any view

Display the validated configuration in current view

display this [ by-linenum ]

Available in any view

Display current configuration

display current-configuration [ interface [ interface-type [ interface-number ] ] | configuration [ configuration ] | [ by-linenum ] | [ | { begin | exclude | include } regular-expression ] ] *

Available in any view

 

&  Note:

l      Configuration files are displayed in the same format in which they are saved.

l      The support for the optional arguments in both the display this and display current-configuration command varies with devices. For detailed description of this command, refer to Basic System Commands in the System Volume.

 


Chapter 2  FTP Configuration

When configuring FTP, go to these sections for information you are interested in:

l           FTP Overview

l           Configuring the FTP Client

l           Configuring the FTP Server

l           Displaying and Maintaining FTP

2.1  FTP Overview

2.1.1  Introduction to FTP

The File Transfer Protocol (FTP) is an application layer protocol for sharing files between server and client over a TCP/IP network.

FTP uses TCP ports 20 and 21 for file transfer. Port 20 is used to transmit data, and port 21 to transmit control commands. Refer to RFC 959 for details of FTP basic operation.

FTP transmits files in two modes:

l           Binary mode for program file transmission

l           ASCII mode for text file transmission

2.1.2  Implementation of FTP

FTP adopts the server/client model. Your device can function either as client or as server (as shown in Figure 2-1). They work in the following way:

l           When the device serves as the FTP client, a PC user first telnets or connects to the device through an emulation program, then executes the ftp command to establish the connection to the remote FTP server, and gain access to the files on the server.

l           When the device serves as the FTP server, it must be configured with an IP address so that a user running FTP client program can access it.

Figure 2-1 Network diagram for FTP

When the device serves as the FTP client, you need to perform the following configuration:

Table 2-1 Configuration when the device serves as the FTP client

Device

Configuration

Remarks

Device (FTP client)

Use the ftp command to establish the connection to the remote FTP server

If the remote FTP server supports anonymous FTP, the device can log onto it directly; if not, the device must obtain FTP username and password first to log onto the remote FTP server.

PC (FTP server)

Enable FTP server on the PC, and configure the username, password, user level, and so on.

 

When the device serves as the FTP server, you need to perform the following configuration:

Table 2-2 Configuration when the device serves as the FTP server

Device

Configuration

Remarks

Device (FTP server)

Enable the FTP server function

Disabled by default.

You can use the display ftp-server command to view the FTP server configuration on the device.

Configure the authentication and authorization for accessing FTP server

Configure the username, password, authorized working directory for an FTP user.

Configure the FTP server operating parameters

Parameters such as the FTP connection timeout time

PC (FTP client)

Use the FTP client program to log onto the device

 

  Caution:

l      The FTP function is available when a route exists between the FTP server and the FTP client.

l      When you use IE to log onto the device serving as the FTP server, part of the FTP server functions are not available, because multiple user connections are established during the login process but the device supports only one connection at a time.

 

2.2  Configuring the FTP Client

2.2.1  Establishing an FTP Connection

To access an FTP server, the FTP client must connect with it. Two ways are available for the connection: using the ftp command to establish the connection directly; using the open command in FTP client view.

Multiple routes may exist for the FTP client to successfully access the FTP server. You can specify one by configuring the source address of the packets of the FTP client to meet the requirement of the security policy of the FTP client. You can configure the source address by configuring the source interface or source IP address. The primary IP address configured on the source interface is the source address of the transmitted packets. The source address of the transmitted packets is selected following these rules:

l           If no source address of the FTP client is specified, a device uses the IP address of the interface determined by the routing protocol as the source IP address to communicate with an FTP server.

l           If the source address is specified with the ftp client source or ftp command, this source address is used to communicate with an FTP server.

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

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.

Follow these steps to establish an FTP connection (In IPv4 networking):

To do…

Use the command…

Remarks

Enter system view

system-view

Configure the source address of the FTP client

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

Optional

A device uses the IP address of the interface determined by the routing protocol as the source IP address to communicate with the FTP server by default.

Exit to system view

quit

Log onto the remote FTP server directly in user view

ftp [ server-address [ service-port ] [ source { ip source-ip-address | interface interface-type interface-number } ] ]

Use either approach.

Available in user view

Log onto the remote FTP server indirectly in FTP client view

ftp

open server-address [ service-port ]

 

&  Note:

l      If no primary IP address is configured on the source interface, the FTP connection fails.

l      If you use the ftp client source command to first configure the source interface and then the source IP address of the transmitted packets, the new source IP address will overwrite the current one, and vice versa.

 

Follow these steps to establish an FTP connection (In IPv6 networking):

To do…

Use the command…

Remarks

Log onto the remote FTP server directly in user view

ftp ipv6 [ server-address [ service-port ] [ source ipv6 source-ipv6-address ] [ -i interface-type interface-number ] ]

Use either approach.

Log onto the remote FTP server indirectly in FTP client view

ftp ipv6

open ipv6 server-address [ service-port ] [ -i interface-type interface-number ]

 

2.2.2  Configuring the FTP Client

After a device serving as the FTP client has established a connection with the FTP server (For establishing FTP connection, refer to Establishing an FTP Connection.), the device can perform the following operations for the authorized directory:

To do…

Use the command…

Remarks

Display help information of FTP-related commands supported by the remote FTP server

remotehelp [ protocol-command ]

Optional

Enable information display in a detailed manner

verbose

Optional

Enabled by default

Use other username to relog after logging onto the FTP server successfully

user username [ password ]

Optional

Set the file transfer mode to ASCII

ascii

Optional

ASCII by default

Set the file transfer mode to binary

binary

Optional

ASCII by default

Change the working path on the remote FTP server

cd pathname

Optional

Exit the current directory and enter the upper level directory

cdup

Optional

Display files/directories information on the FTP server

dir [ remotefile [ localfile ] ]

Optional

Check files/directories on the FTP server

ls [ remotefile [ localfile ] ]

Optional

Download a file from the FTP server

get remotefile [ localfile ]

Optional

Upload a file to the FTP server

put localfile [ remotefile ]

Optional

View the working directory of the remote FTP server

pwd

Optional

Find the working path of the FTP client

lcd

Optional

Create a directory on the FTP server

mkdir directory

Optional

Set the data transfer mode to passive

passive

Optional

Passive by default

Delete specified file on the FTP server

delete remotefile

Optional

Delete specified directory on the FTP server

rmdir directory

Optional

Disconnect with the FTP server without exiting the FTP client view

disconnect

Optional

Equal to the close command

Disconnect with the FTP server without exiting the FTP client view

close

Optional

Equal to the disconnect command

Disconnect with the FTP server and exit to user view

bye

Optional

Terminate the connection with the remote FTP server, and exit to user view

quit

Optional

Available in FTP client view, equal to the bye command

 

&  Note:

l      FTP uses two modes for file transfer: ASCII mode and binary mode.

l      The Is command can only display the file/directory name, while the dir command can display more information, such as the size and date of creation of files or directories.

 

2.2.3  FTP Client Configuration Examples

I. Network requirements

l           Use your device as an FTP client to download an image file from the FTP server.

l           The IP address of the FTP server is 172.16.104.110/16.

l           On the FTP server, an FTP user account has been created for the FTP client, with the username being abc and the password being passwordtest.

l           The PC performs operations on the device through Console port.

II. Network diagram

Figure 2-2 Network diagram for FTPing an image file from an FTP server

III. Configuration procedure

# Check files on your device. Remove those redundant to ensure adequate space for the image file to be downloaded.

<Sysname> dir

Directory of flash:/

 

   0   drw-         -  Dec 07 2005 10:00:57   filename

   1   drw-         -  Jan 02 2006 14:27:51   logfile

   2   -rw-      1216  Jan 02 2006 14:28:59   config.cfg

   3   -rw-      1216  Jan 02 2006 16:27:26   backup.cfg

 

2540 KB total (2511 KB free)

<Sysname> delete flash:/backup.cfg

# Download the image file from the server.

<Sysname> ftp 172.16.104.110

Trying 172.16.104.110 ...

Connected to 172.16.104.110.

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

User(172.16.104.110:(none)):abc

331 Give me your password, please

Password:

230 Logged in successfully

[ftp] binary

200 Type set to I

[ftp] get aaa.app bbb.app

 

227 Entering Passive Mode (10.1.1.1,4,1).

125 BINARY mode data connection already open, transfer starting for aaa.app.

.....226 Transfer complete.

FTP: 5805100 byte(s) received in 19.898 second(s) 291.74Kbyte(s)/sec.

[ftp] bye

# Specify the image file for next startup with the boot-loader command

<Sysname> boot-loader file bbb.app slot 6 main

<Sysname> reboot

 

  Caution:

The image file specified by the boot-loader command for next startup must be saved under the root directory. You can change the directory of a file to the root directory through copy or move operation. For the details of the boot-loader command, refer to Device Management Commands in the System Volume.

 

2.3  Configuring the FTP Server

2.3.1  Configuring FTP Server Operating Parameters

The FTP server uses two modes to update files when you upload files (use the put command) to the FTP server:

l           In fast mode, the FTP server starts writing data to the Flash after file transfer completes. This protects the files intended to be overwritten on the device from being corrupted in the event that anomalies, power failure for example, occur during a file transfer.

l           In normal mode, the FTP server writes data to the Flash during file transfer. This means that any anomaly, power failure for example, during file transfer might result in file corruption on the router. This mode, however, consumes less memory space than the fast mode.

Follow these steps to configure the FTP server:

To do…

Use the command…

Remarks

Enter system view

system-view

Enable the FTP server

ftp server enable

Required

Disabled by default.

Configure the idle-timeout timer

ftp timeout minute

Optional

30 minutes by default.

In idle-timeout time, if there is no information interaction between the FTP server and client, the connection between them is terminated.

Set the file update mode in FTP

ftp update { fast | normal }

Optional

Normal update is used by default.

 

2.3.2  Configuring Authentication and Authorization for Accessing FTP Server

To allow an FTP user to access certain directories on the FTP server, you need to create an account for the user, authorizing access to the directories and associating the username and password with the account.

Follow these steps to configure authentication and authorization for FTP server:

To do…

Use the command…

Remarks

Enter system view

system-view

Create a local user and enter its view

local-user user-name

Required

No local user exists by default, and the system does not support FTP anonymous user access.

Assign a password to the user

password { simple | cipher } password

Required

 

&  Note:

If FTP server performs authentication, authorization and accounting (AAA) policy on FTP client, AAA related parameters should be configured on the FTP server. For more information about the local-user, password and service-type commands and the AAA related configuration, refer to the AAA RADIUS HWTACACS Configuration in the Security Volume.

 

2.3.3  FTP Server Configuration Examples

I. Network requirements

l           Use your device as an FTP server. Create a user account for an FTP user on it, setting the username to abc and the password to passwordtest.

l           The IP address of the VLAN interface is 1.1.1.1/16.

l           The PC serves as the FTP client, which is to upload an image file.

II. Network diagram

Figure 2-3 Smooth upgrading using the FTP server

III. Configuration procedure

1)         Configure Device (FTP Server)

# Create an FTP user account abc, setting its password to passwordtest.

<Sysname> system-view

[Sysname] local-user abc

[Sysname-luser-abc] service-type ftp

[Sysname-luser-abc] password simple passwordtest

# Specify abc to use FTP, and authorize its access to certain directory.

[Sysname-luser-abc] work-directory flash:

[Sysname-luser-abc] quit

# Enable FTP server.

[Sysname] ftp server enable

[Sysname] quit

# Check files on your device. Remove those redundant to ensure adequate space for the image file to be uploaded.

<Sysname> dir

Directory of flash:/

 

   0   drw-         -  Dec 07 2005 10:00:57   filename

   1   drw-         -  Jan 02 2006 14:27:51   logfile

   2   -rw-      1216  Jan 02 2006 14:28:59   config.cfg

   3   -rw-      1216  Jan 02 2006 16:27:26   back.cfg

   4   drw-         -  Jan 02 2006 15:20:21   ftp

 

2540 KB total (2511 KB free)

<Sysname> delete /unreserved flash:/back.cfg

2)         Configure the PC (FTP Client)

# Upload the image file to the FTP server and save it under the root directory of the FTP server.

c:\> ftp 1.1.1.1

Connected to 1.1.1.1.

220 FTP service ready.

User(1.1.1.1:(none)):abc

331 Password required for abc.

Password:

230 User logged in.

ftp> put aaa.app bbb.app

 

&  Note:

l      When upgrading the configuration file with FTP, put the new file under the root directory

l      After you finish upgrading the Boot ROM program through FTP, you must execute the bootrom upgrade command to refresh the system configuration.

 

# Specify the image file for next startup with the boot-loader command.

<Sysname> boot-loader file bbb.app slot 6 main

<Sysname> reboot

 

  Caution:

The image file specified by the boot-loader command for next startup must be saved under the root directory. You can change the directory of the file to the root directory through copy or move operation. For details of the boot-loader command, refer to Device Management Commands in the System Volume.

 

2.4  Displaying and Maintaining FTP

Use the following display commands to display and maintain the FTP server:

To do…

Use the command…

Remarks

Display the configuration of the FTP client

display ftp client configuration

Available in any view

Display the configuration of the FTP server

display ftp-server

Available in any view

Display detailed information about logged-in FTP users

display ftp-user

Available in any view

 


Chapter 3  TFTP Configuration

When configuring TFTP, go to these sections for information you are interested in:

l           TFTP Overview

l           Configuring the TFTP Client

l           Displaying and Maintaining the TFTP Client

l           TFTP Client Configuration Examples

3.1  TFTP Overview

The Trivial File Transfer Protocol (TFTP) provides functions similar to those provided by FTP, but it is not as complex as FTP in interactive access interface and authentication. Therefore, it is more suitable where complex interaction is not needed between client and server.

TFTP uses the UDP service for data delivery. In TFTP, file transfer is initiated by the client.

In a normal file downloading process, the client sends a read request to the TFTP server, receives data from the server, and then sends the acknowledgement to the server.

In a normal file uploading process, the client sends a write request to the TFTP server, sends data to the server, and receives the acknowledgement from the server.

TFTP transfers files in two modes: binary for programming files and ASCII for text files.

Before using TFTP, the administrator needs to configure IP addresses for the TFTP client and server, and make sure that there is a reachable route between the TFTP client and server.

 

&  Note:

Only the TFTP client service is available with your device at present.

 

Figure 3-1 TFTP configuration diagram

When the device serves as the TFTP client, you need to perform the following configuration:

Table 3-1 Configuration when the device serves as the TFTP client

Device

Configuration

Remarks

Device (TFTP client)

You can use the tftp command to establish the connection to the remote TFTP server to upload/download files to/from the TFTP server

TFTP is suitable where complex interaction is not needed between client and server.

Make sure that there is a route between the device and the TFTP server.

PC (TFTP server)

Enable TFTP server on the PC, and configure the TFTP working directory.

 

3.2  Configuring the TFTP Client

When a device acts as a TFTP client, you can upload files on the device to a TFTP server and download files from the TFTP server to the local device. You can use either of the following ways to download files:

l           Normal download: The device writes the obtained files to the storage device directly. In this way, the original system file will be overwritten and if file download fails (for example, due to network disconnection), the device cannot start up normally because the original system file has been deleted.

l           Secure download: The device saves the obtained files to its memory and does not write them to the storage device until all user files are obtained. In this way, if file download fails (for example, due to network disconnection), the device can still start up because the original system file is not overwritten. This mode is securer but consumes more memory.

You are recommended to use the latter mode or use a filename not existing in the current directory as the target filename when downloading startup file or configuration file.

Multiple routes may exist for a TFTP client to successfully access the TFTP server. You can specify one by configuring the source address of the packets from the TFTP client to meet the requirement of the security policy of the TFTP client. You can configure the source address by configuring the source interface or source IP address. The primary IP address configured on the source interface is the source address of the transmitted packets. The source address of the transmitted packets is selected following these rules:

l           If no source address of the TFTP client is specified, a device uses the IP address of the interface determined by the routing protocol as the source IP address to communicate with a TFTP server.

l           If the source address is specified with the tftp client source or tftp command, this source address is adopted.

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

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 only for the current tftp connection.

Follow these steps to configure the TFTP client:

To do…

Use the command…

Remarks

Enter system view

system-view

Reference an access control list (ACL) to the TFTP server

tftp-server [ ipv6 ] acl acl-number

Optional

Configure the source address of the TFTP client

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

Optional

A device uses the source address determined by the routing protocol to communicate with the TFTP server by default.

Return to user view

quit

Download or upload a file in IPv4 network

tftp server-address { get | put | sget } source-filename [ destination-filename ] [ source { ip source-ip-address | interface interface-type interface-number } ]

Optional

Download or upload a file in IPv6 network

tftp ipv6 tftp-ipv6-server [ -i interface-type interface-number ] { get | put } source-file [ destination-file ]

Optional

 

&  Note:

l      If no primary IP address is configured on the source interface, TFTP connection fails.

l      If you use the ftp client source command to first configure the source interface and then the source IP address of the packets of the TFTP client, the new source IP address will overwrite the current one, and vice versa.

 

3.3  Displaying and Maintaining the TFTP Client

To do…

Use the command…

Remarks

Display the configuration of the TFTP client

display tftp client configuration

Available in any view

 

3.4  TFTP Client Configuration Examples

I. Network requirements

l           Use a PC as the TFTP server and your device as the TFTP client.

l           PC uses IP address 1.2.1.1/16 and a TFTP working directory has been defined for the client.

l           On your device, VLAN-interface 1 is assigned an IP address 1.1.1.1/16.

l           TFTP an image file from PC for upgrading and a configuration file config.cfg to PC for backup.

II. Network diagram

Figure 3-2 Smooth upgrading using the TFTP client function

III. Configuration procedure

1)         Configure PC (TFTP Server), the configuration procedure omitted.

l           On the PC, enable TFTP server

l           Configure a TFTP working directory

2)         Configure the device (TFTP Client)

 

  Caution:

If the free memory space of the device is not big enough, you should delete the existing programs before downloading new ones.

 

# Enter system view.

<Sysname> system-view

# Assign VLAN-interface 1 an IP address 1.1.1.1/16.

[Sysname] interface Vlan-interface 1

[Sysname-Vlan-interface1] ip address 1.1.1.1 255.255.0.0

[Sysname-Vlan-interface1] return

# Download an application file aaa.app from the TFTP server.

<Sysname> tftp 1.2.1.1 get aaa.app bbb.app

# Upload a configuration file config.cfg to the TFTP server.

<Sysname> tftp 1.2.1.1 put config.cfg configback.cfg

# Specify the image file for next startup with the boot-loader command.

<Sysname> boot-loader file bbb.app slot 6 main

<Sysname> reboot

 

  Caution:

The image file specified by the boot-loader command for next startup must be saved under the root directory. You can change the directory of the file to the root directory through copy or move operation. For details of the boot-loader command, refer to Device Management Commands in the System Volume.

 

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Intelligent Storage
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
  • Technical Blogs
All Support
  • Become A Partner
  • Partner Policy & Program
  • Global Learning
  • Partner Sales Resources
  • Partner Business Management
  • Service Business
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网