- Table of Contents
-
- Fundamentals Configuration Guide
- 00-Preface
- 01-Feature Matrix
- 02-CLI Configuration
- 03-Controlling Login Users
- 04-File Management Configuration
- 05-FTP and TFTP Configuration
- 06-Device Management Configuration
- 07-Basic System Configuration
- 08-HTTP Configuration
- 09-Logging In to the AP Configuration
- 10-Index
- Related Documents
-
Title | Size | Download |
---|---|---|
04-File Management Configuration | 144.39 KB |
Table of Contents
1 File Management Configuration
Setting File System Prompt Modes
2 Configuration File Management
Format and Content of a Configuration File
Coexistences of Multiple Configuration Files
Startup with the Configuration File
Saving the Current Configuration
Setting Configuration Rollback
Specifying a Configuration File to Be Used at the Next Startup
Backing Up the Startup Configuration File
Deleting the Startup Configuration File to Be Used at the Next Startup
Restoring the Startup Configuration File
Displaying and Maintaining Device Configuration
l The models listed in this document are not applicable to all regions. Please consult your local sales office for the models applicable to your region.
l Support of the H3C WA series WLAN access points (APs) for features may vary by AP model. For more information, see Feature Matrix.
l The interface types and the number of interfaces vary by AP model.
l The term AP in this document refers to common APs, wireless bridges, and mesh APs.
1 File Management Configuration
This chapter includes the section:
The application file name used in this manual is test.bin.
Managing Files
Files such as host software and configuration files that are necessary for the operation of the device are saved in the storage media of the device. You can manage files on your device through these operations:Directory Operations, File Operations, Batch Operations, and Memory Space Management.
Filename Formats
When you specify a file, you must enter the filename in one of the following formats.
Filename formats:
Format |
Description |
Length |
Example |
file-name |
Specifies a file under the current working directory. |
1 to 91 characters |
a.cfg indicates a file named a.cfg under the current working directory. |
path/file-name |
Specifies a file in the specified folder under the current working directory. path represents the folder name. You can specify multiple folders, indicating a file under a multi-level folder. |
1 to 135 characters |
test/a.cfg indicates a file named a.cfg in the test folder under the current working directory. |
drive:/[path]/file-name |
Specifies a file in the specified storage medium on the device. drive represents the storage medium name. The storage medium on the device is flash. The device has only one storage medium, so you do not need to provide the storage medium information. |
1 to 135 characters |
flash:/test/a.cfg indicates a file named a.cfg in the test folder under the root directory of the flash memory. |
Directory Operations
Displaying directory information
To do… |
Use the command… |
Remarks |
Display directory or file information |
dir [ /all ] [ file-url ] |
Required Available in user view |
Displaying the current working directory
To do… |
Use the command… |
Remarks |
Display the current working directory |
pwd |
Required Available in user view |
Changing the current working directory
To do… |
Use the command… |
Remarks |
Change the current working directory |
cd { directory | .. | / } |
Required Available in user view |
Creating a directory
To do… |
Use the command… |
Remarks |
Create a directory |
mkdir directory |
Required Available in user view |
Removing a directory
To do… |
Use the command… |
Remarks |
Remove a directory |
rmdir directory |
Required Available in user view |
l The directory to be removed must be empty, meaning that before you remove a directory, you must delete all the files and the subdirectory under this directory. For more information about the delete and rmdir commands, see File Management in the Fundamentals Command Reference.
l The rmdir command automatically deletes the files in the recycle bin in the current directory.
File Operations
You can display the specified directory or file information; display file contents; rename, copy, move, remove, restore, and delete files.
You can create a file by copying, downloading or using the save command. For more information about the save command, see File Management in the Fundamentals Command Reference.
Displaying file information
To do… |
Use the command… |
Remarks |
Display file or directory information |
dir [ /all ] [ file-url ] |
Required Available in user view |
Displaying the contents of a file
To do… |
Use the command… |
Remarks |
Display the contents of a file |
more file-url |
Required Currently only a .txt file can be displayed. Available in user view |
Renaming a file
To do… |
Use the command… |
Remarks |
Rename a file |
rename fileurl-source fileurl-dest |
Required Available in user view |
Copying a file
To do… |
Use the command… |
Remarks |
Copy a file |
copy fileurl-source fileurl-dest |
Required Available in user view |
Moving a file
To do… |
Use the command… |
Remarks |
Move a file |
move fileurl-source fileurl-dest |
Required Available in user view |
Deleting a file
To do… |
Use the command… |
Remarks |
Move a file to the recycle bin or delete it permanently |
delete [ /unreserved ] file-url |
Required Available in user view |
l The files in the recycle bin still occupy storage space. To delete a file in the recycle bin, execute the reset recycle-bin command in the directory that the file originally belongs. It is recommended to empty the recycle bin timely with the reset recycle-bin command to save storage space.
l The delete /unreserved file-url command deletes a file permanently and the action cannot be undone. Execution of this command equals that you execute the delete file-url command and then the reset recycle-bin command in the same directory.
Restoring a file from the recycle bin
To do… |
Use the command… |
Remarks |
Restore a file from the recycle bin |
undelete file-url |
Required Available in user view |
Emptying the recycle bin
To do… |
Use the command… |
Remarks |
Enter the original working directory of the file to be deleted |
cd { directory | .. | / } |
Optional If the original directory of the file to be deleted is not the current working directory, this command is required. Available in user view |
Delete the file under the current directory and in the recycle bin |
reset recycle-bin [ /force ] |
Required Available in user view |
Batch Operations
A batch file is a set of executable commands. Executing a batch file equals executing the commands in the batch file one by one.
To execute a batch file:
1) Edit the batch file on your PC.
2) Download the batch file to the device. If the suffix of the file is not .bat, use the rename command to change the suffix to .bat.
3) Execute the batch file.
Follow these steps to execute a batch file:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Execute a batch file |
execute filename |
Required |
Execution of a batch file does not guarantee the successful execution of every command in the batch file. If a command has error settings or the conditions for executing the command are not satisfied, the system will skip the command to the next one.
Memory Space Management
When some space of a storage medium becomes inaccessible due to abnormal operations, you can use the fixdisk command to restore the space of the storage medium. The execution of the format command formats the storage medium, and all the data on the storage medium is deleted.
Use the following commands to manage the storage medium space:
To do… |
Use the command… |
Remarks |
Restore the space of a storage medium |
fixdisk device |
Optional Available in user view |
Format a storage medium |
format device |
Optional Available in user view |
When you format a storage medium, all files stored on it are erased and cannot be restored. In particular, if there is a startup configuration file on the storage medium, formatting the storage medium results in loss of the startup configuration file.
Setting File System Prompt Modes
The system provides the following two prompt modes:
l alert: In this mode, the system warns you about operations that may bring undesirable consequences such as file corruption or data loss.
l quiet: In this mode, the system does not ask confirmation for any operation.
To prevent undesirable consequence resulted from misoperations, the alert mode is preferred.
Follow these steps to set file system prompt modes:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Set the operation prompt mode of the file system |
file prompt { alert | quiet } |
Optional The default is alert. |
Example for File Operations
# Display the files and the subdirectories in the current directory.
<Sysname> dir
Directory of flash:/
0 -rw- 4136856 Oct 10 2002 10:10:10 test.bin
1 -rw- 1442 Apr 26 2000 13:01:09 startup.cfg
2 -rw- 393216 Oct 12 2007 13:12:48 extendbtm.bin
6477 KB total (2046 KB free)
# Create new folder mytest in the test directory.
<Sysname> cd test
<Sysname> mkdir mytest
%Created dir flash:/test/mytest.
# Display the current working directory.
<Sysname> pwd
flash:/test
# Display the files and the subdirectories in 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 ..
# Display the current working directory.
<Sysname> pwd
flash:/
The device provides the configuration file management function. You can manage configuration files at a user-friendly command line interface (CLI).
This chapter includes these sections:
l Saving the Current Configuration
l Setting Configuration Rollback
Configuration File Overview
A configuration file saves the device configurations in command lines in text format to ensure that these configurations can be kept when the device restarts or the configurations are rolled back. You can view configuration information conveniently through configuration files.
Types of Configuration
The configuration of a device falls into two types:
l Startup configuration: Configuration used for initialization when the device boots. If this file does not exist, the system boots using null configuration, that is, using the default parameters.
l Running configuration: The currently running configuration of the system. The current running configuration may include the startup configuration if the startup configuration is not modified during system operation, and it also includes the new configuration added during the system operation. The current running configuration is stored in the temporary storage medium of the device, and will be removed if not saved when the device reboots.
Format and Content of a Configuration File
A configuration file is saved as a text file. It is saved following these rules:
l A configuration file contains commands, and only non-default configuration settings are saved.
l Commands in a configuration file are listed in sections by views, usually in the order of system view, interface view, routing protocol view, and user interface view. Sections are separated with one or multiple blank lines or comment lines that start with a pound sign #.
l A configuration file ends with a return.
Coexistences of Multiple Configuration Files
The device can save multiple configuration files on its storage medium. You can save the configuration used in different environments as different configuration files. In this case, when the device moves between these networking environments, you just need to specify the corresponding configuration file as the startup configuration file to be used at the next boot of the device and restart the device, so that the device can adapt to the network rapidly, saving the configuration workload.
At a moment, there are at most one main startup configuration file and one backup startup configuration file. You can specify neither of the two files (displayed as NULL).
You can specify main and backup startup configuration files to be used at the next startup of the device in two methods:
l Specify them when saving the current configuration. For more information, see Saving the Current Configuration.
l Specify them when specifying the startup configuration file for the next system startup. For more information, see Specifying a Configuration File to Be Used at the Next Startup.
Startup with the Configuration File
The device takes the following steps when it boots if it supports main and backup configuration files:
1) If the main startup configuration file you specified exists, the device starts up with this configuration file.
2) If the main startup configuration file you specified does not exist but the backup startup configuration file exists, the device starts up with the backup startup configuration file.
3) If neither the main nor the backup startup configuration file exists, the device starts up with null configuration (namely, starts up with the factory default configuration).
Saving the Current Configuration
You can modify the configuration on your device at the CLI. To use the modified configuration for the next startup, you must save it (using the save command) to the configuration file.
You can save the configuration in either of the following two modes:
l Fast saving mode: Fast saving mode is implemented by using the save command without providing the safely keyword. The mode saves the file quickly but is likely to lose the existing configuration file if the device reboots or the power fails during the process.
l Safe mode. Safe mode is implemented by using the save command with the safely keyword. The mode saves the file more slowly that the fast saving mode but can retain the configuration file on the device even if the device reboots or the power fails during the process.
The fast saving mode is suitable for environments where power supply is stable. The safe mode, however, is preferred in environments where stable power supply is unavailable or remote maintenance is involved.
Follow the step below to save the current configuration:
To do… |
Use the command… |
Remarks |
Save the current configuration to the specified file, but the configuration file is not set as the file to be used at the next startup |
save file-url |
Required Use either command Available in any view |
Save the current configuration to the root directory of the storage medium and specify the file as the startup configuration file to be used at the next system startup p |
save [ safely ] [ backup | main ] |
l The configuration file must be with extension .cfg.
l The execution of the save [ safely ] and save [ safely ] main commands has the same effect: The system saves the current configuration and specifies the configuration file as the main startup configuration file to be used at the next system startup.
l During the execution of the save [ safely ] [ backup | main ] command, the startup configuration file to be used at the next system startup may be lost if the device reboots or the power supply fails. In this case, the device boots with the null configuration, and after the device reboots, you need to re-specify a startup configuration file for the next system startup (see Specifying a Configuration File to Be Used at the Next Startup).
Setting Configuration Rollback
Configuration Rollback
Configuration rollback allows you to revert to a previous configuration state based on a specified configuration file. The specified configuration file must be a valid .cfg file generated by using either the backup function (manually or automatically) or the save command, or, if a configuration file is generated by another device, the configuration file must comply with the format of the configuration file on the current device. You are recommended to use the configuration file that is generated by using the backup function (manually or automatically). Configuration rollback can be applied in these situations:
l Running configuration error. Rolling back the running configuration to a correct one is needed.
l The application environment has changed and the device has to run in a configuration state based on a previous configuration file without being rebooted.
Before setting configuration rollback:
1) Specify the filename prefix and path for saving the current configuration.
2) Save the running configuration with the specified filename (filename prefix + serial number) to the specified path. The running configuration can be saved automatically or manually.
When you enter the configuration replace file command, the system compares the current running configuration and the specified replacement configuration file. The configuration replace file command:
l Preserves all commands present in both the replacement configuration file and the current running configuration.
l Removes commands from the current running configuration that are not present in the replacement configuration file.
l Applies the commands from the replacement configuration file that are not present in the current running configuration.
Configuration task list
Complete these tasks to configure the configuration rollback:
Task |
Remarks |
Configuring parameters for saving the current running configuration |
Required |
Enabling automatic saving of the current running configuration |
Required Use either approach |
Required |
Configuring parameters for saving the current running configuration
Before the current running configuration is saved manually or automatically, the file path and filename prefix must be configured. Then, the system saves the current running configuration with the specified filename (filename prefix_serial number.cfg) to the specified path. The filename of a saved configuration file is like 20080620archive_1.cfg, or 20080620archive_2.cfg. The saved configuration files are numbered automatically, from 1 to 1,000 (with increment of 1). If the serial number reaches 1,000, it restarts from 1. If you change the path or filename prefix, or reboot the device, the saved file serial number restarts from 1, and the system recounts the saved configuration files. If you change the path of the saved configuration files, the files in the original path become common configuration files, and are not processed as saved configuration files.
The number of saved configuration files has an upper limit. After the maximum number of files is saved, the system deletes the oldest files when the next configuration file is saved.
Follow these steps to configure parameters for saving the current running configuration:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Configure the path and filename prefix for saving configuration files |
archive configuration location directory filename-prefix filename-prefix |
Required By default, the path and filename of the saved configuration file are not configured, and the system does not save the configuration file at a specified interval. |
Set the maximum number of configuration files that can be saved |
archive configuration max file-number |
Optional The default number is 5. |
l If the undo archive configuration location command is executed, the current running configuration can neither be saved manually nor automatically, and the configuration by executing the archive configuration interval and archive configuration max commands restores to the default. Meanwhile, the saved configuration files are cleared.
l The value of the file-number argument is determined by the memory space. You are recommended to set a comparatively small value for the file-number argument if the available memory space is small.
Enabling automatic saving of the current running configuration
You can configure the system to save the current running configuration at a specified interval, and use the display archive configuration command to view the filenames and save time of the saved configuration files, so as to roll back the current configuration to a previous configuration state.
Configure an automatic saving interval according to the storage medium performance and the frequency of configuration modification:
l If the configuration of the device does not change frequently, you are recommended to save the current running configuration manually as needed
l If a low-speed storage medium (such as a flash) is used, you are recommended either to save the current running configuration manually, or to configure automatic saving with an interval longer than 1,440 minutes (24 hours).
Follow these steps to automatically save the current running configuration:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enable the automatic saving of the current running configuration, and set the interval |
archive configuration interval minutes |
Optional Disabled by default |
The path and filename prefix for saving configuration files must be specified before you configure the automatic saving period.
Manually saving the current running configuration
Automatic saving of the current running configuration occupies system resources, and frequent saving greatly affects system performance. Therefore, if the system configuration does not change frequently, you are recommended to disable the automatic saving of the current running configuration and save it manually.
If the modification to the configuration fails, save the current running configuration manually before you modify it so that the device can revert to the configuration state before the modification.
Follow the step below to save the current running configuration manually:
To do… |
Use the command… |
Remarks |
Save the current running configuration manually |
archive configuration |
Required Available in user view |
The path and filename prefix for saving configuration files must be specified before you save the current running configuration manually; otherwise, the operation fails.
Setting configuration rollback
Follow these steps to set configuration rollback:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Set configuration rollback |
configuration replace file filename |
Required |
Do not unplug and plug a card during configuration rollback, in other words, when the system is executing the configuration replace file command. In addition, configuration rollback may fail if one of the following situations is present (if a command cannot be rolled back, the system skips it and processes the next one):
l The complete undo form of a command is not supported, or in other words, you cannot get the actual undo form of the command by simply putting the keyword undo in front of the command, so the complete undo form of the command cannot be recognized by the device.
l The configuration cannot be removed, such as hardware-related commands
l Commands in different views are dependent on each other
l If the replacement configuration file is not a complete file generated by using the save or archive configuration command, or the file is copied from a different type of device, the configuration cannot be rolled back. Make sure that the replacement configuration file is correct and compatible with the current device.
Specifying a Configuration File to Be Used at the Next Startup
You can specify a configuration file as the startup configuration file to be used at the next system startup in either of the following two ways:
l Use the save command. If you save the current configuration to the specified configuration file in the interactive mode, the system automatically sets the file as the configuration file to be used at the next system startup (for a device supporting main/backup startup configuration file, the system sets the file as the main startup configuration file to be used at the next system startup).
l Use the command dedicated to specify a startup configuration file, which is described in the following table.
Follow the step below to specify a configuration file to be used at the next startup:
To do… |
Use the command… |
Remarks |
Specify a configuration file to be used at the next startup |
startup saved-configuration cfgfile [ backup | main ] |
Required Available in user view |
A configuration file must use .cfg as its extension name and the startup configuration file must be saved in the root directory of the storage medium of the AP.
Backing Up the Startup Configuration File
Follow the step below to back up the startup configuration file to be used at the next system startup:
To do… |
Use the command… |
Remarks |
Back up the configuration file to be used at the next system startup to the specified TFTP server |
backup startup-configuration to dest-addr [ dest-filename ] |
Required Available in user view |
Before backing up the configuration file:
l Make sure 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 view whether you have set the startup configuration file, and use the dir command to view whether this file exists. If the file is set as NULL or does not exist, the backup operation fails.
Deleting the Startup Configuration File to Be Used at the Next Startup
You can delete the startup configuration file to be used at the next system startup at the CLI. 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 does not delete the configuration file but only sets the corresponding startup configuration file (main or backup, according to which one you specified in the command) to NULL.
You may need to delete the startup configuration file to be used at the next startup for one of these reasons:
l After you upgrade system software, the existing configuration file does not match the new system software.
l The configuration file is corrupted (often caused by loading a wrong configuration file).
When the startup configuration file is deleted, the device uses the null configuration when it reboots.
Follow the step below to delete the startup configuration file to be used at the next startup:
To do… |
Use the command… |
Remarks |
Delete the startup configuration file to be used at the next startup |
reset saved-configuration [ backup | main ] |
Required Available in user view |
This command permanently deletes the configuration file from the device. Use it with caution.
Restoring the Startup Configuration File
The restore function allows you to copy a configuration file from a TFTP server to the device and specify the file as the startup configuration file to be used at the next system startup.
Follow the step below to restore the startup configuration file to be used at the next system startup:
To do… |
Use the command… |
Remarks |
Restore the configuration file to be used at the next startup |
restore startup-configuration from src-addr filename |
Required Available in user view |
l Before restoring a configuration file, make sure that the server is reachable, the server is enabled with TFTP service, and the client has permission to read and write.
l When the command is successfully executed, you can use the display startup command (in user view) to view whether the filename of the configuration file to be used at the next startup is the same as the filename argument, and use the dir command to view whether the restored file exists.
Displaying and Maintaining Device Configuration
To do… |
Use the command… |
Remarks |
Display information about configuration rollback |
display archive configuration |
Available in any view |
Display the currently running configuration file saved on the storage medium of the device |
display saved-configuration [ by-linenum ] |
|
Display the configuration files for this and the next system startup |
display startup |
|
Display the validated configuration in current view |
display this [ by-linenum ] |
|
Display the current configuration |
display current-configuration [ [ configuration [ configuration ] | interface [ interface-type ] [ interface-number ] ] [ by-linenum ] [ | { begin | include | exclude } text ] ] |
For detailed description of the display this and display current-configuration commands, see Basic System Configuration in the Fundamentals Command Reference.