Huawei CloudEngine Switches Config Guide
Huawei CloudEngine Switches Config Guide
Switches
V200R001C00
Issue 05
Date 2017-05-08
and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.
All other trademarks and trade names mentioned in this document are the property of their respective
holders.
Notice
The purchased products, services and features are stipulated by the contract made between Huawei and the
customer. All or part of the products, services and features described in this document may not be within the
purchase scope or the usage scope. Unless otherwise specified in the contract, all statements, information,
and recommendations in this document are provided "AS IS" without warranties, guarantees or
representations of any kind, either express or implied.
The information in this document is subject to change without notice. Every effort has been made in the
preparation of this document to ensure accuracy of the contents, but all statements, information, and
recommendations in this document do not constitute a warranty of any kind, express or implied.
Website: [Link]
Intended Audience
This document provides the basic concepts, configuration procedures, and configuration
examples in different application scenarios of the Basic configuration supported by the
device.
Symbol Conventions
The symbols that may be found in this document are defined as follows.
Symbol Description
Symbol Description
Command Conventions
The command conventions that may be found in this document are defined as follows.
Convention Description
Security Conventions
l Password setting
– SHA1, SHA2, and MD5 are irreversible encryption algorithm. When configuring a
password for local administrator, it is recommended that you use the SHA2
irreversible encryption algorithm.
– To prevent brute force cracking of the user password, the iteration algorithm is
added to the password on the basis of salts. The iteration algorithm uses PBKDF2
or scrypt key export algorithm.
– The ECB mode has a poor capability of defending against plaintext playback
attacks, so ECB is not recommended for password encryption.
– In SSH2.0, the symmetric cryptography using the CBC mode may undergo the
plaintext-recovery attack to cause a data leak. Therefore, the CBC mode is not
recommended for SSH2.0.
l Personal data
Some personal data may be obtained or used during operation or fault location of your
purchased products, services, features, so you have an obligation to make privacy
policies and take measures according to the applicable law of the country to protect
personal data.
l The terms mirrored port, port mirroring, traffic mirroring, and mirroring in this manual
are mentioned only to describe the product's function of communication error or failure
detection, and do not involve collection or processing of any personal information or
communication data of users.
Declaration
This manual is only a reference for you to configure your devices. The contents in the manual,
such as command line syntax, and command outputs, are based on the device conditions in
the lab. The manual provides instructions for general scenarios, but do not cover all usage
scenarios of all product models. The contents in the manual may be different from your actual
device situations due to the differences in software versions, models, and configuration files.
The manual will not list every possible difference. You should configure your devices
according to actual situations.
The specifications provided in this manual are tested in lab environment (for example, the
tested device has been installed with a certain type of boards or only one protocol is run on
the device). Results may differ from the listed specifications when you attempt to obtain the
maximum values with multiple functions enabled on the device.
CE8800&7800&6800&5800 NMS
series switches Product
Software Version
CE8800&7800&6800&5800 Controller
series switches Product
Software Version
Change History
Changes between document issues are cumulative. Therefore, the latest document version
contains all updates made to previous versions.
Contents
2 ZTP Configuration...................................................................................................................... 23
2.1 Introduction to ZTP...................................................................................................................................................... 23
2.2 Principles...................................................................................................................................................................... 24
2.2.1 Implementation.......................................................................................................................................................... 24
2.2.2 Intermediate File in INI Format.................................................................................................................................27
2.2.3 Intermediate File in Python Format...........................................................................................................................29
2.2.4 Automatic Stacking in ZTP....................................................................................................................................... 56
2.2.5 Checking the Integrity of Version Files..................................................................................................................... 57
2.2.6 Installing Licenses in a Batch.................................................................................................................................... 57
2.3 Configuration Notes..................................................................................................................................................... 58
2.4 Default Configuration...................................................................................................................................................60
2.5 Configuring an Unconfigured Device to Implement Automatic Deployment Using a USB Flash Drive................... 60
2.5.1 Enabling the ZTP Function........................................................................................................................................60
2.5.2 Editing the Intermediate File..................................................................................................................................... 61
5.3.4 Configuring the User Level on the VTY User Interface......................................................................................... 165
5.3.5 Configuring the Authentication Mode for VTY Users............................................................................................166
5.3.6 (Optional) Enabling the Function of Blocking IP Addresses in VTY Access Scenarios........................................168
5.3.7 (Optional) Enabling the VTY User Interface's Security Policy.............................................................................. 168
5.3.8 Checking the Configurations................................................................................................................................... 169
5.4 Configuration Examples............................................................................................................................................. 169
5.4.1 Example of Configuring the Console User Interface.............................................................................................. 169
5.4.2 Example of Configuring a VTY User Interface...................................................................................................... 171
7.5.2 Example for Managing Files When the Device Functions as an FTP Server......................................................... 299
7.5.3 Example for Managing Files Using SFTP When the Device Functions as an SSH Server.................................... 302
7.5.4 Example for Managing Files When the Device Functions as a TFTP Client..........................................................304
7.5.5 Example for Managing Files When the Device Functions as an FTP Client.......................................................... 305
7.5.6 Example for Managing Files When the Device Functions as an SFTP Client........................................................307
7.5.7 Example for Managing Files When the Device Functions as an SCP Client..........................................................312
7.6 Common Misconfigurations....................................................................................................................................... 314
7.6.1 FTP Login Failure................................................................................................................................................... 315
7.6.2 Failure in Uploading Files to the FTP Server..........................................................................................................317
9 ISSU Configuration...................................................................................................................347
9.1 Introduction to ISSU...................................................................................................................................................347
9.2 Principles.................................................................................................................................................................... 348
9.3 Configuration Notes................................................................................................................................................... 350
9.4 Configuring ISSU....................................................................................................................................................... 353
9.4.1 (Optional) Adding a Device to a Group.................................................................................................................. 353
9.4.2 Checking ISSU Upgrade......................................................................................................................................... 353
9.4.3 Starting the ISSU Upgrade...................................................................................................................................... 354
9.4.4 Checking the Configuration.....................................................................................................................................355
9.5 Configuration Examples............................................................................................................................................. 355
9.5.1 Example for Performing an ISSU Upgrade............................................................................................................. 355
1 CLI Overview
This chapter describes how to perform configuration and routine maintenance on devices by
running commands.
The device provides various command views. For the methods of entering the command
views except the following views, see the CloudEngine 8800&7800&6800&5800 Series
Switches Command Reference.
How To Enter: When a user logs in to the device, the user enters the user view and the
following prompt is displayed:
<HUAWEI>
l System view
In the system view, you can set the system parameters of the device, and enter other
function views from this view.
How To Enter: Run the system-view command and press Enter in the user view. The
system view is displayed.
<HUAWEI> system-view
Enter system view, return user view with return command.
[~HUAWEI]
l Interface view
In the interface view, you can configure interface parameters including physical
attributes, link layer protocols, and IP addresses.
How To Enter: Run the interface command and specify an interface type and number to
enter the interface [Link] interface 10GE is used as an example.
[~HUAWEI] interface 10ge X/Y/Z
[~HUAWEI-10GEX/Y/Z]
X/Y/Z indicates the number of an interface that needs to be specified. It is in the format of
stack ID/card number/interface sequence number.
l Routing protocol view
In routing protocol views, you can configure most routing protocol parameters. The
routing protocol views include the IS-IS view, OSPF view, and RIP view.
How To Enter: Run a command to activate a routing protocol process in the system view.
The corresponding routing protocol view is displayed.
[~HUAWEI] isis
[*HUAWEI-isis-1]
The command line prompt HUAWEI is the default host name (sysname). The prompt
indicates the current view. For example, <> indicates the user view and [] indicates all other
views except the user view.
You can enter ! or # followed by a character string in any view. All entered content
(including ! and #) is displayed as comments. That is, the corresponding configuration is not
generated.
NOTE
l Some commands can be executed in multiple views, but they have different functions after being
executed in different views. For example, you can run the lldp enable command in the system view
to enable LLDP globally and in the interface view to enable LLDP on an interface.
l In the system view, you can run the diagnose command to enter the diagnostic view. Diagnostic
commands are used for device fault diagnosis. If you run some commands in the diagnostic view, the
device may fail to run properly or services may be interrupted. Contact technical support personnel
and use these diagnostic commands with caution.
For example, after you run the quit command to return from the AAA view to the system
view, you can run the quit command again to return from the system view to the user view.
[~HUAWEI-aaa] quit
[~HUAWEI] quit
<HUAWEI>
To return from the AAA view directly to the user view, press Ctrl+Z or run the return
command.
# Press Ctrl+Z to return directly to the user view.
[~HUAWEI-aaa] // Enter Ctrl+Z
<HUAWEI>
In two-phase validation mode, you must run the commit command for the configuration to
take effect. However, you do not need to run the commit command in the following cases:
l Query commands (such as display interface) are run.
l Maintenance commands (such as slave switchover, dual-active restore,
stack upgrade fast rollback-timer, stack upgrade fast stack member, switch mode,
and reset keepalive packets count) are run.
l Commands are run to enter the existing views (such as the stack view and physical
interface view) on a physical device. For example, the interface 10ge1/0/1 command is
run.
l The existing configurations on a device are reconfigured.
Immediate Mode
Run: system-view immediately, Enable the immediate mode.
In the immediate mode, the command prompt is as follows:
<HUAWEI> system-view immediately
Enter system view, return user view with return command.
[HUAWEI]
Two-Stage Mode
1. Run: system-view, enable the two-stage mode.
2. (Optional) Run: display configuration candidate [ merge ], display all uncommitted
configurations.
If you specify the merge keyword, the command displays uncommitted configurations
and committed configurations. If you do not specify the merge keyword, the command
displays uncommitted configurations.
You can edit the uncommitted configurations.
3. (Optional) Run: clear configuration candidate, delete all the uncommitted
configurations.
In the two-stage mode, if the user has modified configurations but has not submit the
modification, the system prompt ~ is changed to *, prompting the user that the configurations
are not submitted. After the user runs the commit command to submit the configurations, the
system prompt * is restored to ~.
NOTE
l In both the immediate mode and two-stage mode, the system can lock the configuration of a service
as soon as the service process is initiated, to prevent a service from being affected. When the
configuration is locked, users can query configurations but cannot edit or commit configurations. If
configurations fail to be committed, waiting for 30 seconds and committing configurations again are
recommended. If configurations fail to be committed again, it indicates that the configuration is
locked by a user.
l You can run the configuration exclusive command to lock a configuration. If a configuration is
locked by another user, ask the user to unlock it.
l In two-phase configuration mode, when you perform the same configurations for multiple users,
only the configuration committed first takes effect. For other users, the system prompts a
configuration conflict.
Commands that can be run in the system view support the intelligent backtracking function. If
a command cannot be run in the current view (a non-system and non-user view), the system
automatically backtracks to the system view. If the command can be run in the system view,
the corresponding configuration is directly delivered, reducing command operation steps.
For example, the interface command can be run in the system view. If you are performing
operations in the VLAN view, you can directly run the interface command in the VLAN view
to enter the interface view.
<HUAWEI> system-view
[~HUAWEI] vlan 2
[*HUAWEI-vlan2] interface 10ge 1/0/1
[*HUAWEI-10GE1/0/1]
NOTE
l In some cases, the system automatically disables the intelligent backtracking function to prevent
service deployment from being affected. You need to return to the system view to run commands
that can be run in the system view.
l Intelligent backtracking requires that a command be entered in its complete format, and the
command word cannot be automatically displayed through the question mark help function.
Context
l The system grants users different access permissions based on their roles. User levels are
classified into sixteen levels, which correspond to the command levels. Users can use
only the commands at the same or lower level than their own levels. By default, there are
four command levels 0 to 3 and sixteen user levels 0 to 15. Table 1-2 describes the
relationship between command levels and user levels.
NOTICE
Changing the default command level without the guidance of technical personnel is not
recommended. This may result in inconvenience for operation and maintenance and bring
about security problems.
Procedure
Step 1 Run:
system-view
----End
Table 1-3 lists keys that are frequently used for command editing.
Common key Inserts a character at the current location of the cursor if the
editing buffer is not full, and the cursor moves to the right.
Otherwise, an alarm is generated.
Backspace Deletes the character on the left of the cursor and the cursor
moves to the left. When the cursor reaches the head of the
command, an alarm is generated.
Left cursor key ← or Ctrl Moves the cursor to the left by the space of a character. When
+B the cursor reaches the head of the command, an alarm is
generated.
Right cursor key → or Moves the cursor to the right by the space of a character. When
Ctrl+F the cursor reaches the end of the command, an alarm is
generated.
Operating Techniques
Incomplete Keyword
You can enter incomplete keywords on the device. In the current view, you do not need to
enter complete keywords if the entered characters can match a unique keyword. This function
improves operating efficiency.
For example, to execute the display current-configuration command, you can enter d cu, di
cu, or dis cu, but you cannot enter d c or dis c because they do not match unique keywords.
NOTICE
The maximum length of a command (including the incomplete command) to be entered is
1022 characters. If a command in incomplete form is configured, the system saves the
command to the configuration file in its complete form, which may cause the command to
have more than 1022 characters. In this case, the command in incomplete form cannot be
restored after the system restarts. Therefore, when you configure a command in incomplete
form, pay attention to the length of the command.
Tab
Enter an incomplete keyword and press Tab to complete the keyword.
l When a unique keyword matches the input, the system replaces the incomplete input
with the unique keyword and displays it in a new line with the cursor leaving a space
behind. For example:
a. Enter an incomplete keyword.
[~HUAWEI] info-
b. Press Tab.
The system replaces the entered keyword and displays it in a new line with the
complete keyword followed by a space.
[~HUAWEI] info-center
l When the input has multiple matches, press Tab repeatedly to display the keywords
beginning with the incomplete input in a circle until the desired keyword is displayed. In
this case, the cursor closely follows the end of the keyword. For example:
a. Enter an incomplete keyword.
[~HUAWEI] info-center log
b. Press Tab.
The system displays the prefixes of all the matched keywords. In this example, the
prefix is log.
[~HUAWEI] info-center log-severity
Press Tab to switch from one matched keyword to another. In this case, the cursor
closely follows the end of a word.
[~HUAWEI] info-center logbuffer
[~HUAWEI] info-center logfile
[~HUAWEI] info-center loghost
b. Press Tab.
[~HUAWEI] info-center loglog
The system displays information in a new line, but the keyword loglog remains
unchanged and there is no space between the cursor and the keyword, indicating
that this keyword does not exist.
Full Help
When entering a command, you can use the full help function to obtain keywords and
parameters for the command. Use any of the following methods to obtain full help from a
command line.
l Enter a question mark (?) in any command view to obtain all the commands and their
simple descriptions. For example:
<HUAWEI> ?
Current view commands:
activate Activate locked user
backup Backup information
capture-packet Enable capturing packet
cd Change current directory
clear Clear operation
clock Clock status and configuration information
Partial Help
If you enter only the first or first several characters of a command keyword, partial help
provides keywords that begin with this character or character string. Use any of the following
methods to obtain partial help from a command line.
l Enter a character string followed directly by a question mark (?) to display all keywords
that begin with this character string. For example:
<HUAWEI> d?
debugging delete
dir display
<HUAWEI> d
l Enter a command and a string followed directly by a question mark (?) to display all the
keywords that begin with this string. For example:
<HUAWEI> display b?
bfd bgp
l Enter the first several letters of a keyword in a command and press Tab to display a
complete keyword. The first several letters, however, must uniquely identify the
keyword. If they do not identify a specific keyword, press Tab continuously to display
different keywords and you can select one as required.
NOTE
The command output obtained through the online help function is used for reference only.
Error: Too many parameters found at Too many parameters are entered.
'^' position.
Log out of the terminal and re-log in. A message "Hello, Welcome to Huawei!" is
displayed before authentication. Run the undo header login command.
Hello,Welcome to Huawei!
Password:
Info: The max number of VTY users is 21, and the number of current VTY users
on
line is 2.
The current login time is 2012-06-06 16:31:24.
<HUAWEI> system-view
[~HUAWEI] undo header login
[*HUAWEI] commit
Log out of the terminal and re-log in. No message is displayed before authentication.
Password:
Info: The max number of VTY users is 21, and the number of current VTY users
on
line is 2.
The current login time is 2012-06-06 16:45:06.
<HUAWEI>
NOTE
The command output provided here is used for reference only. The actual output information may differ
from the preceding information.
NOTE
If the value specified in the history-command max-size size-value command is large, it may take a long
time to obtain a required history command. Therefore, a large value is not recommended.
Display the later Down arrow key ↓ or Ctrl+N A later history command is
history command. displayed. If the current
command is the latest
command, no output is
displayed and an alarm is
generated when you attempt
to display the later history
command.
NOTE
You cannot access history commands using the Up arrow key ↑ in HyperTerminal Windows 9X. The
Up arrow key ↑ has a different function in HyperTerminal Windows 9X and needs to be replaced by the
shortcut key Ctrl+P.
NOTE
The terminal in use may affect the functions of the shortcut keys. For example, if the shortcut keys
defined by the terminal conflict with those defined in the system, the shortcut keys entered by the user
are captured by the terminal program and the commands corresponding to the shortcut keys are not
executed.
The system supports four user-defined shortcut keys and the default values are as follows:
l Ctrl+G: display current-configuration
l Ctrl+L: display ip routing-table
l Ctrl+O: undo debugging all
l Ctrl+U: Null
NOTE
l When defining shortcut keys, use double quotation marks to define the command if this command
contains several keywords separated by spaces. For example, hotkey ctrl_l "display tcp status".
Do not use double quotation marks to define a command if the command contains only one
keyword.
l Run the display hotkey command to view the status of the defined, undefined, and system-defined
shortcut keys.
l Run the undo hotkey command to restore default values of the configured shortcut keys.
l Shortcut keys are executed in the same way as commands. The system can record commands in their
original formats in the command buffer and logs to help query and locate the fault.
l The user-defined shortcut keys are available to all users. If a user does not have the rights to use the
command defined by a shortcut key, the system displays an error message when this shortcut key is
executed.
Key Function
Context
The alias command can be used in the following scenarios:
l Configure an easy-to-remember string of characters as the alias for a command. You can
then enter the alias string when you need to run the command. For example, define the
alias for display as show. You can enter the alias show to substitute display.
l Change the order of parameters. For example, after you configure the alias showif
parameter $ifnum $iftype command "display interface $iftype $ifnum" command,
you can enter showif 7 vlanif to substitute display interface vlanif 7.
To enable the command alias function for the current terminal, run the terminal command
alias command. To disable the command alias function for the current terminal, run the undo
terminal command alias command. If you disable the command alias function, configuration
information of command alias is not deleted. Therefore, the configuration information of the
command alias continues taking effect if you enable the command alias function again for the
current terminal. You can run the display terminal command alias command to view
configuration information of command alias.
Procedure
Step 1 Run:
system-view
----End
Follow-up Procedure
l Run the display command alias command to view configuration information of the
command alias.
<HUAWEI> display command alias
show = display
showif $ifnum $iftype = display interface $iftype $ifnum
For example, after all configurations of the FTP service are complete, you can run the display
ftp server command to check parameters of the FTP server. For details on the usage and
functions of the display command, see Checking the Configuration in each feature of the
Configuration Guide.
You can also check the current running configurations and configurations in the current view.
l Check the current running configurations:
display current-configuration
This command does not display parameters that use default settings.
l Check configurations in the current view:
display this
This command does not display parameters that use default settings.
NOTE
l You can run the timestamp enable command to enable the timestamp function in the system so that
the system adds the query time to the output of the display command.
l If the value of a field in the command output is too long, only some beginning characters of the
value are displayed.
l When the display output is more than one page, you can use Pg Up and Pg Dn to display
information on the previous page and the next page.
l When the information cannot be completely displayed on one screen, the system will
pause and you can view the information. You can use the function keys listed in Table
1-7 to control the display mode of command lines.
NOTE
The screen-length screen-length temporary command sets the lines to be displayed temporarily
on the terminal screen. If screen-length is 0, the split screen function is disabled. Therefore, the
system will not pause when the information cannot be completely displayed on one screen.
Display Feature
When the information cannot be completely displayed on one screen, you can adopt the pause
function. You have three choices, as described in Table 1-8.
Regular Expressions
A regular expression is a mode matching tool. It consists of common characters (such as
letters from a to z) and special characters (called meta-characters). The regular expression is a
template according to which you can search for the required string.
A regular expression provides the following functions:
l Searches for and obtains a sub-string that matches a rule in the string.
l Substitutes a string based on a certain matching rule.
The regular expression consists of common characters and special characters.
l Common characters
Common characters are used to match themselves in a string, including all upper-case
and lower-case letters, digits, punctuations, and special symbols. For example, a matches
the letter "a" in "abc", 10 matches the digit "10" in "[Link]", and @ matches the
symbol "@" in "xxx@[Link]".
l Special characters
Special characters are used together with common characters to match the complex or
special string combination. Table 1-9 describes special characters and their syntax.
+ Matches the preceding element one 10+ matches "10", "100", "1000",
or more times. and so on.
(10)+ matches "10", "1010",
"101010", and so on.
[xyz] Matches any single character in the [123] matches the character 2 in
regular expression. "255".
[^xyz] Matches any character that is not in [^123] matches any character
the regular expression. except for "1", "2", and "3".
[a-z] Matches any character within the [0-9] matches any character
specified range. ranging from 0 to 9.
[^a-z] Matches any character beyond the [^0-9] matches all non-numeric
specified range. characters.
NOTE
Unless otherwise specified, all the characters in the preceding table must be printable characters.
l Degeneration of special characters
Certain special characters, when placed at certain positions in a regular expression,
degenerate to common characters.
– The special characters following "\" match special characters themselves.
– The special characters "*", and "+" are placed at the starting position of the regular
expression. For example, +45 matches "+45" and abc(*def) matches "abc*def".
– The special character "^" is placed at any position except for the start of the regular
expression. For example, abc^ matches "abc^".
– The special character "$" is placed at any position except for the end of the regular
expression. For example, 12$2 matches "12$2".
– A right parenthesis ")" or right bracket "]" is not paired with a corresponding left
parenthesis "(" or bracket "[". For example, abc) matches "abc)" and 0-9] matches
"0-9]".
NOTE
Unless otherwise specified, degeneration rules also apply when the preceding regular expressions
are subexpressions within parentheses.
When filtering conditions are set to query output information, the first line of the command output starts
with the entire regular expression but not the string to be filtered.
The system allows you to use | count to display the number of lines, | section to display the
command output by section after using filtering mode, | ignore-case to match a string of case-
insensitive characters, and | no-more to display filtered output information on only one
screen. | count, | section, | ignore-case, and | no-more can work together with the following
filtering modes.
Three filtering modes are provided for commands that support regular expressions.
l | begin regular-expression: displays all the lines beginning with the line that matches the
regular expression.
Filter the character strings to be entered until the specified case-sensitive character string
is displayed. All the character strings following this specified character string are
displayed on the screen.
l | exclude regular-expression: displays all the lines that do not match the regular
expression.
If the character strings to be entered do not contain the specified case-sensitive character
string, they are displayed on the screen. Otherwise, they are filtered.
l | include regular-expression: displays all the lines that match the regular expression.
If the character strings to be entered contain the specified case-sensitive character string,
they are displayed on the screen. Otherwise, they are filtered.
NOTE
Example 2: Run the display current-configuration command to display all the lines that
match the regular expression vlan.
<HUAWEI> display current-configuration | include vlan
vlan batch 2 9 to 20 77 99 200 222 4091
vlan 19
mux-vlan
vlan 222
aggregate-vlan
access-vlan 1
instance 2 vlan 2
carrier-vlan 100
ce-vlan 10
port trunk allow-pass vlan 99 200
igmp-snooping static-router-port vlan 99
port trunk allow-pass vlan 20
port default vlan 77
port trunk allow-pass vlan 20
Example 3: Run the display current-configuration command to display the number of lines
that match the regular expression vlan.
<HUAWEI> display current-configuration | include vlan | count
Total lines: 14.
NOTE
The device can redirect the output of a display command to a specified file in either of the
following modes:
l > filename
The output is redirected to a specified file. If the file already exists, the content of the file
is overwritten.
l >> filename
The output is appended to a specified file, with the original content of the file remaining
unchanged.
2 ZTP Configuration
This chapter describes how to configure Zero Touch Provisioning (ZTP) to allow automatic
deployment of unconfigured devices after power-on.
2.1 Introduction to ZTP
2.2 Principles
2.3 Configuration Notes
2.4 Default Configuration
2.5 Configuring an Unconfigured Device to Implement Automatic Deployment Using a USB
Flash Drive
2.6 Configuring an Unconfigured Device to Implement Automatic Deployment Through
DHCP
2.7 Configuration Examples
Definition
Zero Touch Provisioning (ZTP) allows newly delivered or unconfigured devices to
automatically load version files, including system software, license files, user-defined files,
configuration files, and patch files, after they start.
Purpose
After devices are installed, administrators have to commission the software onsite. If a large
number of devices are sparsely distributed on a network, manually configuring these device
lowers device deployment efficiency and increases labor costs.
Devices running ZTP can automatically obtain and load version files from a USB flash drive
or file server, freeing the administrators from onsite configuration or deployment. ZTP
reduces labor costs and increases device deployment efficiency.
Related Documents
Video: CloudEngine Series Switches ZTP Introduction
2.2 Principles
2.2.1 Implementation
l DHCP server: assigns a temporary management IP address, the default gateway, the IP
addresses of the DNS server and the intermediate file server to the device running ZTP.
l DHCP relay agent: relays packets exchanged between the device and DHCP server
located on different network segments.
l Intermediate file server: stores the intermediate file required by the device running
ZTP. The intermediate file can be an .ini file or a Python script. By parsing the
intermediate file, the device can obtain information about the version files and the IP
address of the version file server. An intermediate file server can be a TFTP, an FTP,
SFTP, or HTTP server.
l Version file server: stores the version files to be loaded to unconfigured devices,
including system software, configuration files, and patch files. The version file server
and the intermediate file server can be deployed on the same server, which can be a
TFTP, an FTP, SFTP, or HTTP server.
l DNS server: provides mappings between the domain names and IP addresses, and
resolves the IP address of the file server for the device running ZTP. Based on the
resolved IP address, the device can download the requested files.
NOTE
The TFTP/FTP/HTTP protocol will bring risk to device security. The SFTP mode is recommended.
ZTP Process
Figure 2-2 shows the ZTP flowchart.
Startup
Yes No
configuration file
exists?
The device stops ZTP
Yes
process and starts with Abort ZTP process?
the configuration file. The device stops ZTP
process and starts with No
zero configuration. A USB
Containing the
No intermediate
file is found?
The device obtains a temporary Yes
IP address and intermediate file The device obtains the
server address through DHCP. intermediate file from the
USB.
The device obtains an
intermediate file from the No Version files
intermediate file server and information Is
parses the file. obtained?
Yes
The device obtains version files The device obtains version
form the file server. files from the USB flash
drive.
ZTP process is
complete.
any of the following conditions occur: no USB flash drive is installed; the USB flash
drive contains an incorrect intermediate file; the device fails to obtain the version files.
3. The device obtains DHCP information.
If the device fails to implement automatic deployment using the USB flash drive, it starts
automatic deployment through DHCP. In DHCP mode, the device broadcasts DHCP
Request packets on ports in the following sequence: management port -> high-bandwidth
Ethernet port -> low-bandwidth Ethernet port. After receiving the DHCP Request packet,
the DHCP server sends a DHCP Reply packet to the device. Options in the packet
contain the requested information, including the IP address of the device, default
gateway, IP address of the intermediate file server, and name of the intermediate file.
4. The device obtains the intermediate file and version files.
According to the information carried in the DHCP Reply packet, the device obtains the
intermediate file and then downloads the version files from the version file server.
If the intermediate file is an .ini file, the device downloads the version files based on the
IP address and version file names contained in the intermediate file. If the intermediate
file is a Python script, the device automatically runs the script to download the version
files.
5. The device restarts.
The device automatically sets the version files downloaded from the server as the next
startup files. Then the device restarts, and automatic deployment is complete.
An .ini file can be used as an intermediate file to store device and version file information.
The .ini file has the name extension .ini. The file format is as follows:
NOTE
l If the device implements automatic deployment using a USB flash drive, the name of the .ini file must be
ztp_config.ini. If the device implements automatic deployment through DHCP, a user-defined file name
can be used.
l The configured user name, password, and version file name in the intermediate file cannot contain special
characters, including &, >, <, ", ', /, #.
;BEGIN DC
[GLOBAL CONFIG]
FILESERVER=[Link]
[DEVICEn DESCRIPTION]
ESN=210235527210D4000028
MAC=e468-a356-0cb0
DEVICETYPE=DEFAULT
SYSTEM-SOFTWARE=[Link]
SYSTEM-CONFIG=[Link]
SYSTEM-PAT=[Link]
;END DC
NOTE
l If the device implements automatic deployment using a USB flash drive, the name of the Python script
must be ztp_script.py. If the device implements automatic deployment through DHCP, a user-defined file
name can be used.
l The configured user name, password, and version file name in the intermediate file cannot contain special
characters, including &, >, <, ", ', /, #.
An example of a script file is as follows. You can modify the script file according to deployment
requirements.
#md5sum="96c89e148a8a4055cf3e9922379ae898"
#!/usr/bin/env python
#
# Copyright (C) Huawei Technologies Co., Ltd. 2008-2013. All rights reserved.
#
----------------------------------------------------------------------------------
------------------------------------
# History:
# Date Author Modification
# 20130629 Author created file.
#
----------------------------------------------------------------------------------
------------------------------------
"""
Zero Touch Provisioning (ZTP) enables devices to automatically load version files
including system software,
patch files, configuration files when the device starts up, the devices to be
configured must be new devices
or have no configuration files.
This is a sample of Zero Touch Provisioning user script. You can customize it to
meet the requirements of
your network environment.
"""
import httplib
import urllib
import string
import re
import [Link] as etree
import os
import stat
import logging
import traceback
import hashlib
# error code
OK = 0
ERR = 1
# File server in which stores the necessary system software, configuration and
patch files:
# 1) Specify the file server which supports the following format.
# t[Link]
# [Link]
# s[Link]
# [Link]
# 2) Do not add a trailing slash at the end of file server path.
FILE_SERVER = '[Link]
class OPSConnection(object):
"""Make an OPS connection instance."""
def close(self):
"""Close the connection"""
[Link]()
class OPIExecError(Exception):
"""OPI executes error."""
pass
class ZTPErr(Exception):
"""ZTP error."""
pass
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
elem = root_elem.find(uri + "ipv4Addr", namespaces)
if elem is None:
raise OPIExecError('Failed to get IP address by host name')
return [Link]
url_tuple = urlparse(url)
if not [Link](r"\d+\.\d+\.\d+\.\d+", url_tuple.hostname):
netloc = get_addr_by_hostname(ops_conn, url_tuple.hostname)
if url_tuple.port:
netloc += ':' + str(url_tuple.port)
url = urlunparse((url_tuple.scheme, netloc, url_tuple.path,
url_tuple.params, url_tuple.query,
url_tuple.fragment))
ret = OK
opener = [Link]()
try:
dst_file_path = "%s/%s" % ([Link](), [Link](url))
dst_file_path = [Link](dst_file_path)
[Link]('HTTP download destination file=%s.', dst_file_path)
[Link](url, dst_file_path)
[Link](dst_file_path, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP |
stat.S_IROTH | stat.S_IXOTH)
except (KeyboardInterrupt, Exception), reason:
if [Link](dst_file_path):
[Link](dst_file_path) # Remove incomplete file
[Link](reason)
print('Error: Failed to download file "%s" using HTTP' %
[Link](url))
ret = ERR
return ret
return OK
_del_rsa_peer_key(ops_conn, server_name)
return OK
ret = ERR
else:
ret = OK
_del_sshc_rsa_key(ops_conn, server_ip)
_set_sshc_first_time(ops_conn, 'Disable')
return ret
return OK
t[Link]
[Link]
s[Link]
[Link]
Args:
ops_conn: OPS connection instance
url: URL of remote file
local_path: local path to put the file
Returns:
A integer of return code
"""
url_tuple = urlparse(url)
print("Info: Download %s to %s" % (url_tuple.path[1:], local_path))
func_dict = {'tftp': _tftp_download_file,
'ftp': _ftp_download_file,
'sftp': _sftp_download_file,
'http': _http_download_file,
'file': _usb_download_file}
scheme = url_tuple.scheme
if scheme not in func_dict.keys():
raise ZTPErr('Unknown file transfer scheme %s' % scheme)
ret = OK
cnt = 0
while (cnt < 1 + retry_times):
if cnt:
print('Retry downloading...')
[Link]('Retry downloading...')
ret = func_dict[scheme](ops_conn, url, local_path)
if ret is OK:
break
cnt += 1
return OK
class StartupInfo(object):
"""Startup configuration information
class Startup(object):
"""Startup configuration information
def _get_startup_info(self):
"""Get the startup information."""
[Link]("Get the startup information...")
uri = "/cfg/startupInfos/startupInfo"
req_data = '''<?xml version="1.0" encoding="UTF-8"?>
<startupInfo>
<position/>
<configedSysSoft/>
<curSysSoft/>
<nextSysSoft/>
<curStartupFile/>
<nextStartupFile/>
<curPatchFile/>
<nextPatchFile/>
</startupInfo>'''
cnt = 0
while (cnt < MAX_TIMES_GET_STARTUP):
ret, _, rsp_data = self.ops_conn.get(uri, req_data)
if ret != [Link] or rsp_data is '':
cnt += 1
[Link]('Failed to get the startup information')
continue
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
mpath = 'data' + [Link]('/', '/vrp:') # match path
nslen = len(namespaces['vrp'])
elem = root_elem.find(mpath, namespaces)
if elem is not None:
break
[Link]('No query result while getting startup info')
sleep(GET_STARTUP_INTERVAL) # sleep to wait for system ready when
no query result
cnt += 1
if elem is None:
raise OPIExecError('Failed to get the startup information')
def _del_startup_config_file(self):
"""Delete startup config file"""
[Link]("Delete the next startup config file...")
uri = "/cfg/clearStartup"
req_data = '''<?xml version="1.0" encoding="UTF-8"?>
<clearStartup>
</clearStartup>
'''
# it is a action operation, so use create for HTTP POST
ret, _, _ = self.ops_conn.create(uri, req_data)
if ret != [Link]:
raise OPIExecError("Failed to delete startup configuration file")
def _get_cur_stack_member_id(self):
"""rest api: Get current stack member id"""
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
elem = root_elem.find(uri + "memberID", namespaces)
if elem is None:
raise OPIExecError('Failed to get the current stack member id for no
"memberID" element')
return [Link]
"""
# fname must exist, guaranteed by caller
fname = [Link](fname)
with open(fname, 'rb') as item:
for line in item:
token = [Link]('[\r\n]')
token = [Link]()
if token[0] == esn:
return token[2]
return None
cur_memid = self._get_cur_stack_member_id()
next_memid = get_stackid_from_file(file_path, esn)
if not next_memid:
[Link]('Failed to get stack id from %s, esn %s', file_path,
esn)
return
return OK
def _reset_stack_member_id(self):
"""rest api: reset stack member id"""
return OK
def _reset_startup_patch_file(self):
"""Rest patch file for system to startup"""
[Link]("Reset the next startup patch file...")
uri = "/patch/resetpatch"
req_data = '''<?xml version="1.0" encoding="UTF-8"?>
<resetpatch>
</resetpatch>
'''
# it is a action operation, so use create for HTTP POST
ret, _, _ = self.ops_conn.create(uri, req_data)
if ret != [Link]:
raise OPIExecError('Failed to reset patch')
def get_cwd(ops_conn):
"""Get the full filename of the current working directory"""
[Link]("Get the current working directory...")
uri = "/vfm/pwds/pwd"
req_data = \
'''<?xml version="1.0" encoding="UTF-8"?>
<pwd>
<dictionaryName/>
</pwd>
'''
ret, _, rsp_data = ops_conn.get(uri, req_data)
if ret != [Link] or rsp_data is '':
raise OPIExecError('Failed to get the current working directory')
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
elem = root_elem.find(uri + "dictionaryName", namespaces)
if elem is None:
raise OPIExecError('Failed to get the current working directory for no
"directoryName" element')
return [Link]
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
elem = root_elem.find(uri + "fileName", namespaces)
if elem is None:
return False
return True
def has_slave_mpu(ops_conn):
"""Whether device has slave MPU, returns a bool value"""
[Link]("Test whether device has slave MPU...")
uri = "/devm/phyEntitys"
req_data = \
'''<?xml version="1.0" encoding="UTF-8"?>
<phyEntitys>
<phyEntity>
<entClass>mpuModule</entClass>
<entStandbyState/>
<position/>
</phyEntity>
</phyEntitys>
'''
ret, _, rsp_data = ops_conn.get(uri, req_data)
if ret != [Link] or rsp_data is '':
raise OPIExecError('Failed to get the device slave information')
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
return False
def get_system_info(ops_conn):
"""Get system info, returns a dict"""
[Link]("Get the system information...")
uri = "/system/systemInfo"
req_data = \
'''<?xml version="1.0" encoding="UTF-8"?>
<systemInfo>
<productName/>
<esn/>
<mac/>
</systemInfo>
'''
ret, _, rsp_data = ops_conn.get(uri, req_data)
if ret != [Link] or rsp_data is '':
raise OPIExecError('Failed to get the system information')
return sys_info
return True
def read_chunks(fhdl):
'''read chunks'''
chunk = [Link](8096)
while chunk:
yield chunk
chunk = [Link](8096)
else:
[Link](0)
md5_obj = hashlib.md5()
if isinstance(fname, basestring) and [Link](fname):
with open(fname, "rb") as fhdl:
#skip the first line
[Link](0)
if need_skip_first_line:
[Link]()
for chunk in read_chunks(fhdl):
md5_obj.update(chunk)
elif fname.__class__.__name__ in ["StringIO", "StringO"] or isinstance(fname,
file):
for chunk in read_chunks(fname):
md5_obj.update(chunk)
else:
pass
return md5_obj.hexdigest()
def md5_get_from_file(fname):
"""Get md5 num form file, stored in first line"""
return line_first[9:41]
def md5_check_with_first_line(fname):
"""Validate md5 for this file"""
fname = [Link](fname)
md5_calc = md5sum(fname, True)
md5_file = md5_get_from_file(fname)
if md5_file.lower() != md5_calc:
[Link]('MD5 check failed, file %s', fname)
print('MD5 checksum of the file "%s" is %s' % (fname, md5_calc))
[Link]('MD5 checksum of the file "%s" is %s', fname, md5_calc)
return True
return False
def parse_md5_file(fname):
"""parse md5 file"""
def read_line(fhdl):
"""read a line by loop"""
line = [Link]()
while line:
yield line
line = [Link]()
else:
[Link](0)
md5_dic = {}
with open(fname, "rb") as fhdl:
for line in read_line(fhdl):
line_spilt = [Link]()
if 2 != len(line_spilt):
continue
dic_tmp = {line_spilt[0]: line_spilt[1]}
md5_dic.update(dic_tmp)
return md5_dic
def verify_and_parse_md5_file(fname):
"""
vefiry data integrity of md5 file and parse this file
file-name md5
conf_5618642831132.cfg c0ace0f0542950beaacb39cd1c3b5716
------------------------------------------------------------------
"""
if not md5_check_with_first_line(fname):
return ERR, None
return OK, parse_md5_file(fname)
def check_parameter(aset):
seq = ['&', '>', '<', '"', "'"]
if aset:
for c in seq:
if c in aset:
return True
return False
def check_filename(ops_conn):
sys_info = get_system_info(ops_conn)
url_tuple = urlparse(FILE_SERVER)
if check_parameter(url_tuple.username) or check_parameter(url_tuple.password):
raise ZTPErr('Invalid username or password, the name should not contain:
'+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_IMAGE.get(sys_info['productName'],
''))
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of system software, the name should not
contain: '+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_CONFIG)
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of configuration file, the name should not
contain: '+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_PATCH.get(sys_info['productName'],
''))
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of patch file, the name should not contain:
'+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_MEMID)
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of member ID file, the name should not
contain: '+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_MD5)
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of md5 file, the name should not contain:
'+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_LICLIST)
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of license list file, the name should not
contain: '+'&'+' >'+' <'+' "'+" '.")
return OK
def main_proc(ops_conn):
"""Main processing"""
sys_info = get_system_info(ops_conn) # Get system info, such as esn and
system mac
cwd = get_cwd(ops_conn) # Get the current working directory
startup = Startup(ops_conn)
slave = has_slave_mpu(ops_conn) # Check whether slave MPU board
exists or not
chg_flag = False
check_filename(ops_conn)
# download md5 file first, used to verify data integrity of files which will
be downloaded next
local_path_md5 = None
file_path = REMOTE_PATH_MD5
if not file_path.startswith('/'):
file_path = '/' + file_path
file_name = [Link](file_path)
if file_name is not '':
url = FILE_SERVER + file_path
local_path_md5 = cwd + file_name
ret = download_file(ops_conn, url, local_path_md5,
MAX_TIMES_RETRY_DOWNLOAD)
if ret is ERR or not file_exist(ops_conn, file_name):
print('Error: Failed to download MD5 file "%s"' % file_name)
return ERR
print('Info: Download MD5 file successfully')
ret, md5_dic = verify_and_parse_md5_file(file_name)
# delete the file immediately
del_file_all(ops_conn, local_path_md5, None)
if ret is ERR:
print('Error: MD5 check failed, file "%s"' % file_name)
return ERR
else:
md5_dic = {}
#execute license list file to get license file name which end with .dat
license_name = None
if local_path_liclist is not None:
tree = [Link](file_name)
root = [Link]()
for child in [Link]('Lic'):
name = [Link]('name')
esn = [Link]('Esn').text
if sys_info['esn'] in esn:
license_name = name
print('Info: License file name is "%s"' % license_name)
break
if license_name == None :
print('Error: Esn of this device is not in the license list file')
del_file_all(ops_conn, local_path_config, slave)
del_file_all(ops_conn, local_path_patch, slave)
del_file_all(ops_conn, local_path_memid, slave)
del_file_all(ops_conn, local_path_image, slave)
del_file_all(ops_conn, local_path_liclist, slave)
return ERR
if chg_flag is False:
return ERR
# delete stack member ID file and license list file after used
del_file_all(ops_conn, local_path_memid, None)
del_file_all(ops_conn, local_path_liclist, None)
return OK
Args:
Raises:
Returns: user script processing result
"""
host = "localhost"
if usb_path and len(usb_path):
[Link]('ztp_script usb_path: %s', usb_path)
global FILE_SERVER
FILE_SERVER = '[Link] + usb_path
try:
# Make an OPS connection instance.
ops_conn = OPSConnection(host)
ret = main_proc(ops_conn)
finally:
# Close the OPS connection
ops_conn.close()
return ret
if __name__ == "__main__":
main()
You can use the MD5 code to check the integrity of the script downloaded by the device.
You can use an MD5 calculation tool, such as md5sum, to generate the MD5 code of the
script.
NOTE
The script cannot contain #md5sum= when the MD5 code is generated. Add #md5sum= to the
beginning of the script after the MD5 code is generated.
l Specifies the path where version files can be obtained.
FILE_SERVER = '[Link]
You can obtain version files from a TFTP, an FTP, SFTP, or HTTP server. Based on the
server used, the path can be any of the following:
– t[Link]
– [Link]
– s[Link]
– [Link]
The parameters username, password, and port are optional.
NOTE
If the device uses a USB flash drive for automatic deployment, set this field to ''.
The TFTP/FTP/HTTP protocol will bring risk to device security. The SFTP mode is recommended.
l Specifies the path and name of the system software.
REMOTE_PATH_IMAGE = {
'CE5850EI' : '/image/[Link]',
'CE6850EI' : '/image/[Link]',
'CE12800' : '/image/[Link]',
}
CE5850EI indicates the device model in the CE**** + EI/HI/LI format, for example
CE5850EI and CE6850EI. The value cannot be CE5850 or CE5850-48T4S2Q-EI.
/image/[Link] specifies the path and name of the system software
obtained by CE5850.
If the device does not need to load the system software, set this field to a double
quotation mark (").
REMOTE_PATH_IMAGE = {
'CE5850EI' : '',
'CE6850EI' : '',
'CE12800' : '',
}
%s indicates a device serial number or MAC address, based on which you can obtain a
configuration file.
– If %s indicates a device serial number, the following part in the def main_proc()
function must be set to esn.
# download configuration file
local_path_config = None
file_path = REMOTE_PATH_CONFIG % sys_info['esn']
– If %s indicates a device MAC address, the following part in the def main_proc()
function must be set to mac.
NOTE
l The serial number or MAC address in the file name must be uppercase.
l If %s indicates a device MAC address, the MAC address in the file name must be 1 plus the device
system MAC address. For example, if the device system MAC address is E468-A356-0DD0, the
file name must be conf_E468-[Link].
l Specifies the path and name of the patch file.
REMOTE_PATH_PATCH = ' 'CE5850EI' : '/patch/CE5850EI-
[Link]',
'CE6850EI' : '/patch/[Link]',
'CE12800' : '/patch/[Link]',
'
You can use a license list file to enable switches to automatically install licenses.
2.2.6 Installing Licenses in a Batch shows the license list file format.
If the switch does not need to load a license, set this field to a double quotation mark (").
l Specifies the path and name of the MD5 code file.
REMOTE_PATH_MD5 = '/[Link]'
You can use the MD5 code file to check the integrity of the files downloaded by the
device.
See 2.2.5 Checking the Integrity of Version Files for the format of the MD5 code file.
If the downloaded files do not need to be checked, set this field to ''.
l Specifies the path and name of the user-defined file.
REMOTE_PATH_PYTHON = '/get_systeminfo.py'
This field specifies the path and name of the user-defined file to be downloaded.
l Defines the interval for collecting device startup information.
GET_STARTUP_INTERVAL = 15
This field defines the interval for collecting device startup information.
l Defines the maximum number of times that device startup information is retransmitted.
MAX_TIMES_GET_STARTUP = 120
This field defines the maximum number of device startup information retransmissions.
l Defines the number of retries to download files.
MAX_TIMES_RETRY_DOWNLOAD = 3
def _del_rsa_peer_key()
If files fail to be loaded, they are deleted so that the device can restore to the state before
ZTP starts. This facilitates subsequent operations.
You do not need to edit this field.
l Copies a file.
def copy_file()
You can use an MD5 code file to check the integrity of the files downloaded by the device.
The MD5 code of a file to be downloaded is saved in the MD5 code file in advance. After the
device downloads the file, it generates an MD5 code and then compares the generated MD5
code with that saved in the MD5 code file. If the generated MD5 code is different from that
saved in the MD5 code file, the device does not load the file.
The MD5 code file must be a text file, with the name extension .txt. The format is as follows:
#md5sum="540102b82d5ff5aee70deccc9236e3bb"
file-name md5
conf_5618642831132.cfg c0ace0f0542950beaacb39cd1c3b5716
You can use a license list file to enable switches to automatically install licenses. Information
about the licenses to be installed on switches is saved in the license list file in advance. After a
switch downloads the license list file, it downloads and installs the required license file based
on its ESN.
The license list file must be in XML format and uses the file name extension .xml. The format
is as follows:
<?xml version="1.0" encoding="utf-8"?>
<Index>
<Lic name="CloudEngine8800V200R002_20161221144427703.dat">
<Esn>2102350KGU10G6000025</Esn>
</Lic>
<Lic name="CloudEngine8800V200R002_20161221144440793.dat">
<Esn>2102350KGU10G6000026,2102350KGU10G6000027</Esn>
</Lic>
</Index>
NOTE
You can use the [Link] file in the .zip package obtained when downloading license files as the license list
file or edit an license list file according to format requirements. The license list file name can be customized.
License Support
ZTP is a basic feature of a switch and is not under license control.
Version Support
CE8850EI V200R002C50
CE7855EI V200R001C00
CE6810-48S4Q-LI/ V100R003C10
CE6810-48S-LI
CE6810-32T16S4Q-LI/ V100R005C10
CE6810-24S2Q-LI
CE6850EI V100R003C00
CE6850-48S6Q-HI V100R005C00
CE6850-48T6Q-HI/ V100R005C10
CE6850UHI
CE6851HI V100R005C10
CE6855HI V200R001C00
CE6860EI V200R002C50
CE6870EI V200R002C50
CE6880EI V200R002C50
CE5850EI V100R003C00
CE5850HI V100R003C00
CE5855EI V100R005C10
l It is recommended that you deploy ZTP using SFTP because TFTP, FTP, and HTTP have
security risks.
Configuration Process
The following configuration tasks are mandatory and must be performed in sequence.
Background
To enable an unconfigured device to automatically start the ZTP process, the ZTP function
must be enabled on the device. The ZTP function is enabled on devices by default.
Procedure
Step 1 (Optional) Run the display system ztp command to check whether the device starts the ZTP
process at the next startup without configuration.
Step 2 Run the set ztp enable command to enable the ZTP function.
To disable an unconfigured device from starting the ZTP process, run the set ztp disable
command on the device.
----End
NOTE
l If an .ini file is used as the intermediate file, the file name must be ztp_config.ini. If a Python script is
used as the intermediate file, the file name must be ztp_script.py.
l If unconfigured devices are required to set up a stack after they complete automatic deployment, use the
Python script as the intermediate file. The .ini file does not support stack setup.
Procedure
Step 1 Edit the intermediate file according to the file type and format.
Step 2 (Optional) Edit the stack member ID file for stack setup and the MD5 code file for file
verification. See 2.2.4 Automatic Stacking in ZTP and 2.2.5 Checking the Integrity of
Version Files for formats of the two files.
Step 3 Save the intermediate file and version files. If the stack member ID file or MD5 check file
exists, you also need to save the file to the USB flash drive.
The intermediate file must be saved to the root directory of the USB flash drive. The stack
member ID file, MD5 code file, and version files are saved to the directory specified in the
intermediate file.
----End
Context
After saving the required files to the USB flash drive, connect it to an unconfigured device
and power on the device. The device then automatically downloads version files and restarts
to complete automatic deployment.
Procedure
Step 1 Connect the USB flash drive to the unconfigured device.
Step 2 Power on the device.
----End
Procedure
Step 1 The device completes the ZTP process 15 minutes after it is powered on. Then you can log in
and run the display startup command to check whether the startup files are the required ones.
Step 2 If automatic deployment fails, analyze ZTP logs on the device to find out the causes.
ZTP logs are saved to the file named ztp_YYYYMMHHMMSS.log in the directory flash:/.
----End
Configuration Process
The configuration tasks 2.6.2 Editing an Intermediate File, 2.6.3 Configuring the DHCP
Server or DHCP Relay Agent, and 2.6.4 Configuring the File Server are mandatory and
can be performed in any sequence. After completing the preceding configuration tasks, power
on the device, and the device starts the ZTP process.
Background
To enable an unconfigured device to automatically start the ZTP process, the ZTP function
must be enabled on the device. The ZTP function is enabled on devices by default.
Procedure
Step 1 (Optional) Run the display system ztp command to check whether the device starts the ZTP
process at the next startup without configuration.
Step 2 Run the set ztp enable command to enable the ZTP function.
By default, the ZTP function is enabled on devices.
To disable an unconfigured device from starting the ZTP process, run the set ztp disable
command on the device.
----End
Background
An intermediate file can be an .ini file or a Python script. You can choose a file type as
required. See 2.2.2 Intermediate File in INI Format and 2.2.3 Intermediate File in Python
Format for the file formats.
NOTE
If unconfigured devices are required to set up a stack after they complete automatic deployment, use the
Python script as the intermediate file. The .ini file does not support stack setup.
Procedure
Step 1 Edit the intermediate file according to the file type and format.
Step 2 (Optional) Edit the stack member ID file for stack setup and the MD5 code file for file
verification. See 2.2.4 Automatic Stacking in ZTP and 2.2.5 Checking the Integrity of
Version Files for formats of the two files.
----End
Context
Before powering on an unconfigured device, deploy a DHCP server from which the
unconfigured device can obtain the IP address, gateway address, intermediate file server
address, and intermediate file name.
The device sends to the DHCP server a DHCP discover packet that carries DHCP Option 60
and Option 61. Option 60 (Vendor class identifier) records the device manufacturer and
model, and Option 61 (Client-identifier) records the device ESN and MAC address.
Table 2-7 describes options that need to be configured on the DHCP server.
NOTE
The DHCP client must apply for an IP address lease longer than 1 hour.
In following procedures, DHCP server and relay agent are CloudEngine switches. If a device
of a different type serves as the DHCP server or relay agent, see the documentation of the
corresponding product for configuration details.
Procedure
Step 1 Perform the following steps on the DHCP server:
1. Run the system-view command to enter the system view.
2. Run the dhcp enable command to enable DHCP.
3. Run the ip pool ip-pool-name command to create a global address pool and enter its
view.
4. Run the gateway-list ip-address &<1-8> command to set a gateway address for DHCP
clients.
5. Run the network ip-address [ mask { mask | mask-length } ] command to specify the
range of IP addresses allocated to DHCP clients.
6. Run the option code [ sub-option sub-code ] { ascii ascii-string | hex hex-string | cipher
cipher-string | ip-address ip-address &<1-8> } command to configure DHCP option 66,
67 or 150. See Table 2-7 for DHCP options to be configured.
NOTE
When the password is contained in option, the ascii or hex type is insecure. Set the option type to
cipher. A secure password should contain at least two types of the following: lowercase letters,
uppercase letters, number, and special characters. In addition, the password must consist of six or more
than six characters.
7. Run the commit command to commit the configuration.
Step 2 (Optional) Perform the following steps on the DHCP relay agent:
If the unconfigured device and DHCP server are in different network segments, configure a
DHCP relay agent to forward DHCP packets exchanged between them.
1. Run the system-view command to enter the system view.
2. Run the dhcp enable command to enable DHCP.
3. Run the interface interface-type interface-number command to enter the interface view.
4. On an Ethernet interface, run:
undo portswitch
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system
view to switch these interfaces to Layer 3 mode in batches.
5. Run the ip address ip-address { mask | mask-length } command to configure an IP
address for the interface.
6. Run the dhcp select relay command to enable the DHCP relay function.
7. Run the dhcp relay binding server ip ip-address command to specify the DHCP server
IP address on the DHCP relay agent.
8. Run the commit command to commit the configuration.
----End
Context
A file server saves the files to be downloaded to unconfigured devices, including the
intermediate file and version files. You can use a switch as the file server. A file server must
have sufficient space to save files. Before configuring a switch as a file server, ensure that its
storage space is sufficient for the files. Usually, a third-party server is deployed on the ZTP
network to serve as the file server. For the configuration procedure, see the manual of the
third-party server.
The version file server and the intermediate file server can be deployed on the same server. A
file server can be a TFTP, an FTP, SFTP, or HTTP server. The HTTP server supports
concurrent access of multiple users.
NOTE
The file server and unconfigured devices must have reachable routes to each other.
Follow-up Procedure
After configuring the file server, save the intermediate file and version files to the working
directory of the file server. If the stack member ID file or MD5 check file exists, you also
need to save the file to the file server.
NOTE
To ensure security of the file server, configure a unique user name for the file server and assign read-
only permission to the user to prevent unauthorized modification to the files. After the ZTP process is
complete, disable the file server function.
Context
After completing the preceding configuration, power on the unconfigured device. The device
then automatically downloads version files and restarts to complete automatic deployment.
Procedure
Step 1 Power on the device.
----End
Procedure
Step 1 The device completes the ZTP process 15 minutes after it is powered on. Then you can log in
and run the display startup command to check whether the startup files are the required ones.
Step 2 Run the display system ztp command to check whether the device completes deployment
through ZTP.
Step 3 If automatic deployment fails, analyze ZTP logs on the device to find out the causes.
ZTP logs are saved to the file named ztp_YYYYMMHHMMSS.log in the directory flash:/.
----End
Networking Requirements
A new network needs to be deployed. SwitchA and SwitchB are two unconfigured devices.
The customer requires that SwitchA and SwitchB automatically load system software and
configuration files after they are powered on to reduce labor costs and device deployment
time.
Table 2-8 lists information about SwitchA and SwitchB, and the files that the switches need
to load.
Configuration Roadmap
The configuration roadmap is as follows:
1. Edit the intermediate file ztp_config.ini to enable the switches to obtain their system
software packages and configuration files according to the intermediate file.
2. Save the intermediate file and version files to the USB flash drive so that the switches
can implement automatic deployment using the USB flash drive.
3. Install the USB flash drive and power on the switches to start the ZTP process.
Procedure
Step 1 Edit the intermediate file.
Edit the intermediate file according to 2.2.2 Intermediate File in INI Format. The file is
named ztp_config.ini and has the following format:
;BEGIN DC
[GLOBAL CONFIG]
FILESERVER=file:/usb:/
[DEVICE0 DESCRIPTION]
ESN=210235527210D4000028
DEVICETYPE=CE5850EI
SYSTEM-SOFTWARE=[Link]
SYSTEM-CONFIG=conf_210235527210D4000028.cfg
[DEVICE1 DESCRIPTION]
ESN=210235527210D4000046
DEVICETYPE=CE5850EI
SYSTEM-SOFTWARE=[Link]
SYSTEM-CONFIG=conf_210235527210D4000046.cfg
;END DC
Step 2 Save the intermediate file and version files to the root directory of the USB flash drive.
Step 3 Connect the USB flash drive to SwitchA and power on SwitchA.
Step 4 Verify the configuration.
# The switch completes the ZTP process 15 minutes after it is powered on. Log in to the
switch and run the display startup command to check whether the current system software
and configuration file are the required ones.
<SwitchA> display startup
MainBoard:
Configured startup system software: flash:/[Link]
Startup system software: flash:/[Link]
Next startup system software: flash:/[Link]
Startup saved-configuration file: flash:/conf_210235527210D4000028.cfg
Next startup saved-configuration file: flash:/conf_210235527210D4000028.cfg
Startup paf file: default
Next startup paf file: default
Startup patch package: NULL
Next startup patch package: NULL
Step 5 After SwitchA completes automatic deployment, remove the USB flash drive and connect the
USB flash drive to SwitchB. Then power on SwitchB to start automatic deployment.
----End
Networking Requirements
As shown in Figure 2-3, SwitchA and SwitchB are two unconfigured switches on the
network, and both are connected to SwitchC. SwitchC functions as the egress gateway of
SwitchA and SwitchB. The routes between SwitchC and the DHCP server, and between
SwitchC and the file server are reachable.
The customer requires that SwitchA and SwitchB automatically load system software and
configuration files after they are powered on to reduce labor costs and device deployment
time.
Table 2-9 lists information about SwitchA and SwitchB, and the files that the switches need
to load.
SwitchA
10GE1/0/1 [Link]/24
VLANIF10
[Link]
10GE1/0/2
SwitchB [Link]/24
SwitchC
DHCP relay agent
File server
[Link]
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure an FTP server as the file server to save the intermediate file, system software,
and configuration files.
NOTE
The FTP protocol will bring risk to device security. The SFTP mode is recommended.
2. Edit the intermediate file ztp_script.py to enable the switches to obtain their system
software packages and configuration files according to the intermediate file.
3. Configure the DHCP server and relay agent to enable unconfigured switches to obtain
DHCP information.
4. Power on SwitchA and SwitchB to start the ZTP process.
Procedure
Step 1 Configure the file server. (The following example uses a PC as the file server. If a device of a
different type functions as the file server, configure the device according to the corresponding
operation guide.)
1. Configure FTP server functions on the PC. Run an FTP server program (for example,
WFTPD32) on a PC. As shown in Figure 2-4, choose Security > Users/rights. In the
displayed dialog box, click New User to set the user name and password. Here, the user
name is ftpuser and the password is Pwd123. Enter the FTP working directory in the
Home Directory text box. Here, the working directory is D:\ztp. Click Done to close the
dialog box.
2. Configure the IP address and gateway for the file server. Ensure that the file server and
gateway of SwitchA and SwitchB have reachable routes to each other.
After configuring the file server, save the system software and configuration files to be loaded
to switches in the working directory D:\ztp.
Edit the intermediate file according to 2.2.3 Intermediate File in Python Format. The file is
named ztp_script.py. See ztp_script.py File and Configuration Files for the file contents.
After editing the intermediate file, save the file to the working directory D:\ztp on the file
server.
# Configure the IP address pool to be allocated by the DHCP server to clients and configure
the Option value of the DHCP server. For details, see the related DHCP server
documentation.
# Configure the IP address and gateway for the DHCP server. Ensure that the DHCP server
and gateway of SwitchA and SwitchB have reachable routes to each other.
Step 4 Configure the DHCP relay agent.
# On SwitchC, configure the DHCP relay function and set the IP address of the VLANIF
interface connected to SwitchA and SwitchB to [Link]. The VLANIF interface functions as
the default gateway of SwitchA and SwitchB.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchC
[*HUAWEI] commit
[~SwitchC] vlan batch 10
[*SwitchC] interface 10ge 1/0/1
[*SwitchC-10GE1/0/1] port link-type trunk
[*SwitchC-10GE1/0/1] port trunk allow-pass vlan 10
[*SwitchC-10GE1/0/1] port trunk pvid vlan 10
[*SwitchC-10GE1/0/1] quit
[*SwitchC] interface 10ge 1/0/2
[*SwitchC-10GE1/0/2] port link-type trunk
[*SwitchC-10GE1/0/2] port trunk allow-pass vlan 10
[*SwitchC-10GE1/0/2] port trunk pvid vlan 10
[*SwitchC-10GE1/0/2] quit
[*SwitchC] interface vlanif 10
[*SwitchC-Vlanif10] ip address [Link] 24
[*SwitchC-Vlanif10] quit
[*SwitchC] dhcp enable
[*SwitchC] interface vlanif 10
[*SwitchC-Vlanif10] dhcp select relay
[*SwitchC-Vlanif10] dhcp relay binding server ip [Link]
[*SwitchC-Vlanif10] commit
----End
NOTE
#md5sum= is the MD5 code of the intermediate file ztp_script.py. You can modify the contents of
ztp_script.py according to actual networking requirements. After the modification, use an MD5 calculation
tool, such as md5sum, to generate the MD5 code of the modified file.
Note that the intermediate file cannot contain #md5sum= when the MD5 code is generated. Add #md5sum=
to the beginning of the script after the MD5 code is generated.
#md5sum="b9af26ec6467784de5ed46de9b894407"
#!/usr/bin/env python
#
# Copyright (C) Huawei Technologies Co., Ltd. 2008-2013. All rights reserved.
#
----------------------------------------------------------------------------------
------------------------------------
# History:
# Date Author Modification
# 20130629 Author created file.
#
----------------------------------------------------------------------------------
------------------------------------
"""
Zero Touch Provisioning (ZTP) enables devices to automatically load version files
including system software,
patch files, configuration files when the device starts up, the devices to be
configured must be new devices
or have no configuration files.
This is a sample of Zero Touch Provisioning user script. You can customize it to
meet the requirements of
your network environment.
"""
import httplib
import urllib
import string
import re
import [Link] as etree
import os
import stat
import logging
import traceback
import hashlib
# error code
OK = 0
ERR = 1
# File server in which stores the necessary system software, configuration and
patch files:
# 1) Specify the file server which supports the following format.
# t[Link]
# [Link]
# s[Link]
# [Link]
# 2) Do not add a trailing slash at the end of file server path.
FILE_SERVER = '[Link]
'CE6850EI' : '/[Link]',
'CE12800' : '/[Link]',
}
# File path of configuration file on file server, filename extension is '.cfg',
'.zip' or '.dat'.
REMOTE_PATH_CONFIG = '/conf_%[Link]'
# File path of patch file on file server, filename extension is '.pat'
REMOTE_PATH_PATCH = {
'CE5850EI' : '',
'CE6850EI' : '',
'CE12800' : '',
}
# File path of stack member ID file on file server, filename extension is '.txt'
REMOTE_PATH_MEMID = ''
# File path of license list file, filename extension is '.xml'
REMOTE_PATH_LICLIST = ''
# File path of md5 file, contains md5 value of image / patch / memid / license
file, file extension is '.txt'
REMOTE_PATH_MD5 = ''
# File path of python file on file server, filename extension is '.py'
REMOTE_PATH_PYTHON = ''
class OPSConnection(object):
"""Make an OPS connection instance."""
def close(self):
"""Close the connection"""
[Link]()
"""REST call"""
if req_data == None:
body = ""
else:
body = req_data
class OPIExecError(Exception):
"""OPI executes error."""
pass
class ZTPErr(Exception):
"""ZTP error."""
pass
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
elem = root_elem.find(uri + "ipv4Addr", namespaces)
if elem is None:
raise OPIExecError('Failed to get IP address by host name')
return [Link]
url_tuple = urlparse(url)
if not [Link](r"\d+\.\d+\.\d+\.\d+", url_tuple.hostname):
netloc = get_addr_by_hostname(ops_conn, url_tuple.hostname)
if url_tuple.port:
netloc += ':' + str(url_tuple.port)
url = urlunparse((url_tuple.scheme, netloc, url_tuple.path,
url_tuple.params, url_tuple.query,
url_tuple.fragment))
ret = OK
opener = [Link]()
try:
dst_file_path = "%s/%s" % ([Link](), [Link](url))
dst_file_path = [Link](dst_file_path)
[Link]('HTTP download destination file=%s.', dst_file_path)
[Link](url, dst_file_path)
[Link](dst_file_path, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP |
stat.S_IROTH | stat.S_IXOTH)
return ret
return OK
_del_rsa_peer_key(ops_conn, server_name)
return OK
_del_sshc_rsa_key(ops_conn, server_ip)
_set_sshc_first_time(ops_conn, 'Disable')
return ret
return OK
t[Link]
[Link]
s[Link]
[Link]
Args:
ops_conn: OPS connection instance
url: URL of remote file
local_path: local path to put the file
Returns:
A integer of return code
"""
url_tuple = urlparse(url)
print("Info: Download %s to %s" % (url_tuple.path[1:], local_path))
func_dict = {'tftp': _tftp_download_file,
'ftp': _ftp_download_file,
'sftp': _sftp_download_file,
'http': _http_download_file,
'file': _usb_download_file}
scheme = url_tuple.scheme
if scheme not in func_dict.keys():
raise ZTPErr('Unknown file transfer scheme %s' % scheme)
ret = OK
cnt = 0
while (cnt < 1 + retry_times):
if cnt:
print('Retry downloading...')
[Link]('Retry downloading...')
ret = func_dict[scheme](ops_conn, url, local_path)
if ret is OK:
break
cnt += 1
return OK
class StartupInfo(object):
"""Startup configuration information
class Startup(object):
"""Startup configuration information
def _get_startup_info(self):
"""Get the startup information."""
[Link]("Get the startup information...")
uri = "/cfg/startupInfos/startupInfo"
req_data = '''<?xml version="1.0" encoding="UTF-8"?>
<startupInfo>
<position/>
<configedSysSoft/>
<curSysSoft/>
<nextSysSoft/>
<curStartupFile/>
<nextStartupFile/>
<curPatchFile/>
<nextPatchFile/>
</startupInfo>'''
cnt = 0
while (cnt < MAX_TIMES_GET_STARTUP):
ret, _, rsp_data = self.ops_conn.get(uri, req_data)
if ret != [Link] or rsp_data is '':
cnt += 1
[Link]('Failed to get the startup information')
continue
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
mpath = 'data' + [Link]('/', '/vrp:') # match path
nslen = len(namespaces['vrp'])
elem = root_elem.find(mpath, namespaces)
if elem is None:
raise OPIExecError('Failed to get the startup information')
def _del_startup_config_file(self):
"""Delete startup config file"""
[Link]("Delete the next startup config file...")
uri = "/cfg/clearStartup"
req_data = '''<?xml version="1.0" encoding="UTF-8"?>
<clearStartup>
</clearStartup>
'''
# it is a action operation, so use create for HTTP POST
ret, _, _ = self.ops_conn.create(uri, req_data)
if ret != [Link]:
raise OPIExecError("Failed to delete startup configuration file")
def _get_cur_stack_member_id(self):
"""rest api: Get current stack member id"""
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
elem = root_elem.find(uri + "memberID", namespaces)
if elem is None:
raise OPIExecError('Failed to get the current stack member id for no
"memberID" element')
return [Link]
if token[0] == esn:
return token[2]
return None
cur_memid = self._get_cur_stack_member_id()
next_memid = get_stackid_from_file(file_path, esn)
if not next_memid:
[Link]('Failed to get stack id from %s, esn %s', file_path,
esn)
return
return OK
def _reset_stack_member_id(self):
"""rest api: reset stack member id"""
return OK
def _reset_startup_patch_file(self):
"""Rest patch file for system to startup"""
[Link]("Reset the next startup patch file...")
uri = "/patch/resetpatch"
req_data = '''<?xml version="1.0" encoding="UTF-8"?>
<resetpatch>
</resetpatch>
'''
# it is a action operation, so use create for HTTP POST
ret, _, _ = self.ops_conn.create(uri, req_data)
if ret != [Link]:
raise OPIExecError('Failed to reset patch')
if [Link] is None:
self._del_startup_config_file()
else:
self._set_startup_config_file([Link])
if [Link] is not None:
del_file_all(self.ops_conn, [Link], slave)
raise
def get_cwd(ops_conn):
"""Get the full filename of the current working directory"""
[Link]("Get the current working directory...")
uri = "/vfm/pwds/pwd"
req_data = \
'''<?xml version="1.0" encoding="UTF-8"?>
<pwd>
<dictionaryName/>
</pwd>
'''
ret, _, rsp_data = ops_conn.get(uri, req_data)
if ret != [Link] or rsp_data is '':
raise OPIExecError('Failed to get the current working directory')
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
elem = root_elem.find(uri + "dictionaryName", namespaces)
if elem is None:
raise OPIExecError('Failed to get the current working directory for no
"directoryName" element')
return [Link]
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
elem = root_elem.find(uri + "fileName", namespaces)
if elem is None:
return False
return True
def has_slave_mpu(ops_conn):
"""Whether device has slave MPU, returns a bool value"""
[Link]("Test whether device has slave MPU...")
uri = "/devm/phyEntitys"
req_data = \
'''<?xml version="1.0" encoding="UTF-8"?>
<phyEntitys>
<phyEntity>
<entClass>mpuModule</entClass>
<entStandbyState/>
<position/>
</phyEntity>
</phyEntitys>
'''
ret, _, rsp_data = ops_conn.get(uri, req_data)
if ret != [Link] or rsp_data is '':
raise OPIExecError('Failed to get the device slave information')
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
for entity in root_elem.findall(uri + 'phyEntity', namespaces):
elem = [Link]("vrp:entStandbyState", namespaces)
if elem is not None and [Link] == 'slave':
return True
return False
def get_system_info(ops_conn):
"""Get system info, returns a dict"""
[Link]("Get the system information...")
uri = "/system/systemInfo"
req_data = \
'''<?xml version="1.0" encoding="UTF-8"?>
<systemInfo>
<productName/>
<esn/>
<mac/>
</systemInfo>
'''
ret, _, rsp_data = ops_conn.get(uri, req_data)
if ret != [Link] or rsp_data is '':
raise OPIExecError('Failed to get the system information')
return sys_info
file_name = [Link](license_list_file)
if file_name is not '' and not file_name.lower().endswith('.xml'):
print('Error: Invalid filename extension of license list file')
return False
return True
def read_chunks(fhdl):
'''read chunks'''
chunk = [Link](8096)
while chunk:
yield chunk
chunk = [Link](8096)
else:
[Link](0)
md5_obj = hashlib.md5()
if isinstance(fname, basestring) and [Link](fname):
with open(fname, "rb") as fhdl:
#skip the first line
[Link](0)
if need_skip_first_line:
[Link]()
for chunk in read_chunks(fhdl):
md5_obj.update(chunk)
elif fname.__class__.__name__ in ["StringIO", "StringO"] or isinstance(fname,
file):
for chunk in read_chunks(fname):
md5_obj.update(chunk)
else:
pass
return md5_obj.hexdigest()
def md5_get_from_file(fname):
"""Get md5 num form file, stored in first line"""
return line_first[9:41]
def md5_check_with_first_line(fname):
"""Validate md5 for this file"""
fname = [Link](fname)
md5_calc = md5sum(fname, True)
md5_file = md5_get_from_file(fname)
if md5_file.lower() != md5_calc:
[Link]('MD5 check failed, file %s', fname)
print('MD5 checksum of the file "%s" is %s' % (fname, md5_calc))
[Link]('MD5 checksum of the file "%s" is %s', fname, md5_calc)
print('MD5 checksum received from the file "%s" is %s' % (fname,
md5_file))
[Link]('MD5 checksum received from the file "%s" is %s', fname,
md5_file)
return False
return True
return False
def parse_md5_file(fname):
"""parse md5 file"""
def read_line(fhdl):
"""read a line by loop"""
line = [Link]()
while line:
yield line
line = [Link]()
else:
[Link](0)
md5_dic = {}
with open(fname, "rb") as fhdl:
for line in read_line(fhdl):
line_spilt = [Link]()
if 2 != len(line_spilt):
continue
dic_tmp = {line_spilt[0]: line_spilt[1]}
md5_dic.update(dic_tmp)
return md5_dic
def verify_and_parse_md5_file(fname):
"""
vefiry data integrity of md5 file and parse this file
file-name md5
conf_5618642831132.cfg c0ace0f0542950beaacb39cd1c3b5716
------------------------------------------------------------------
"""
if not md5_check_with_first_line(fname):
return ERR, None
return OK, parse_md5_file(fname)
def check_parameter(aset):
seq = ['&', '>', '<', '"', "'"]
if aset:
for c in seq:
if c in aset:
return True
return False
def check_filename(ops_conn):
sys_info = get_system_info(ops_conn)
url_tuple = urlparse(FILE_SERVER)
if check_parameter(url_tuple.username) or check_parameter(url_tuple.password):
raise ZTPErr('Invalid username or password, the name should not contain:
'+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_IMAGE.get(sys_info['productName'],
''))
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of system software, the name should not
contain: '+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_CONFIG)
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of configuration file, the name should not
contain: '+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_PATCH.get(sys_info['productName'],
''))
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of patch file, the name should not contain:
'+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_MEMID)
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of member ID file, the name should not
contain: '+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_MD5)
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of md5 file, the name should not contain:
'+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_LICLIST)
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of license list file, the name should not
contain: '+'&'+' >'+' <'+' "'+" '.")
return OK
def main_proc(ops_conn):
"""Main processing"""
sys_info = get_system_info(ops_conn) # Get system info, such as esn and
system mac
cwd = get_cwd(ops_conn) # Get the current working directory
startup = Startup(ops_conn)
slave = has_slave_mpu(ops_conn) # Check whether slave MPU board
exists or not
chg_flag = False
check_filename(ops_conn)
# download md5 file first, used to verify data integrity of files which will
be downloaded next
local_path_md5 = None
file_path = REMOTE_PATH_MD5
if not file_path.startswith('/'):
file_path = '/' + file_path
file_name = [Link](file_path)
if file_name is not '':
url = FILE_SERVER + file_path
local_path_md5 = cwd + file_name
ret = download_file(ops_conn, url, local_path_md5,
MAX_TIMES_RETRY_DOWNLOAD)
if ret is ERR or not file_exist(ops_conn, file_name):
print('Error: Failed to download MD5 file "%s"' % file_name)
return ERR
print('Info: Download MD5 file successfully')
ret, md5_dic = verify_and_parse_md5_file(file_name)
# delete the file immediately
del_file_all(ops_conn, local_path_md5, None)
if ret is ERR:
print('Error: MD5 check failed, file "%s"' % file_name)
return ERR
else:
md5_dic = {}
chg_flag = True
#execute license list file to get license file name which end with .dat
license_name = None
if local_path_liclist is not None:
tree = [Link](file_name)
root = [Link]()
for child in [Link]('Lic'):
name = [Link]('name')
esn = [Link]('Esn').text
if sys_info['esn'] in esn:
license_name = name
print('Info: License file name is "%s"' % license_name)
break
if license_name == None :
print('Error: Esn of this device is not in the license list file')
del_file_all(ops_conn, local_path_config, slave)
del_file_all(ops_conn, local_path_patch, slave)
del_file_all(ops_conn, local_path_memid, slave)
del_file_all(ops_conn, local_path_image, slave)
del_file_all(ops_conn, local_path_liclist, slave)
return ERR
return ERR
print('Info: Download license file successfully')
if not md5_check_with_dic(md5_dic, file_name):
print('Error: MD5 check failed, file "%s"' % file_name)
del_file_all(ops_conn, local_path_config, slave)
del_file_all(ops_conn, local_path_patch, slave)
del_file_all(ops_conn, local_path_memid, slave)
del_file_all(ops_conn, local_path_image, slave)
del_file_all(ops_conn, local_path_liclist, slave)
del_file_all(ops_conn, local_path_license, slave)
return ERR
chg_flag = True
#no need copy to slave board
if chg_flag is False:
return ERR
# delete stack member ID file and license list file after used
del_file_all(ops_conn, local_path_memid, None)
del_file_all(ops_conn, local_path_liclist, None)
return OK
Args:
Raises:
Returns: user script processing result
"""
host = "localhost"
if usb_path and len(usb_path):
[Link]('ztp_script usb_path: %s', usb_path)
global FILE_SERVER
FILE_SERVER = '[Link] + usb_path
try:
# Make an OPS connection instance.
ops_conn = OPSConnection(host)
ret = main_proc(ops_conn)
finally:
# Close the OPS connection
ops_conn.close()
return ret
if __name__ == "__main__":
main()
Configuration Files
Networking Requirements
As shown in Figure 2-5, SwitchA and SwitchB are two unconfigured switches on the
network, and both are connected to SwitchC. SwitchC functions as the egress gateway of
SwitchA and SwitchB. The routes between SwitchC and DHCP server, and between SwitchC
and the file server are reachable.
To reduce labor costs and device deployment time, the customer requires that SwitchA and
SwitchB can automatically load system software and configuration file after they are powered
on and set up a stack after automatic deployment is complete.
Table 2-11 lists information about SwitchA and SwitchB, and the files that the switches need
to load.
NOTE
To ensure that SwitchA and SwitchB can set up a stack, the following conditions must be met:
l SwitchA and SwitchB have been connected using stack cables before they are powered on.
l The configuration file must contain all stack configurations (including the stack priority, stack domain
ID, and stack port) related to the stack member ID to ensure that a stack can be set up successfully after
the configuration file is loaded. For example, the configuration file conf_210235527210D4000046.cfg
must contain the stack configurations related to stack member ID 2.
SwitchA [Link]/24
10GE1/0/1
Stack VLANIF10
link [Link]
10GE1/0/2
SwitchB [Link]/24
SwitchC
DHCP relay agent
File server
[Link]
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure an FTP server as the file server to save the intermediate file, system software,
and configuration files.
NOTE
The FTP protocol will bring risk to device security. The SFTP mode is recommended.
2. Edit the intermediate file ztp_script.py and the stack member ID file
stack_memberid.txt so that the switches can obtain their system software packages and
configuration files according to the intermediate file, and obtain stack member IDs
according to the stack member ID file.
3. Configure the DHCP server and relay agent to enable unconfigured switches to obtain
DHCP information.
4. Power on SwitchA and SwitchB to start the ZTP process.
Procedure
Step 1 Configure the file server. (The following example uses a PC as the file server. If a device of a
different type functions as the file server, configure the device according to the corresponding
operation guide.)
1. Configure FTP server functions on the PC. Run an FTP server program (for example,
WFTPD32) on a PC. As shown in Figure 2-6, choose Security > Users/rights. In the
displayed dialog box, click New User to set the user name and password. Here, the user
name is ftpuser and the password is Pwd123. Enter the FTP working directory in the
Home Directory text box. Here, the working directory is D:\ztp. Click Done to close the
dialog box.
2. Configure the IP address and gateway for the file server. Ensure that the file server and
gateway of SwitchA and SwitchB have reachable routes to each other.
After configuring the file server, save the system software and configuration files to be loaded
to switches in the working directory D:\ztp.
Edit the intermediate file according to 2.2.3 Intermediate File in Python Format. The file is
named ztp_script.py. See ztp_script.py File and Configuration Files for the file contents.
After editing the intermediate file, save the file to the working directory D:\ztp on the file
server.
Write stack member IDs of SwitchA and SwitchB into stack_memberid.txt in the following
format:
ESN Stack group Stack member
210235527210D4000028 10 1
210235527210D4000046 10 2
ESN is the equipment serial number, and Stack member indicates the stack member ID of
the switches.
After editing the stack member ID file, save the file to the working directory D:\ztp on the file
server.
# Configure the IP address pool to be allocated by the DHCP server to clients and configure
the Option value of the DHCP server. For details, see the related DHCP server
documentation.
# Configure the IP address and gateway for the DHCP server. Ensure that the DHCP server
and gateway of SwitchA and SwitchB have reachable routes to each other.
Step 5 Configure the DHCP relay agent.
# On SwitchC, configure the DHCP relay function and set the IP address of the VLANIF
interface connected to SwitchA and SwitchB to [Link]. The VLANIF interface functions as
the default gateway of SwitchA and SwitchB.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchC
[*HUAWEI] commit
[~SwitchC] vlan batch 10
[*SwitchC] interface 10ge 1/0/1
[*SwitchC-10GE1/0/1] port link-type trunk
[*SwitchC-10GE1/0/1] port trunk allow-pass vlan 10
[*SwitchC-10GE1/0/1] port trunk pvid vlan 10
[*SwitchC-10GE1/0/1] quit
[*SwitchC] interface 10ge 1/0/2
[*SwitchC-10GE1/0/2] port link-type trunk
[*SwitchC-10GE1/0/2] port trunk allow-pass vlan 10
[*SwitchC-10GE1/0/2] port trunk pvid vlan 10
[*SwitchC-10GE1/0/2] quit
[*SwitchC] interface vlanif 10
[*SwitchC-Vlanif10] ip address [Link] 24
[*SwitchC-Vlanif10] quit
[*SwitchC] dhcp enable
[*SwitchC] interface vlanif 10
[*SwitchC-Vlanif10] dhcp select relay
[*SwitchC-Vlanif10] dhcp relay binding server ip [Link]
[*SwitchC-Vlanif10] commit
----End
NOTE
#md5sum= is the MD5 code of the intermediate file ztp_script.py. You can modify the contents of
ztp_script.py according to actual networking requirements. After the modification, use an MD5 calculation
tool, such as md5sum, to generate the MD5 code of the modified file.
Note that the intermediate file cannot contain #md5sum= when the MD5 code is generated. Add #md5sum=
to the beginning of the script after the MD5 code is generated.
#md5sum="10c61d44e255098c8a952b7b614abbf7"
#!/usr/bin/env python
#
# Copyright (C) Huawei Technologies Co., Ltd. 2008-2013. All rights reserved.
#
----------------------------------------------------------------------------------
------------------------------------
# History:
# Date Author Modification
# 20130629 Author created file.
#
----------------------------------------------------------------------------------
------------------------------------
"""
Zero Touch Provisioning (ZTP) enables devices to automatically load version files
including system software,
patch files, configuration files when the device starts up, the devices to be
configured must be new devices
or have no configuration files.
This is a sample of Zero Touch Provisioning user script. You can customize it to
meet the requirements of
your network environment.
"""
import httplib
import urllib
import string
import re
import [Link] as etree
import os
import stat
import logging
import traceback
import hashlib
# error code
OK = 0
ERR = 1
# File server in which stores the necessary system software, configuration and
patch files:
# 1) Specify the file server which supports the following format.
# t[Link]
# [Link]
# s[Link]
# [Link]
# 2) Do not add a trailing slash at the end of file server path.
FILE_SERVER = '[Link]
class OPSConnection(object):
"""Make an OPS connection instance."""
def close(self):
"""Close the connection"""
[Link]()
class OPIExecError(Exception):
"""OPI executes error."""
pass
class ZTPErr(Exception):
"""ZTP error."""
pass
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
elem = root_elem.find(uri + "ipv4Addr", namespaces)
if elem is None:
raise OPIExecError('Failed to get IP address by host name')
return [Link]
url_tuple = urlparse(url)
if not [Link](r"\d+\.\d+\.\d+\.\d+", url_tuple.hostname):
netloc = get_addr_by_hostname(ops_conn, url_tuple.hostname)
if url_tuple.port:
netloc += ':' + str(url_tuple.port)
url = urlunparse((url_tuple.scheme, netloc, url_tuple.path,
url_tuple.params, url_tuple.query,
url_tuple.fragment))
ret = OK
opener = [Link]()
try:
dst_file_path = "%s/%s" % ([Link](), [Link](url))
dst_file_path = [Link](dst_file_path)
[Link]('HTTP download destination file=%s.', dst_file_path)
[Link](url, dst_file_path)
[Link](dst_file_path, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP |
stat.S_IROTH | stat.S_IXOTH)
except (KeyboardInterrupt, Exception), reason:
if [Link](dst_file_path):
[Link](dst_file_path) # Remove incomplete file
[Link](reason)
print('Error: Failed to download file "%s" using HTTP' %
[Link](url))
ret = ERR
return ret
return OK
_del_rsa_peer_key(ops_conn, server_name)
return OK
if ret != [Link]:
print('Failed to download file "%s" using SFTP' %
[Link](local_path))
ret = ERR
else:
ret = OK
_del_sshc_rsa_key(ops_conn, server_ip)
_set_sshc_first_time(ops_conn, 'Disable')
return ret
return OK
t[Link]
[Link]
s[Link]
[Link]
Args:
ops_conn: OPS connection instance
url: URL of remote file
local_path: local path to put the file
Returns:
A integer of return code
"""
url_tuple = urlparse(url)
print("Info: Download %s to %s" % (url_tuple.path[1:], local_path))
func_dict = {'tftp': _tftp_download_file,
'ftp': _ftp_download_file,
'sftp': _sftp_download_file,
'http': _http_download_file,
'file': _usb_download_file}
scheme = url_tuple.scheme
if scheme not in func_dict.keys():
raise ZTPErr('Unknown file transfer scheme %s' % scheme)
ret = OK
cnt = 0
while (cnt < 1 + retry_times):
if cnt:
print('Retry downloading...')
[Link]('Retry downloading...')
ret = func_dict[scheme](ops_conn, url, local_path)
if ret is OK:
break
cnt += 1
return OK
class StartupInfo(object):
"""Startup configuration information
class Startup(object):
"""Startup configuration information
def _get_startup_info(self):
"""Get the startup information."""
[Link]("Get the startup information...")
uri = "/cfg/startupInfos/startupInfo"
req_data = '''<?xml version="1.0" encoding="UTF-8"?>
<startupInfo>
<position/>
<configedSysSoft/>
<curSysSoft/>
<nextSysSoft/>
<curStartupFile/>
<nextStartupFile/>
<curPatchFile/>
<nextPatchFile/>
</startupInfo>'''
cnt = 0
while (cnt < MAX_TIMES_GET_STARTUP):
ret, _, rsp_data = self.ops_conn.get(uri, req_data)
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
mpath = 'data' + [Link]('/', '/vrp:') # match path
nslen = len(namespaces['vrp'])
elem = root_elem.find(mpath, namespaces)
if elem is not None:
break
[Link]('No query result while getting startup info')
sleep(GET_STARTUP_INTERVAL) # sleep to wait for system ready when
no query result
cnt += 1
if elem is None:
raise OPIExecError('Failed to get the startup information')
''')
req_data = str_temp.substitute(fileName = file_path)
# it is a action operation, so use create for HTTP POST
ret, _, _ = self.ops_conn.create(uri, req_data)
if ret != [Link]:
raise OPIExecError("Failed to set startup configuration file")
def _del_startup_config_file(self):
"""Delete startup config file"""
[Link]("Delete the next startup config file...")
uri = "/cfg/clearStartup"
req_data = '''<?xml version="1.0" encoding="UTF-8"?>
<clearStartup>
</clearStartup>
'''
# it is a action operation, so use create for HTTP POST
ret, _, _ = self.ops_conn.create(uri, req_data)
if ret != [Link]:
raise OPIExecError("Failed to delete startup configuration file")
def _get_cur_stack_member_id(self):
"""rest api: Get current stack member id"""
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
elem = root_elem.find(uri + "memberID", namespaces)
if elem is None:
raise OPIExecError('Failed to get the current stack member id for no
"memberID" element')
return [Link]
cur_memid = self._get_cur_stack_member_id()
next_memid = get_stackid_from_file(file_path, esn)
if not next_memid:
[Link]('Failed to get stack id from %s, esn %s', file_path,
esn)
return
return OK
def _reset_stack_member_id(self):
"""rest api: reset stack member id"""
return OK
def _reset_startup_patch_file(self):
"""Rest patch file for system to startup"""
[Link]("Reset the next startup patch file...")
uri = "/patch/resetpatch"
req_data = '''<?xml version="1.0" encoding="UTF-8"?>
<resetpatch>
</resetpatch>
'''
# it is a action operation, so use create for HTTP POST
ret, _, _ = self.ops_conn.create(uri, req_data)
if ret != [Link]:
raise
def get_cwd(ops_conn):
"""Get the full filename of the current working directory"""
[Link]("Get the current working directory...")
uri = "/vfm/pwds/pwd"
req_data = \
'''<?xml version="1.0" encoding="UTF-8"?>
<pwd>
<dictionaryName/>
</pwd>
'''
ret, _, rsp_data = ops_conn.get(uri, req_data)
if ret != [Link] or rsp_data is '':
raise OPIExecError('Failed to get the current working directory')
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
elem = root_elem.find(uri + "dictionaryName", namespaces)
if elem is None:
raise OPIExecError('Failed to get the current working directory for no
"directoryName" element')
return [Link]
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
elem = root_elem.find(uri + "fileName", namespaces)
if elem is None:
return False
return True
def has_slave_mpu(ops_conn):
"""Whether device has slave MPU, returns a bool value"""
[Link]("Test whether device has slave MPU...")
uri = "/devm/phyEntitys"
req_data = \
'''<?xml version="1.0" encoding="UTF-8"?>
<phyEntitys>
<phyEntity>
<entClass>mpuModule</entClass>
<entStandbyState/>
<position/>
</phyEntity>
</phyEntitys>
'''
ret, _, rsp_data = ops_conn.get(uri, req_data)
if ret != [Link] or rsp_data is '':
raise OPIExecError('Failed to get the device slave information')
root_elem = [Link](rsp_data)
namespaces = {'vrp' : '[Link]
uri = 'data' + [Link]('/', '/vrp:') + '/vrp:'
for entity in root_elem.findall(uri + 'phyEntity', namespaces):
elem = [Link]("vrp:entStandbyState", namespaces)
if elem is not None and [Link] == 'slave':
return True
return False
def get_system_info(ops_conn):
"""Get system info, returns a dict"""
[Link]("Get the system information...")
uri = "/system/systemInfo"
req_data = \
'''<?xml version="1.0" encoding="UTF-8"?>
<systemInfo>
<productName/>
<esn/>
<mac/>
</systemInfo>
'''
ret, _, rsp_data = ops_conn.get(uri, req_data)
if ret != [Link] or rsp_data is '':
raise OPIExecError('Failed to get the system information')
return sys_info
return True
def read_chunks(fhdl):
'''read chunks'''
chunk = [Link](8096)
while chunk:
yield chunk
chunk = [Link](8096)
else:
[Link](0)
md5_obj = hashlib.md5()
if isinstance(fname, basestring) and [Link](fname):
with open(fname, "rb") as fhdl:
#skip the first line
[Link](0)
if need_skip_first_line:
[Link]()
for chunk in read_chunks(fhdl):
md5_obj.update(chunk)
elif fname.__class__.__name__ in ["StringIO", "StringO"] or isinstance(fname,
file):
for chunk in read_chunks(fname):
md5_obj.update(chunk)
else:
pass
return md5_obj.hexdigest()
def md5_get_from_file(fname):
"""Get md5 num form file, stored in first line"""
return line_first[9:41]
def md5_check_with_first_line(fname):
"""Validate md5 for this file"""
fname = [Link](fname)
md5_calc = md5sum(fname, True)
md5_file = md5_get_from_file(fname)
if md5_file.lower() != md5_calc:
return True
return False
def parse_md5_file(fname):
"""parse md5 file"""
def read_line(fhdl):
"""read a line by loop"""
line = [Link]()
while line:
yield line
line = [Link]()
else:
[Link](0)
md5_dic = {}
with open(fname, "rb") as fhdl:
for line in read_line(fhdl):
line_spilt = [Link]()
if 2 != len(line_spilt):
continue
dic_tmp = {line_spilt[0]: line_spilt[1]}
md5_dic.update(dic_tmp)
return md5_dic
def verify_and_parse_md5_file(fname):
"""
vefiry data integrity of md5 file and parse this file
file-name md5
conf_5618642831132.cfg c0ace0f0542950beaacb39cd1c3b5716
------------------------------------------------------------------
"""
if not md5_check_with_first_line(fname):
return ERR, None
return OK, parse_md5_file(fname)
def check_parameter(aset):
seq = ['&', '>', '<', '"', "'"]
if aset:
for c in seq:
if c in aset:
return True
return False
def check_filename(ops_conn):
sys_info = get_system_info(ops_conn)
url_tuple = urlparse(FILE_SERVER)
if check_parameter(url_tuple.username) or check_parameter(url_tuple.password):
raise ZTPErr('Invalid username or password, the name should not contain:
'+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_IMAGE.get(sys_info['productName'],
''))
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of system software, the name should not
contain: '+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_CONFIG)
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of configuration file, the name should not
contain: '+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_PATCH.get(sys_info['productName'],
''))
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of patch file, the name should not contain:
'+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_MEMID)
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of member ID file, the name should not
contain: '+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_MD5)
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of md5 file, the name should not contain:
'+'&'+' >'+' <'+' "'+" '.")
file_name = [Link](REMOTE_PATH_LICLIST)
if file_name is not '' and check_parameter(file_name):
raise ZTPErr('Invalid filename of license list file, the name should not
contain: '+'&'+' >'+' <'+' "'+" '.")
return OK
def main_proc(ops_conn):
"""Main processing"""
sys_info = get_system_info(ops_conn) # Get system info, such as esn and
system mac
cwd = get_cwd(ops_conn) # Get the current working directory
startup = Startup(ops_conn)
slave = has_slave_mpu(ops_conn) # Check whether slave MPU board
exists or not
chg_flag = False
check_filename(ops_conn)
# download md5 file first, used to verify data integrity of files which will
be downloaded next
local_path_md5 = None
file_path = REMOTE_PATH_MD5
if not file_path.startswith('/'):
file_path = '/' + file_path
file_name = [Link](file_path)
if file_name is not '':
url = FILE_SERVER + file_path
local_path_md5 = cwd + file_name
ret = download_file(ops_conn, url, local_path_md5,
MAX_TIMES_RETRY_DOWNLOAD)
if ret is ERR or not file_exist(ops_conn, file_name):
print('Error: Failed to download MD5 file "%s"' % file_name)
return ERR
print('Info: Download MD5 file successfully')
ret, md5_dic = verify_and_parse_md5_file(file_name)
# delete the file immediately
del_file_all(ops_conn, local_path_md5, None)
if ret is ERR:
print('Error: MD5 check failed, file "%s"' % file_name)
return ERR
else:
md5_dic = {}
cur_pat = ''
if file_name is not '' and file_name.lower() != cur_pat:
url = FILE_SERVER + file_path
local_path_patch = cwd + file_name
ret = download_file(ops_conn, url, local_path_patch,
MAX_TIMES_RETRY_DOWNLOAD)
if ret is ERR or not file_exist(ops_conn, file_name):
print('Error: Failed to download patch file "%s"' % file_name)
del_file_all(ops_conn, local_path_config, slave)
return ERR
print('Info: Download patch file successfully')
if not md5_check_with_dic(md5_dic, file_name):
print('Error: MD5 check failed, file "%s"' % file_name)
del_file_all(ops_conn, local_path_config, slave)
del_file_all(ops_conn, local_path_patch, slave)
return ERR
if slave:
copy_file(ops_conn, local_path_patch, 'slave#' + local_path_patch)
chg_flag = True
#execute license list file to get license file name which end with .dat
license_name = None
if local_path_liclist is not None:
tree = [Link](file_name)
root = [Link]()
for child in [Link]('Lic'):
name = [Link]('name')
esn = [Link]('Esn').text
if sys_info['esn'] in esn:
license_name = name
print('Info: License file name is "%s"' % license_name)
break
if license_name == None :
print('Error: Esn of this device is not in the license list file')
del_file_all(ops_conn, local_path_config, slave)
del_file_all(ops_conn, local_path_patch, slave)
del_file_all(ops_conn, local_path_memid, slave)
del_file_all(ops_conn, local_path_image, slave)
del_file_all(ops_conn, local_path_liclist, slave)
return ERR
if chg_flag is False:
return ERR
# delete stack member ID file and license list file after used
del_file_all(ops_conn, local_path_memid, None)
del_file_all(ops_conn, local_path_liclist, None)
return OK
Args:
Raises:
Returns: user script processing result
"""
host = "localhost"
if usb_path and len(usb_path):
[Link]('ztp_script usb_path: %s', usb_path)
global FILE_SERVER
FILE_SERVER = '[Link] + usb_path
try:
# Make an OPS connection instance.
ops_conn = OPSConnection(host)
ret = main_proc(ops_conn)
finally:
# Close the OPS connection
ops_conn.close()
return ret
if __name__ == "__main__":
main()
Configuration Files
#
sysname SwitchC
#
vlan batch 10
#
dhcp enable
#
interface Vlanif10
ip address [Link] [Link]
dhcp select relay
dhcp relay binding server ip [Link]
#
interface 10GE1/0/1
port link-type trunk
port trunk pvid vlan 10
port trunk allow-pass vlan 10
#
interface 10GE1/0/2
port link-type trunk
port trunk pvid vlan 10
port trunk allow-pass vlan 10
#
return
USB-based deployment simplifies the deployment process, reduces the deployment costs, and
relieves users from software commissioning.
3.1 USB-based Deployment Overview
3.2 Principles
3.3 Configuration Notes
3.4 Making an Index File
3.5 Configuring USB-based Deployment
3.6 (Optional) Disabling the USB-based Deployment Function
3.7 Configuration Examples
Definition
USB-based deployment allows you to configure or upgrade devices using a USB flash drive.
Before device deployment, save the required files in a USB flash drive. After you connect the
USB flash drive to a device, the device downloads the files from the USB flash drive to
complete automatic upgrade or service deployment.
Purpose
As the network expands, more and more network devices are used and device deployment
becomes more frequent. Traditionally, software engineers have to deploy the devices one by
one, which is time-consuming and laborious. USB-based deployment frees software engineers
from such trouble. They only need to save the required files in a USB flash drive, and then
other onsite personnel can finish the deployment process easily. This function simplifies the
device deployment process and lowers deployment costs.
3.2 Principles
Yes
Yes
Failure
4. The system obtains deployment files.
Success
No
7. The system checks whether files loaded
are the same as deployment files.
Yes
License Support
USB-based deployment is a basic feature of a switch and is not under license control.
Version Support
CE8850EI V200R002C50
CE7855EI V200R001C00
CE6810-48S4Q-LI/ V100R003C10
CE6810-48S-LI
CE6810-32T16S4Q-LI/ V100R005C10
CE6810-24S2Q-LI
CE6850EI V100R001C00
CE6850-48S6Q-HI V100R005C00
CE6850-48T6Q-HI/ V100R005C10
CE6850UHI
CE6851HI V100R005C10
CE6855HI V200R001C00
CE6860EI V200R002C50
CE6870-24S6CQ-EI/ V200R001C00
CE6870-48S6CQ-EI
CE6870-48T6CQ-EI V200R002C50
CE6880EI V200R002C50
CE5850EI V100R001C00
CE5850HI V100R003C00
CE5855EI V100R005C10
l When deployment files include the configuration file and an authentication password for
USB-based deployment is configured, you must compress and encrypt the configuration
file using the configured authentication password before saving the configuration file to
the specified path of the USB flash drive. However, the configuration file in .zip format
cannot be compressed and encrypted. You need to first decompress the configuration file
in .zip format and then compress and encrypt the file before saving it to the USB flash
drive.
Examples
Example 1
You need to create an index file for upgrading one device, and the requirements are as
follows:
l Data is changed at 08:09:10 on June 28, 2011.
l The device does not register with the NMS.
l The device MAC address is 0018-0303-1234.
l The system software [Link], the configuration file [Link], and
the patch file [Link] are stored in the root directory of the USB flash drive.
l The configuration file to be loaded is checked according to the HMAC
c3caaee8f4f6bd1389f438801e40dad9af30f2fbbe7e8f55121b39c6c16ba488.
The index file that meets the preceding requirements is as follows:
BEGIN DC
[GLOBAL CONFIG]
TIMESN=20110628.080910
EMS_ONLINE_STATE=NO
UPGRADEMODE=AUTO
[DEVICE0 DESCRIPTION]
OPTION=OK
ESN=DEFAULT
MAC=0018-0303-1234
DIRECTORY=DEFAULT
SYSTEM-SOFTWARE=[Link]
SYSTEM-CONFIG=[Link]
HMAC=c3caaee8f4f6bd1389f438801e40dad9af30f2fbbe7e8f55121b39c6c16ba488
SYSTEM-PAT=[Link]
END DC
Example 2
You need to create an index file for upgrading multiple devices to the same software version,
and the requirements are as follows:
l Data is changed at 08:09:10 on June 28, 2011.
l The device does not register with the NMS.
l The system software [Link] is stored in the root directory of the USB flash
drive.
The index file that meets the preceding requirements is as follows:
BEGIN DC
[GLOBAL CONFIG]
TIMESN=20110628.080910
EMS_ONLINE_STATE=NO
UPGRADEMODE=AUTO
[DEVICE0 DESCRIPTION]
OPTION=OK
ESN=DEFAULT
MAC=DEFAULT
DIRECTORY=DEFAULT
SYSTEM-SOFTWARE=[Link]
END DC
Example 3
You need to create an index file for two devices with different description information, and
the requirements are as follows:
l Data is changed at 08:09:10 on June 28, 2011.
l The device does not register with the NMS.
l The MAC address of the first device is 0018-0303-1234.
l The MAC address of the second device is 0018-0303-5678.
l The system software [Link] and the configuration file [Link]
are stored in the root directory of the USB flash drive. The first device does not need to
load the configuration file while the second device must load the configuration file.
The index file that meets the preceding requirements is as follows:
BEGIN DC
[GLOBAL CONFIG]
TIMESN=20110628.080910
EMS_ONLINE_STATE=NO
UPGRADEMODE=AUTO
[DEVICE0 DESCRIPTION]
OPTION=OK
ESN=DEFAULT
MAC=0018-0303-1234
DIRECTORY=DEFAULT
SYSTEM-SOFTWARE=[Link]
[DEVICE1 DESCRIPTION]
OPTION=OK
ESN=DEFAULT
MAC=0018-0303-5678
DIRECTORY=DEFAULT
SYSTEM-SOFTWARE=[Link]
SYSTEM-CONFIG=[Link]
END DC
Background Information
When using USB-based deployment, pay attention to the following points:
l The file system format of a USB flash drive must be FAT32 and its interface must be
standard USB2.0.
l To write data to a USB flash drive, disable the write-protection function.
l USB-based deployment is supported only on a standalone device but not in a stack that
contains multiple member devices.
l Before USB-based deployment, ensure that the device can start properly and has
sufficient space for saving deployment files.
l USB-based deployment files include the index file, system software, configuration file,
and patch file. The index file is mandatory. At least one of the other files must exist.
l The index file name must be smart_config.ini.
l Do not power off the device during file copy; otherwise, the upgrade fails or even the
device cannot start.
l Do not remove the USB flash drive before the USB-based deployment is complete;
otherwise, the data in the USB flash drive may be damaged.
l When deployment files include the configuration file and an authentication password for
USB-based deployment is configured, you must compress and encrypt the configuration
file using the configured authentication password before saving the configuration file to
the specified path of the USB flash drive. However, the configuration file in .zip format
cannot be compressed and encrypted. You need to first decompress the configuration file
in .zip format and then compress and encrypt the file before saving it to the USB flash
drive.
Pre-configuration Tasks
l The device has been powered on and the self-check is successful.
Procedure
1. Run the system-view command to enter the system view.
2. Run the undo set device usb-deployment disable command to enable the USB-based
deployment function.
The USB-based deployment function is disabled by default. It is recommended that you
disable this function after a USB-based deployment is complete.
3. (Optional) Run the set device usb-deployment password [ password ] command to
configure an authentication password for USB-based deployment to check the validity of
the configuration file.
By default, no authentication password is configured on the device.
After an authentication password is configured, the device uses the password as the key
to calculate the HMAC of the configuration file to be loaded based on the HMAC-
SHA256 algorithm and compares the calculated HMAC with the value of the HMAC
field in the index file. If the two HMAC values are the same, the device considers the
configuration file valid, and USB-based deployment can be performed. Otherwise, the
device considers the configuration file invalid, and USB-based deployment cannot be
performed.
NOTE
After an authentication password is configured using the set device usb-deployment password
password command, the HMAC field in the index file must contain the HMAC of the configuration
file. The HMAC is generated through the HMAC-SHA256 calculation tool (such as OpenSSL), and the
key is the configured authentication password.
To ensure device security, you are advised to configure the authentication password for USB-based
deployment and periodically change the password.
4. Run the commit command, the configuration is committed.
5. Create an index file.
For details, see 3.4 Making an Index File.
6. Save the index file in the root directory of a USB flash drive, and copy deployment files
to the specified directory.
The DIRECTORY field in the index file specifies the path for storing deployment files.
– If the value is DEFAULT, the deployment files are stored in the root directory of
the USB flash drive.
– If the value is /abc, the deployment files are stored in the abc directory.
NOTE
If deployment files include the configuration file and an authentication password for USB-based
deployment needs to be configured in step 3, you must compress and encrypt the configuration file
using the configured authentication password before saving the configuration file to the specified path
of the USB flash drive. However, the configuration file in .zip format cannot be compressed and
encrypted. You need to first decompress the configuration file in .zip format and then compress and
encrypt the file before saving it to the USB flash drive.
7. Insert the USB flash drive into a device to start the deployment process.
Based on the description information in the smart_config.ini file, the system first copies
deployment files from the USB flash drive to the default storage media (If the system
failed to copy files, the deployment indicator is steady red and the deployment failed),
set the system software, configuration file and patch file as files to be loaded during next
system startup, and automatically restarts.
Verify that USB-based deployment is successful and remove the USB flash drive. The USB-based
deployment process is complete.
l View the USB-based deployment reports to learn about the deployment result.
After the deployment is complete, the system generates the usbload_verify.txt or
usbload_error.txt files, containing the success information and error information
respectively. The report files are stored in the root directory of the USB flash drive.
The content and format of the usbload_verify.txt and usbload_error.txt files are as
follows:
===================================================
Time : 2011-10-29 10:30:50
MAC Address : 0e-0f-22-01-02-03
System Name : CE6850
Description : USB-based deployed succeeded.
===================================================
Item Description
Context
After the USB-based deployment function is enabled on a device, the device can be upgraded
once a qualified USB flash drive is connected to the device. After the USB-based deployment
function takes effect, to enhance device security and avoid service interruption caused by
unnecessary version upgrades, disable the USB-based deployment function. After the USB-
based deployment function is disabled, the device cannot be upgraded using any qualified
USB flash drive.
Procedure
Step 1 Run:
system-view
Step 2 Run:
set device usb-deployment disable
Step 3 Run:
commit
----End
Configuration Roadmap
The configuration roadmap is as follows:
1. Enable USB-based deployment.
2. Create the index file smart_config.ini.
3. Save the smart_config.ini file in the root directory of a USB flash drive, and copy
deployment files to the directory specified by the index file.
4. Insert the USB flash drive into a device to start the deployment process.
Procedure
Step 1 Enable USB-based deployment.
<HUAWEI> system-view
[~HUAWEI] undo set device usb-deployment disable
[*HUAWEI] commit
OPTION=OK
MAC=0018-0303-1234
DIRECTORY=DEFAULT
SYSTEM-SOFTWARE=[Link]
[DEVICE1 DESCRIPTION]
OPTION=OK
MAC=0018-0303-5678
DIRECTORY=DEFAULT
SYSTEM-SOFTWARE=[Link]
SYSTEM-CONFIG=[Link]
END DC
Step 3 Save the smart_config.ini file in the root directory of a USB flash drive, and copy the
[Link] and [Link] files to the directory specified by the index file.
Step 4 Insert the USB flash drive into the first device.
Step 5 Observe the deployment indicator to monitor the USB-based deployment process:
l If any deployment file is not found, the deployment indicator is off.
l If deployment files are found but not valid, the deployment failed and the deployment
indicator is steady red.
l If deployment files are found and valid, the USB-based deployment starts and the
deployment indicator blinks green.
Based on the description information in the smart_config.ini file, the system first copies
deployment files from the USB flash drive to the default storage media (If the system
failed to copy files, the deployment indicator is steady red and the deployment failed),
set the system software, configuration file and patch file as files to be loaded during next
system startup, and automatically restarts.
Step 6 Verify the configuration.
l After the device restarts, the system checks the deployment status. If the deployment
indicator is steady green, USB-based deployment [Link] the deployment indicator is
steady red, USB-based deployment fails.
NOTE
Verify that USB-based deployment is successful and remove the USB flash drive. The USB-based
deployment process is complete.
l After the deployment is complete, the system generates the usbload_verify.txt or
usbload_error.txt files, containing the success information and error information
respectively. The report files are stored in the root directory of the USB flash drive.
Step 7 After the first device is deployed, insert the USB flash drive into the second device to start the
deployment process.
----End
This chapter describes how to log in to a new device to configure the device. You can log in
through the console port or Mini USB port.
NOTE
Only CE8860EI, CE6850HI, CE6855-48T6Q-HI and CE6850U-HI support login through the mini USB
port.
NOTE
l Before using the Mini USB port to log in to a device, install the Mini USB port driver on the user
terminal.
l When both the Mini USB port and console port are connected, only the Mini USB port can be used
for login.
Pre-configuration Tasks
Before logging in to the device through the console port, complete the following tasks:
l Preparing the console cable
l Installing the terminal emulation software on the PC
NOTE
You can use the built-in terminal emulation software (such as the HyperTerminal of Windows
2000) on the PC. If no built-in terminal emulation software is available, use the third-party
terminal emulation software. For details, see the software user guide or online help. This section
uses the third-party software SecureCRT as an example.
Configuration Procedure
Use the terminal emulation software to log in to the device through the console port, and
complete basic configurations for the device.
Default Configuration
Stop bit 1
Data bit 8
Procedure
Step 1 Use the terminal emulation software to log in to the device through the console port.
1. Insert the DB9 connector of the console cable delivered with the product to the 9-pin
serial port on the PC, and insert the RJ45 connector to the console port of the device, as
shown in Figure 4-1.
ACT
L/A
ID
ETH
PAC-350WA-B ~100-240V;50/60Hz,5A FAN-40EA-B PWR1 FAN1 FAN2 PWR2 FAN-40EA-B PAC-350WA-B ~100-240V;50/60Hz,5A
DB-9
2. Start the terminal emulation software on the PC. Create a connection, select the
connected port, and set communication parameters.(This section uses the third-party
software SecureCRT as an example.)
b. Set the connected port and communication parameters, as shown in Figure 4-3.
Select the connected port based on actual situations. For example, you can view
port information in Device Manager in the Windows operating system, and select
the connected port.
Communication parameters of the terminal emulation software must be consistent
with the default attribute settings of the console user interface on the device, which
are 9600 bit/s baud rate, 8 data bits, 1 stop bit, no parity check, and no flow control.
NOTE
By default, no flow control mode is configured on the device. Because RTS/CTS is selected
in the software by default, you need to deselect RTS/CTS; otherwise, you cannot enter
commands.
NOTE
A PC may have multiple connection interfaces; therefore, the interface connected through the
console cable is selected in this example. Generally, COM1 is selected.
If the serial port communication parameters of the device are modified, modify the communication
parameters on the PC accordingly (ensure that the parameter values are the same) and re-establish
the connection.
3. Press Enter until the following information is displayed. Enter the password and confirm
password. (The following information is only for reference.)
An initial password is required for the first login via the console.
Continue to set it? [Y/N]: y
Set a password and keep it safe! Otherwise you will not be able to login via
the console.
NOTE
– If the authentication password is not configured, users can log in to the device without entering
the password. This mode has potential security risks. It is recommended that the authentication
password be configured.
– The password is a string of 8 to 16 case-sensitive characters. The password must contain at
least two of the following character types: upper-case and lower-case letters, digits, and special
characters except the question mark (?) and space.
– The password entered in interactive mode is not displayed on the screen.
– When you log in to the system again in password authentication mode, enter the password that
is set during the initial login.
You can run commands to configure the device. Enter a question mark (?) whenever you
need help.
Table 4-2 Actions for setting the time and date on the device
Action Command Description
Set the time clock timezone time-zone-name – add: adds the specified time
zone. { add | minus } offset zone offset to the Coordinated
Universal Time (UTC). That
is, the sum of the default UTC
time zone and offset is equal to
the time zone specified by
time-zone-name.
– minus: subtracts the specified
time zone offset from the
UTC. That is, the remainder
obtained by subtracting offset
from the default UTC time
zone is equal to the time zone
specified by time-zone-name.
Set the clock datetime [ utc ] If the time zone is not set, the
current time HH:MM:SS YYYY-MM-DD time set using this command is
and date. considered as the UTC time.
Before setting the current time,
you are advised to confirm the
current zone and set the correct
time zone offset.
Table 4-3 Actions for setting the device name and IP address
Action Command Description
Enter the interface interface-type interface- You can assign the IP address to
interface number the management interface or
view. another Layer 3 interface (such as
the VLANIF interface).
3. Configure the user level and authentication mode for the Telnet user.
Table 4-4 Actions for configuring the user level and authentication mode for the Telnet
user
Action Command Description
Enable the undo telnet [ ipv6 ] server Upon factory delivery, the Telnet
telnet disable server is disabled.
service.
Set the user privilege level level By default, users who log in
Telnet user through the VTY user interface
level. can access commands at level 0.
----End
NOTE
Only CE8860EI, CE6850HI, CE6855-48T6Q-HI and CE6850U-HI support login through the Mini USB
port.
Pre-configuration Tasks
Before logging in to a device through the Mini USB port, complete the following tasks:
You can use the self-contained terminal emulation software of the operating system (such as the
HyperTerminal of Windows XP) on the PC. If no built-in terminal emulation software is available,
use the third-party terminal emulation software. For details, see the software user guide or online
help.
Configuration Procedure
Install the Mini USB driver on the PC, use the terminal emulation software to log in through
the Mini USB port, and configure the device.
Default Configuration
Stop bit 1
Data bit 8
Procedure
Step 1 Install the Mini USB driver.
For the method of installing a driver, see Mini USB Serial Port Usage Guide on CloudEngine
Series Switches on the Huawei enterprise support website ([Link]
enterprise).
Step 2 Use the terminal emulation software to log in to the device through the Mini USB port.
1. Start the terminal emulation software on the PC. Create a connection, select the
connected port, and set communication parameters.
NOTE
A PC may have multiple connection interfaces; therefore, the interface connected through the Mini
USB cable is selected in this example.
If the serial interface communication parameters of the device are modified, modify the
communication parameters on the PC accordingly (ensure that the parameter values are the same)
and re-establish the connection.
2. Press Enter until the following information is displayed. Enter the password and confirm
the password. (The following information is only for reference.)
An initial password is required for the first login via the console.
Continue to set it? [Y/N]: y
Set a password and keep it safe! Otherwise you will not be able to login via
the console.
NOTE
– If the authentication password is not configured, users can log in to the device without entering
the password. This mode has potential security risks. It is recommended that the authentication
password be configured.
– The password is a string of 8 to 16 case-sensitive characters. The password must contain at
least two of the following character types: upper-case and lower-case letters, digits, and special
characters except the question mark (?) and space.
– The password entered in interactive mode is not displayed on the screen.
– When you log in to the system again in password authentication mode, enter the password that
is set during the initial login.
You can run commands to configure the device. Enter a question mark (?) whenever you
need help.
Table 4-7 Actions for setting the time and date on the device
Set the time clock timezone time-zone-name – add: adds the specified time
zone. { add | minus } offset zone offset to the Coordinated
Universal Time (UTC). That
is, the sum of the default UTC
time zone and offset is equal to
the time zone specified by
time-zone-name.
– minus: subtracts the specified
time zone offset from the
UTC. That is, the remainder
obtained by subtracting offset
from the default UTC time
zone is equal to the time zone
specified by time-zone-name.
Set the clock datetime [ utc ] If the time zone is not set, the
current time HH:MM:SS YYYY-MM-DD time set using this command is
and date. considered as the UTC time.
Before setting the current time,
you are advised to confirm the
current zone and set the correct
time zone offset.
Table 4-8 Actions for setting the device name and IP address
Action Command Description
Enter the interface interface-type interface- You can assign the IP address to
interface number the management interface or
view. another Layer 3 interface (such as
the VLANIF interface).
3. Configure the user level and authentication mode for the Telnet user.
Table 4-9 Actions for configuring the user level and authentication mode for the Telnet
user
Action Command Description
Enable the undo telnet [ ipv6 ] server Upon factory delivery, the Telnet
telnet disable server is disabled.
service.
Set the user privilege level level By default, users who log in
Telnet user through the VTY user interface
level. can access commands at level 0.
----End
Figure 4-4 Networking diagram for configuring the device through the console port
Console
Network
Configuration Roadmap
1. Log in to the device through the console port.
NOTE
The HyperTerminal of Windows 2000 can be used as the terminal emulation software on the PC.
2. Configure the device.
Procedure
Step 1 Log in to the device from PC1 through the console port. For details, see Logging In Through
the Console Port.
Step 2 Configure the device.
# Set the system date, time, and time zone.
<HUAWEI> clock timezone BJ add 08:00:00
<HUAWEI> clock datetime 20:10:00 2012-07-26
# Set the user level and authentication mode for Telnet users.
[*Server] undo telnet server disable
[*Server] user-interface vty 0 4
[*Server-ui-vty0-4] user privilege level 3
[*Server-ui-vty0-4] authentication-mode aaa
[*Server-ui-vty0-4] quit
[*Server] aaa
[*Server-aaa] local-user admin1234 password irreversible-cipher Helloworld@6789
[*Server-aaa] local-user admin1234 level 3
[*Server-aaa] local-user admin1234 service-type telnet
[*Server-aaa] commit
[~Server-aaa] quit
When completing the configuration, you can log in to the device through Telnet on PC2.
Access the command line interface of Windows 7 and log in to the device through Telnet.
C:\Windows\System32> telnet [Link]
Press Enter. On the displayed login page, enter the user name and password. If the
authentication succeeds, the command line interface for the user view is displayed. (The
following information is only for reference.)
Username:admin1234
Password:
Info: The max number of VTY users is 21, and the number of current VTY users on
line is 1,
and total number of terminal users online is 1.
The current login time is 2012-07-26 20:10:08+08:00.
First login successfully.
<Server>
----End
Configuration Files
Configuration file of the device
#
clock timezone BJ add 08:00:00
#
sysname Server
#
aaa
local-user admin1234 password irreversible-cipher $1c$g8wLJ`LjL!
$CyE(V{3qg5DdU:PM[6=6O$[Link],Q}>^)OBzgoU$
local-user admin1234 service-type telnet
local-user admin1234 level 3
#
interface MEth0/0/0
ip address [Link] [Link]
#
user-interface vty 0 4
authentication-mode aaa
user privilege level 3
#
return
When a user logs in to the device using the console port, Telnet, or SSH, the system manages
the session between the user and the device on the corresponding user interface.
When a user logs in the device using the mini USB port, the console user interface is
displayed.
l VTY
The Virtual Type Terminal (VTY) manages and monitors users who log in to the device
using VTY user interfaces
When a user's terminal connects to the device using Telnet or Secure Shell (SSH), a VTY
is set up. A maximum of 21 users can log in to the device using VTY interfaces at the
same time.
l In the password authentication mode, the level of commands that the user can run
depends on the level of the user interface.
l In the AAA authentication mode, the level of commands that the user can run depends
on the level of the local user specified in AAA configuration.
Pre-configuration Tasks
Before configuring a console user interface, complete the following tasks:
NOTE
To log in to the device through the console interface to maintain the device locally, configure the console
user interface including the physical attributes, terminal attributes, user level, and user authentication
mode. Users can set these parameters based on the site requirements or retain the default values.
The console user interface can also be used for logging in through the Mini USB interface; therefore, the
configured console user interface attributes take effect on the Mini USB interface.
Procedure
You can perform the configuration operations in any sequence.
Context
The physical attributes of the console user interface include the transmission rate, flow control
mode, parity bit, stop bit, and data bit of the console interface. To log in to the device using
the console interface, ensure that the attributes of the HyperTerminal are consistent with the
physical attributes of the device.
Procedure
Step 1 Run:
system-view
Step 7 Run:
databits { 5 | 6 | 7 | 8 }
Step 8 Run:
commit
----End
Context
Users can configure terminal attributes including the timeout disconnection function, number
of lines or columns on the terminal screen, and size of the history command buffer on the
console user interface.
Procedure
Step 1 Run:
system-view
Step 2 Run:
user-interface console interface-number
Step 3 Run:
idle-timeout minutes [ seconds ]
If no operation is performed on the device before the end of the timeout period, the terminal
disconnects from the device automatically.
Step 4 Run:
screen-length screen-length [ temporary ]
The temporary parameter specifies the temporary number of lines displayed on the terminal
screen.
Step 5 Run:
screen-width screen-width
The default number of columns displayed on the terminal screen is 80. Each character is a
column.
Step 6 Run:
history-command max-size size-value
Step 7 Run:
commit
----End
Context
l Users can be configured with different user levels to control the device access
permission, improving device security.
l User levels map command levels. A user can only run commands at the same or lower
level.
Procedure
Step 1 Run:
system-view
Step 2 Run:
user-interface console interface-number
Step 3 Run:
user privilege level level
Table 5-2 describes the mapping between user levels and command levels.
NOTE
l By default, the command level for the console port on the user interface is 15 when the command-
privilege level rearrange command is run, while is 3 when the command-privilege level
rearrange command is not run.
l If the command access level configured in the user interface view and user priority are inconsistent,
user priority takes precedence.
Step 4 Run:
commit
----End
Context
The console user interface provides AAA authentication, password authentication, and non-
authentication for login users.
Procedure
l Configuring AAA authentication
a. Run:
system-view
The authentication password is configured. You can enter a password in plain text
or cipher text.
NOTE
The password can be in plain text or cipher text. When the cipher password parameter is not
specified, enter the plain text password in interactive mode. When the cipher password
parameter is specified, enter either plain or cipher password. No matter which type of
password you enter, the password is saved in the configuration file in cipher text.
e. Run:
commit
NOTE
The non-authentication mode allows users to log in from the console port without
authentication. This mode cannot ensure system security. AAA or password authentication is
recommended to enhance system security.
d. Run:
commit
----End
Context
After configurations for the console user interface are complete, run the commands to check
the configurations.
Procedure
l Run the display users [ all ] command to view user information for the user interface.
l Run the display user-interface console ui-number [ summary ] command to view the
information about the user interface.
l Run the display aaa local-user command to view the local user list.
l Run the display aaa access-user command to view online users.
----End
Pre-configuration Tasks
Before configuring a VTY user interface, complete the following tasks:
l Log in to the device using a terminal.
NOTE
Parameters have default values with the exception of the ACL number that restricts the call-in and call-
out permissions on the VTY interface, authentication mode on the user interface, and user name and
password. You can set parameters based on the site requirements.
Procedure
You can perform the configuration operations in any sequence.
Context
Users can configure the maximum number of concurrent VTY user interfaces to control the
number of users who log in to the device at the same time. The number of VTY user
interfaces equals the total number of Telnet and SSH (STelnet) users.
Procedure
Step 1 Run:
system-view
NOTICE
When the maximum number of VTY user interfaces is set to 0, no user (including the NMS
user) can log in to the device using the VTY interface.
If the configured maximum number is smaller than the original, logged in users are not
affected and no additional configuration is needed.
After increasing the number of VTY user interfaces, you must configure the authentication
mode for new VTY users.
Step 3 Run:
commit
----End
Context
You can use the ACL to restrict login permissions on the VTY user interface. Before
configuring restrictions on login permissions on the VTY user interface, run the acl command
in the system view to create an ACL and enter the ACL view, and run the rule command to
add rules for accessing the ACL.
NOTE
l The user interface supports basic ACLs (2000-2999) and advanced ACLs (3000-3999).
l ACL rule:
l When permit is used in the ACL rule:
l If the ACL is applied in the inbound direction, other devices that match the ACL rule
can access the local device.
l If the ACL is applied in the outbound direction, the local device can access other devices
that match the ACL rule.
l When deny is used in the ACL rule:
l If the ACL is applied in the inbound direction, other devices that match the ACL rule
cannot access the local device.
l If the ACL is applied in the outbound direction, the local device cannot access other
devices that match the ACL rule.
l When the ACL rule is configured but packets from other devices do not match the rule:
l If the ACL is applied in the inbound direction, other devices cannot access the local
device.
l If the ACL is applied in the outbound direction, the local device cannot access other
devices.
l When the ACL contains no rule:
l If the ACL is applied in the inbound direction, any other devices can access the local
device.
l If the ACL is applied in the outbound direction, the local device can access any other
devices.
l For details on how to configure the ACL, see "ACL Configuration" in the CloudEngine
8800&7800&6800&5800 Series Switches Configuration Guide - Security.
Procedure
Step 1 Run:
system-view
Step 2 Run:
user-interface vty first-ui-number [ last-ui-number ]
Step 3 Run:
acl [ ipv6 ] { acl-number | acl-name } { inbound | outbound }
l To restrict users at a specified address or address segment from logging in to the device,
use the inbound parameter.
l To restrict users who have log in to a device from logging in to other devices, use the
outbound parameter.
Step 4 Run:
commit
----End
Context
Users can configure terminal attributes on the VTY user interface. These attributes include the
timeout disconnection function, number of lines on the terminal screen, and size of the history
command buffer.
Procedure
Step 1 Run:
system-view
Step 2 Run:
user-interface vty first-ui-number [ last-ui-number ]
Step 3 Run:
shell
Step 4 Run:
idle-timeout minutes [ seconds ]
If no operation is performed on the device before the end of the timeout period, the terminal
disconnects from the device automatically.
NOTE
If the idle timeout interval is set to 0 or a large value, the terminal will remain in the login state, resulting
in security risks. You are advised to run the lockcommand to lock the current connection.
Step 5 Run:
screen-length screen-length [ temporary ]
The temporary parameter specifies the temporary number of lines displayed on the terminal
screen.
Step 6 Run:
history-command max-size size-value
Step 7 Run:
commit
----End
Context
l Users can be configured with different user levels to control the device access
permission, improving device security.
l User levels map command levels. A user can only run commands at the same or lower
level.
Procedure
Step 1 Run:
system-view
Step 2 Run:
user-interface vty first-ui-number [ last-ui-number ]
Step 3 Run:
user privilege level level
Table 5-3 describes the mapping between user levels and command levels.
NOTE
l By default, users that log in to the device using the VTY interface can run commands at level 0.
l If the command access level configured in the user interface view and user priority are inconsistent,
user priority takes precedence.
Step 4 Run:
commit
----End
Context
The system provides AAA and password authentication modes to ensure device security.
Procedure
l Configuring AAA authentication
a. Run:
system-view
b. Run:
user-interface vty first-ui-number [ last-ui-number ]
The authentication password is configured. You can enter a password in plain text
or cipher text.
NOTE
The password can be in plain text or cipher text. When the cipher password parameter is not
specified, enter the plain text password in interactive mode. When the cipher password
parameter is specified, enter either plain or cipher password. No matter which type of
password you enter, the password is saved in the configuration file in cipher text.
e. Run:
commit
Procedure
Step 1 Run:
system-view
NOTE
In VTY access scenarios, IP addresses that fail to be authenticated will be blocked only when the
function of blocking IP addresses is enabled.
----End
Procedure
Step 1 Run:
system-view
----End
Procedure
l Run the display users [ all ] command to view user information for the user interface.
l Run the display user-interface maximum-vty command to view the maximum number
of VTY user interfaces.
l Run the display user-interface vty ui-number1 [ summary ] command to view the
information about the user interface.
l Run the display aaa local-user command to view the local user list.
l Run the display ssh server ip-block all command to check information about the IP
addresses of all the clients that fail to pass authentication.
l Run the display ssh server ip-block list command to check information about client IP
addresses that are locked because of authentication failures.
----End
In this example, the level of console users is 15. The password authentication mode and
authentication password Helloworld@6789 are configured for console users to log in to the
device.
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure the user level on the console user interface.
2. Configure the authentication mode and password on the console user interface.
Procedure
Step 1 Configure the user level on the console user interface.
<HUAWEI> system-view
[~HUAWEI] user-interface console 0
[~HUAWEI-ui-console0] user privilege level 15
Step 2 Configure the authentication mode and password on the console user interface.
[*HUAWEI-ui-console0] authentication-mode password
[*HUAWEI-ui-console0] set authentication password
Please configure the login password
(8-16)
Enter
Password:
Confirm Password:
[*HUAWEI-ui-console0] commit
[~HUAWEI-ui-console0] quit
After the console user interface is configured, users can use the console interface to log in to
the device in the password authentication mode to maintain the device locally. For details on
how to log in to the device see 6.2.1 Logging In to the Device Through a Console Port.
Step 3 Verify the configuration.
# Run the quit command to disconnect the terminal from the device, connect the terminal to
the device using a console cable, and verify that the new password is valid.
# Run the user-interface console 0 command to enter the console interface view, and run the
display this command to check the configurations on the console interface.
[~HUAWEI] user-interface console 0
[~HUAWEI-ui-console0] display this
#
user-interface con 0
authentication-mode password
set authentication password cipher $1c$g8wLJ`LjL!$CyE(V{3qg5DdU:PM[6=6O
$[Link],Q}>^)OBzgoU$
#
return
----End
Configuration File
#
user-interface con 0
authentication-mode password
set authentication password cipher $1c$g8wLJ`LjL!$CyE(V{3qg5DdU:PM[6=6O
$[Link],Q}>^)OBzgoU$
#
return
Networking Requirements
A user can use the VTY interface to log in to a remote device using Telnet. The device
administrator can configure the attributes of the VTY user interface to ensure device security.
In this example, the level of VTY users is 2. The password authentication mode and
authentication password Helloworld@6789 are configured for VTY users to log in to the
device. Only the user whose IP address is [Link] can log in to the device.
If a user logs in to the device and does not perform an operation within 30 minutes, the user's
terminal disconnects from the device.
Configuration Roadmap
The configuration roadmap is as follows:
Procedure
Step 1 Configure the maximum number of concurrent VTY user interfaces.
<HUAWEI> system-view
[~HUAWEI] user-interface maximum-vty 8
Step 2 Configure restrictions on call-in and call-out permissions on the VTY user interface.
[*HUAWEI] acl 2000
[*HUAWEI-acl4-basic-2000] rule permit source [Link] 0
[*HUAWEI-acl4-basic-2000] quit
[*HUAWEI] user-interface vty 0 7
[*HUAWEI-ui-vty0-7] acl 2000 inbound
Step 5 Configure the authentication mode and password of the VTY user interface.
[*HUAWEI-ui-vty0-7] authentication-mode password
[*HUAWEI-ui-vty0-7] set authentication password
Please configure the login password (8-16)
Enter Password:
Confirm Password:
[*HUAWEI-ui-vty0-7] commit
[~HUAWEI-ui-vty0-7] quit
After the VTY user interface is configured, users can log in to the device in the password
authentication mode using Telnet to maintain the device locally or remotely. For details on
how to log in to the device see 6.2.2 Logging In to the Device Through Telnet.
Step 6 Verify the configuration.
# Connect the terminal to the device using Telnet, and verify that the new password is valid.
# Use [Link] to log in to the device using Telnet. The login succeeds.
# Run the user-interface vty 0 7 command to enter the VTY interface view, and run the
display this command to check the configurations on the VTY interface.
[~HUAWEI] user-interface vty 0 7
[~HUAWEI-ui-vty0-7] display this
#
user-interface vty 0 7
acl 2000 inbound
authentication-mode password
user privilege level 2
set authentication password cipher $2a$JNWQ*Vz)SP$Cc>T80W$d8;&w2+
$KR.<A3f<9[}0t&No0V:o!o."$
history-command max-size 20
idle-timeout 30 0
screen-length 30
#
return
----End
Configuration File
#
acl number 2000
rule 5 permit source [Link] 0
#
user-interface maximum-vty 8
#
user-interface vty 0 7
acl 2000 inbound
authentication-mode password
user privilege level 2
set authentication password cipher $2a$JNWQ*Vz)SP$Cc>T80W$d8;&w2+
$KR.<A3f<9[}0t&No0V:o!o."$
history-command max-size 20
idle-timeout 30 0
screen-length 30
#
return
NOTE
The device has two systems: VRP system and open system. The dual systems run on the same Linux
OS. The open system uses the container mode to be isolated from the VRP system and communicates
with the VRP system through the virtual network. The VRP system and open system provide the
following functions:
l VRP system: manages all network interfaces of the device and provides secure high-performance
network channels through capabilities such as routing, security, AAA and VPN of the VRP
protocol stack.
l Open system: is the client of third-party software such as OMI, Puppet, and OpenFlow, is
connected to the VRP system through the virtual network, and provides standard NetConf and
OpenFlow interfaces of the VRP system for third-party software. After obtaining device
information, third-party software clients send information to corresponding servers.
This document applies to the VRP system unless otherwise specified. For details about how to log in to
the open system, see Open System Usage Guide.
To manage and maintain devices locally or remotely, a user needs to configure the user
interface, user management information, and terminal services before login.
l User interface: provides the login entry.
l User management information: ensures login security.
l Terminal services: support login protocols such as Telnet and Secure Shell Telnet
(STelnet).
A user can log in to the device in one of the modes describes in Table 6-1 to configure and
manage the device.
Logging Devices can The TCP A user connects a By default, a user cannot
In be managed protocol is terminal to the log in to the device
Throug and used to network, logs in to through Telnet. The user
h Telnet maintained transmit the device through needs to log in to the
locally or data in plain Telnet, and performs device through the
remotely. text, which local or remote console port from the
Each device brings configuration. This local host and configure
does not security cannot apply to the the following items:
need to be threats. network required for l Routes between the
connected to high security. terminal and device
a terminal, (Make sure that the
which route is reachable.
facilitates By default, no IP
user address is configured
operations. on the device.)
l Telnet server
functions and
parameters
l Telnet user login
interface
Logging The STelnet Configurati If the network has a By default, a user cannot
In protocol ons are high security log in to the device
Throug implements complicated requirement, a user directly through STelnet.
h secure . can log in to the The user needs to log in
STelnet remote device through to the device through the
logins on STelnet. STelnet console port from the
insecure based on the Secure local host or through
networks, Shell (SSH) protocol Telnet and configure the
which provides information following items:
ensures data security and l Routes between the
integrity and authentication, terminal and device
reliability which protects (Make sure that the
and devices against route is reachable.
guarantees attacks such as IP By default, no IP
secure data address spoofing. address is configured
transmission. on the device.)
l STelnet server
functions and
parameters
l SSH user login
interface
l SSH user
Console Port
A main control board provides one console port that conforms to the EIA/TIA-232 standard.
The console port is a Data Connection Equipment (DCE) port. The serial port on a user
terminal is directly connected to the console port on the device for login.
Telnet
In the TCP/IP protocol suite, the Telnet protocol is applied to the application layer. The Telnet
protocol provides remote login and virtual terminal functions through networks. The server/
client mode is used. The Telnet client sends a request to the Telnet server, which then provides
the Telnet service. The device supports the Telnet client and server functions.
As shown in Figure 6-1, SwitchA works as the Telnet server and provides the Telnet client
service, and SwitchB provides the Telnet server functions for SwitchA.
Telnet
Server
PC SwitchA SwitchB
STelnet
Telnet uses the TCP protocol to transmit plain text, which does not have a secure
authentication mode and is vulnerable to Denial of Service (DoS), IP address spoofing, and
route spoofing attacks.
Through STelnet based on SSH2.0, the client and server establish a secure connection through
negotiation, and the client can then log in to the server. SSH provides secure remote access on
an insecure network by supporting the following functions:
l Revest-Shamir-Adleman Algorithm (RSA) and Elliptic Curves Cryptography (ECC)
authentication: A key pair consisting of the public and private keys needs to be created
on the client, and the public key is sent to the server to which the client will log in. The
server compares the client public key carried in the packet with the locally configured
client public key. If the two public keys are inconsistent, the server disconnects from the
client. If they are consistent, the client continues using the private key in the local key
pair to perform digest algorithm, and sends the result (digital signature) to the server. The
server uses the preconfigured client public key to authenticate the digital signature.
l Data Encryption Standard (DES), 3DES, AES256, ARC4-128, ARC4-256, AES128-
CTR, AES256-CTR and AES128: AES is Advanced Encryption Standard. User names,
passwords, and transmitted data can be encrypted.
The device supports the SSH server functions and can connect to multiple SSH clients. The
device also supports the SSH client functions and allows users to establish SSH connections
to the SSH server and remotely log in to the server. When working as the SSH server, the
device supports SSH2.0 and SSH1.0. When working as the SSH client, the device only
supports SSH2.0.
SSH supports local connections and WAN connections.
l Local connection
As shown in Figure 6-2, an SSH channel can be established between the SSH client and
server for local connections.
l WAN connection
As shown in Figure 6-3, an SSH channel can be established between the SSH client and
server for WAN connections.
WAN
SSH Client PC
Pre-configuration Tasks
Before logging in to the device through a console port, complete the following tasks:
You can use the built-in terminal emulation software (such as the HyperTerminal of Windows
2000) on the PC. If no built-in terminal emulation software is available, use the third-party
terminal emulation software. For details, see the software user guide or online help. This section
uses the third-party software SecureCRT as an example.
Default Configuration
Stop bit 1
Data bit 8
Procedure
Step 1 Use the terminal simulation software to log in to the device through a console port.
1. Insert the DB9 connector of the console cable delivered with the product to the 9-pin
serial port on the PC, and insert the RJ45 connector to the console port of the device, as
shown in Figure 6-4.
ACT
L/A
ID
ETH
PAC-350WA-B ~100-240V;50/60Hz,5A FAN-40EA-B PWR1 FAN1 FAN2 PWR2 FAN-40EA-B PAC-350WA-B ~100-240V;50/60Hz,5A
DB-9
2. Start the terminal emulation software on the PC. Create a connection, select the
connected port, and set communication parameters.(This section uses the third-party
software SecureCRT as an example.)
b. Set the connected port and communication parameters, as shown in Figure 6-6.
Select the connected port based on actual situations. For example, you can view
port information in Device Manager in the Windows operating system, and select
the connected port.
Communication parameters of the terminal emulation software must be consistent
with the default attribute settings of the console user interface on the device, which
are 9600 bit/s baud rate, 8 data bits, 1 stop bit, no parity check, and no flow control.
NOTE
By default, no flow control mode is configured on the device. Because RTS/CTS is selected
in the software by default, you need to deselect RTS/CTS; otherwise, you cannot enter
commands.
NOTE
A PC may have multiple connection interfaces; therefore, the interface connected through the
console cable is selected in this example. Generally, COM1 is selected.
If the serial port communication parameters of the device are modified, modify the communication
parameters on the PC accordingly (ensure that the parameter values are the same) and re-establish
the connection.
3. Press Enter until the system prompts you to enter the password. (The system will
prompt you to enter the user name and password in AAA authentication. The following
information is only for reference.)
Login authentication
Password:
You can run commands to configure the device. Enter a question mark (?) whenever you
need help.
----End
Pre-configuration Tasks
Before logging in to the device through Telnet, complete the following task:
Configuration Process
NOTE
The Telnet protocol poses a security risk, and therefore the STelnet V2 mode is recommended.
This figure describes the tasks in the configuration process for login through Telnet. Tasks 1,
2, and 3 can be performed in any sequence.
Begin
Mandatory
Over
Optional
Default Configuration
Table 6-3 Default settings of the parameters for logging in to the device through Telnet
Procedure
l Configuring the Telnet server functions and parameters
Before connecting to the device through Telnet from a user terminal, make sure that the
Telnet service is enabled on the device.
Enable the Telnet undo telnet [ ipv6 ] server Upon factory delivery, the
service. disable Telnet server is disabled.
By default, no ACL is
configured for the Telnet server.
(Optional)
telnet [ ipv6 ] server acl { acl- An ACL is configured to
Configure an
number | acl-name } determine which clients can log
ACL.
in to the current device through
Telnet.
Configure the user level, call-in and call-out permission, and other basic attributes for the
VTY user interface.
By default, login
permissions are not
restricted.
(Optional) Configure For details, see (Optional) Configure this action to
restrictions on ACL-based Configuring Restrictions prevent a user with a
logins on the user on ACL-based Logins on certain address or address
interface. the VTY User Interface. segment from logging in to
the device or prevent a
user who has logged in to
the device from logging in
to another device.
local-user user-name
Configure the local user password irreversible-
-
name and password. cipher irreversible-cipher-
password
You can use Windows command line prompts or third-party software to log in to the
device through Telnet from a terminal. Windows command line prompts are used as an
example.
c. Press Enter and enter the password and the user name configured for the AAA
authentication mode in the login window. If authentication is successful, the
command-line prompt of the user view is displayed and you have successfully
logged in to the device. (The following information is only for reference.)
Username:admin1234
Password:
Info: The max number of VTY users is 8, the number of current VTY users
online is 1, and total number of terminal users online is 1.
The current login time is 2012-08-04 19:49:11.
First login successfully.
<Telnet Server>
----End
Pre-configuration Tasks
Before logging in to the device through STelnet, complete the following tasks:
Configuration Process
NOTE
The STelnet V1 protocol poses a security risk, and therefore the STelnet V2 mode is recommended.
Table 6-7 describes the tasks in the configuration process for login using STelnet.
Table 6-7 Tasks in the configuration process for login using STelnet
Default Configuration
Table 6-8 Default settings of the parameters for logging in to the device through STelnet
Interval for updating the SSH server key 0 hours, indicating that the key pair is never
pair updated.
Procedure
l Configuring the STelnet server functions and parameters
Enter the
system-view -
system view.
Method 1:
Run the rsa local-key-pair
create, dsa local-key-pair
create, or ecc local-key-pair
create command to generate a
local RSA, DSA, or ECC key
pair.
Method 2:
1. Run the rsa key-pair label
label-name [ modulus
modulus-bits ], dsa key-
pair label label-name In method 1:
[ modulus modulus-bits ], After the key pair is generated,
or ecc key-pair label label- you can run the display rsa local-
name [ modulus modulus- key-pair public, display dsa
bits ] command to generate local-key-pair public, or display
an RSA, a DSA, or an ECC ecc local-key-pair public
key pair with a specific command to view the public key
label name. in the local RSA, DSA, or ECC
2. Run the ssh server assign key pair.
{ rsa-host-key | dsa-host- In method 2:
key | ecc-host-key } label- After the key pair is generated,
Generate a
name command to assign you can run the display rsa key-
local key pair.
the generated RSA host key, pair [ brief | label label-name ],
RSA server key, DSA host display dsa key-pair [ brief |
key, or ECC host key to the label label-name ], or display ecc
SSH server. key-pair [ brief | label label-
NOTE name ] command to view the
l The device can generate a RSA, DSA, or ECC key pair with
maximum of 20 key pairs in a specific label.
method 2. You can use
NOTE
different key pairs in different
Because a longer key pair provides
periods to ensure higher
higher security, you are advised to
communication security. The
use key pairs of the largest length.
maximum number of key pairs
the device can generate is
specified by the rsa key-pair
maximum, dsa key-pair
maximum, and ecc key-pair
maximum commands.
l You can also run the rsa key-
pair label load private
private-key public public-key
or dsa key-pair label load
private private-key public
public-key command to load
the local RSA or DSA key
pair file to the server.
(Optional)
Enable the
compatibility By default, the server's
ssh server compatible-ssh1x
with SSH compatibility with earlier versions
enable
protocols of is disabled.
earlier
versions.
(Optional)
Configure
alarm
generation and By default, an alarm is generated
ssh server login-failed
clearance if the number of login failures
threshold-alarm upper-limit
thresholds for reaches 30 within 5 minutes and is
report-times lower-limit
the number of cleared if the number of login
resume-times period period-
SSH server failures falls below 20 within the
time
login failures same period.
within a
specified
period.
Commit the
commit -
configuration.
– When the local RSA key pair is generated, two key pairs (a server key pair and a
host key pair) are generated at the same time. Each key pair contains a public key
and a private key. The length of the two key pairs ranges from 512 bits to 2048 bits.
The default length is 2048 bits.
– When the local DSA key pair is generated, only the host key pair is generated. The
length of the host key pair can be 512, 1024, or 2048 bits. The default length is
2048 bits.
– When the local ECC key pair is generated, only the host key pair is generated. The
length of the host key pair can be 256, 384, or 521 bits. The default length is 521
bits.
l Configuring the SSH user login interface
Configure the VTY user interface for login to support the SSH protocol before logging in
to the device through SSH.
By default, no authentication
mode is used on the VTY user
interface.
Configure the AAA To configure the VTY user
authentication mode interface to support SSH,
authentication-mode aaa configure the AAA
for the VTY user
interface. authentication mode for the
VTY user interface. If the AAA
authentication mode is not set,
the protocol inbound ssh
command does not take effect.
Commit the
commit -
configuration.
By default, no service
Configure the SSH ssh user user-name service-type
type is configured for
user service type. { stelnet | all }
an SSH user.
Commit the
commit -
configuration.
local-user user-name
Configure the local user password irreversible-
-
name and password. cipher irreversible-cipher-
password
By default, the
authentication type for the
SSH connection is AAA.
When the authentication
type is AAA, only the
password authentication
mode can be configured. If
the public key
authentication mode is
Configure the used, perform either of the
ssh authorization-type following operations to
authentication type for the
default root implement successful
SSH connection.
login of the SSH user:
l Run this command to
set the authentication
type for the SSH
connection to root.
l In the AAA view,
create a local user with
the same name as the
SSH user.
# Click Open. Enter the user name and password at the prompt, and press Enter. You
have logged in to the SSH server. (The following information is only for reference.)
login as: client001
Sent username "client001"
client001@[Link]'s password:
Info: The max number of VTY users is 21, the number of current VTY users
online is 2, and total number of terminal users online is 2.
The current login time is 2012-08-04 20:09:11+00:00.
First login successfully.
<SSH Server>
----End
l Run the display ssh server status command to check the global SSH server
configuration.
l Run the display ssh server session command to check the sessions connected to the
SSH client on the SSH server.
After you run the lock command, the system prompts you to enter the lock
password and confirm password. If the two passwords are the same, the current
interface is locked successfully.
To unlock the user interface, you must press Enter and enter the correct login
password as prompted.
Configuration Process
NOTE
The Telnet protocol poses a security risk, and therefore the STelnet V2 protocol is recommended.
Table 6-14 describes the tasks in the process of configuring the device as the Telnet client to
log in to another device.
Table 6-14 Tasks in the process of configuring the device as the Telnet client to log in to
another device
No. Task Description Remarks
Procedure
1. (Optional) Configure Telnet client parameters.
Commit the
commit -
configuration.
Pre-configuration Tasks
Before configuring the device as the STelnet client to log in to another device, complete the
following tasks:
Configuration Process
NOTE
The STelnet V1 protocol poses a security risk, and therefore the STelnet V2 mode is recommended.
Table 6-17 describes the tasks in the process of configuring the device as the STelnet client to
log in to another device.
Table 6-17 Tasks in the process of configuring the device as the STelnet client to log in to
another device
No. Task Description Remarks
Default Configuration
Table 6-18 Default values for configuring the device as the STelnet client to log in to another
device
Parameter Default Setting
Procedure
l Generating a local key pair
NOTE
Perform this step only when the device logs in to the SSH server in RSA, DSA, or ECC
authentication mode, not the password authentication mode.
Commit the
commit -
configuration.
l Configuring the mode for connecting the device to the SSH server for the first time
If the public key of the SSH server has not been saved on the client, the system cannot
check SSH server validity when the device that works as the client connects to the SSH
server for the first time. The connection fails. Perform one of the following operations:
– Enabling the first authentication mode on the SSH client: The system does not
check the public key of the SSH server, which ensures that the first connection is
successful. The system then assigns and saves the public key for subsequent
authentication. For details, see Table 6-20. This configuration method is simple.
– Configuring the SSH client to assign a public key to the SSH server. The public key
generated on the server is saved on the client, which ensures that the SSH server
validity check is successful for the first connection. For details, see Table 6-21.
This configuration method is complex but has high security.
Select either of the preceding configuration method as required.
Table 6-20 Actions for enabling first authentication for the SSH client
Action Command Description
Enable first
By default, first authentication is
authentication on ssh client first-time enable
disabled on the SSH client.
the SSH client.
Commit the
commit -
configuration.
Table 6-21 Actions for configuring the SSH client to assign the RSA, DSA, or ECC
public key to the SSH server
Action Command Description
Return to the
peer-public-key end -
system view.
Commit the
commit -
configuration.
Commit the
commit -
configuration.
----End
PC Switch
Configuration Roadmap
The configuration roadmap is as follows:
1. Use the terminal simulation software to log in to the device through a console port.
2. Configure the authentication mode of the console user interface.
NOTE
You can use the built-in terminal emulation software (such as the HyperTerminal of Windows 2000) on
the PC. If no built-in terminal emulation software is available, use the third-party terminal emulation
software. For details, see the software user guide or online help. This section uses the third-party
software SecureCRT as an example.
Procedure
Step 1 Use the terminal simulation software to log in to the device through a console port.
1. Insert the DB9 connector of the console cable delivered with the product to the 9-pin
serial port on the PC, and insert the RJ45 connector to the console port of the device, as
shown in Figure 6-9.
ACT
L/A
ID
ETH
PAC-350WA-B ~100-240V;50/60Hz,5A FAN-40EA-B PWR1 FAN1 FAN2 PWR2 FAN-40EA-B PAC-350WA-B ~100-240V;50/60Hz,5A
DB-9
2. Start the terminal emulation software on the PC. Create a connection, select the
connected port, and set communication parameters.(This section uses the third-party
software SecureCRT as an example.)
b. Set the connected port and communication parameters, as shown in Figure 6-11.
Select the connected port based on actual situations. For example, you can view
port information in Device Manager in the Windows operating system, and select
the connected port.
Communication parameters of the terminal emulation software must be consistent
with the default attribute settings of the console user interface on the device, which
are 9600 bit/s baud rate, 8 data bits, 1 stop bit, no parity check, and no flow control.
NOTE
By default, no flow control mode is configured on the device. Because RTS/CTS is selected
in the software by default, you need to deselect RTS/CTS; otherwise, you cannot enter
commands.
NOTE
A PC may have multiple connection interfaces; therefore, the interface connected through the
console cable is selected in this example. Generally, COM1 is selected.
If the serial port communication parameters of the device are modified, modify the communication
parameters on the PC accordingly (ensure that the parameter values are the same) and re-establish
the connection.
3. Press Enter until the system prompts you to enter the password. (The system will
prompt you to enter the user name and password in AAA authentication. The following
information is only for reference.)
Login authentication
Password:
You can run commands to configure the device. Enter a question mark (?) whenever you
need help.
Step 2 Configure the authentication mode of the console user interface.
<HUAWEI> system-view
[~HUAWEI] user-interface console 0
[*HUAWEI-ui-console0] authentication-mode aaa
[*HUAWEI-ui-console0] user privilege level 15
[*HUAWEI-ui-console0] quit
[*HUAWEI] aaa
[*HUAWEI-aaa] local-user admin1234 password irreversible-cipher Helloworld@6789
[*HUAWEI-aaa] local-user admin1234 level 3
[*HUAWEI-aaa] local-user admin1234 service-type terminal
[*HUAWEI-aaa] commit
After the preceding operations, you can re-log in to the device on the console user interface
only by entering the user name admin1234 and password Helloworld@6789.
----End
Configuration Files
#
aaa
local-user admin1234 password irreversible-cipher $1c$g8wLJ`LjL!
$CyE(V{3qg5DdU:PM[6=6O$[Link],Q}>^)OBzgoU$
local-user admin1234 service-type terminal
local-user admin1234 level 3
#
user-interface con 0
authentication-mode aaa
#
return
[Link]/32 [Link]/24
PC1
PC2
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure the Telnet login mode to implement remote network device maintenance.
2. Configure the administrator's user name and password and the AAA authentication mode
to ensure that only users passing the authentication can log in to the device.
3. Configure a security policy to ensure that only users in compliance with the security
policy can log in to the device.
Procedure
Step 1 Set the server listening port number and enable the server function.
<HUAWEI> system-view
[~HUAWEI] sysname Telnet Server
[*HUAWEI] commit
[~Telnet Server] undo telnet server disable
# Set the IP address of the device to which the user is allowed to log in.
[*Telnet Server] acl 2001
[*Telnet Server-acl4-basic-2001] rule permit source [Link] 32
[*Telnet Server-acl4-basic-2001] rule deny source [Link] 32
[*Telnet Server-acl4-basic-2001] quit
[*Telnet Server] user-interface vty 0 7
[*Telnet Server-ui-vty0-7] acl 2001 inbound
Press Enter, and enter the user name and password in the login window. If the authentication
is successful, the command line prompt of the user view is displayed. The user view
configuration environment is displayed.
Username:admin1234
Password:
Info: The max number of VTY users is 8, the number of current VTY users online is
1, and total number of terminal users online is 1.
The current login time is 2012-08-04 19:49:11.
First login successfully.
<Telnet Server>
----End
Configuration Files
Telnet server configuration file
#
sysname Telnet Server
#
telnet server port 1025
#
acl number 2001
rule 5 permit source [Link] 0
rule 10 deny source [Link] 0
#
aaa
local-user admin1234 password irreversible-cipher $1c$g8wLJ`LjL!
$CyE(V{3qg5DdU:PM[6=6O$[Link],Q}>^)OBzgoU$
local-user admin1234 service-type telnet
local-user admin1234 level 3
#
user-interface maximum-vty 8
#
user-interface vty 0 7
acl 2001 inbound
authentication-mode aaa
history-command max-size 20
idle-timeout 20 0
screen-length 30
#
return
[Link]/24
PC1 [Link]/24
[Link]/24
PC2
SSH Server
[Link]/24
PC3
Configuration Roadmap
The configuration roadmap is as follows:
1. Install the SSH server software on PC1. Install the key pair generation software, public
key conversion software, and SSH server login software on PC2.
2. Generate a local key pair on the SSH server to implement secure data exchange between
the server and client.
3. Configure different authentication modes for the SSH users client001 and client002 on
the SSH server.
4. Enable the STelnet service on the SSH server.
5. Configure a security policy to ensure that only PC1 and PC2 can be used to log in to the
device.
6. Configure the STelnet server type for the SSH users client001 and client002 on the SSH
server.
7. Log in to the SSH server as the client001 and client002 users through STelnet.
Procedure
Step 1 Generate a local key pair on the server.
<HUAWEI> system-view
[~HUAWEI] sysname SSH Server
[*HUAWEI] commit
[~SSH Server] rsa local-key-pair create
The key name will be: SSH Server_Host
The range of public key size is (2048 ~ 2048).
NOTE: Key pair generation will take a short while.
There are eight authentication modes for an SSH user: password, RSA, password-RSA, DSA, password-
DSA, ECC, password-ECC, and all.
After the key is generated, click Save public key to save the key in the [Link]
file.
Click Save private key. The PuTTYgen Warning dialog box is displayed. Click
Yes. The private key is saved in the [Link] file.
b. Run [Link] on the client. Convert the generated public key to the character
string required for the device.
Open the [Link] file required by SSH that is generated in the previous step.
Click Convert(C). You can see the public keys before and after conversion.
# Enter the RSA public key generated on PC2 to the SSH server.
[~SSH Server] ssh authorization-type default root
[*SSH Server] rsa peer-public-key rsakey001
[SSH Server] rsa peer-public-key rsakey001
[SSH Server] rsa peer-public-key rsakey001
[*SSH Server-rsa-public-key] public-key-code begin
[*SSH Server-rsa-public-key-rsa-key-code] 30820108 02820101 00DD8904 1A5E30AA
976F384B 5DB366A7
[*SSH Server-rsa-public-key-rsa-key-code] 048C0E79 06EC6B08 8BB9567D 75914B5B
4EA7B2E5 1938D118
[*SSH Server-rsa-public-key-rsa-key-code] 4B863A38 BA7E0F0D BE5C5AE4 CA55B192
B531AC48 B07D21E3
[*SSH Server-rsa-public-key-rsa-key-code] 62E3F2A5 8C04C443 CF51CF51 136B5B9E
812AB1B7 1250EB24
[*SSH Server-rsa-public-key-rsa-key-code] A4AE5083 A1DB18EC E2395C9B B806E8F0
0BE24FB5 16958784
[*SSH Server-rsa-public-key-rsa-key-code] 403B617F 8AAAB1F8 C6DE8C3C F09E4D23
7D1C17BF 4AAF09C4
[*SSH Server-rsa-public-key-rsa-key-code] 74C083AF 17CD3075 3396B322 32C57FF0
B1991971 02F1033B
[*SSH Server-rsa-public-key-rsa-key-code] 81AA6D47 44520F23 685FAF72 04BA4B6E
615EF224 14E64E2A
# Bind the RSA public key of the STelnet client to the SSH user client002 on the SSH
server.
[*SSH Server] ssh user client002 assign rsa-key rsakey001
Step 4 Configure a security policy to ensure that only PC1 and PC2 can be used to log in to the
device.
[*SSH Server] acl 2001
[*SSH Server-acl4-basic-2001] rule permit source [Link] 32
[*SSH Server-acl4-basic-2001] rule permit source [Link] 32
[*SSH Server-acl4-basic-2001] rule deny source [Link] 32
[*SSH Server-acl4-basic-2001] quit
[*SSH Server] ssh server acl 2001
Step 5 Configure the STelnet service type for the client001 and client002 users.
[*SSH Server] ssh user client001 service-type stelnet
[*SSH Server] ssh user client002 service-type stelnet
[*SSH Server] commit
# Click Open. Enter the user name and password at the prompt, and press Enter. You
have logged in to the SSH server.
login as: client001
Sent username "client001"
client001@[Link]'s password:
Info: The max number of VTY users is 21, the number of current VTY users
online is 2, and total number of terminal users online is 2.
The current login time is 2012-08-04 20:09:11+00:00.
First login successfully.
<SSH Server>
l Log in to the SSH server as the client002 user from PC2 using the RSA authentication
mode.
# Use the PuTTY software to log in to the device, enter the device IP address, and select
the SSH protocol type.
# Choose Connection > SSH in the navigation tree. The page shown in Figure 6-21 is
displayed. Select 2 for Preferred SSH protocol version
# Choose Connection > SSH > Auth in the navigation tree. The page shown in Figure
6-22 is displayed. Select the [Link] file corresponding to the public key configured
on the server.
# Click Open. Enter the user name at the prompt, and press Enter. You have logged in
to the SSH server.
login as: client002
Authenticating with public key "rsa-key"
Info: The max number of VTY users is 21, the number of current VTY users
online is 2, and total number of terminal users online is 2.
The current login time is 2012-08-06 04:30:23+00:00.
First login successfully.
<SSH Server>
----End
Configuration Files
SSH server configuration file
#
sysname SSH Server
#
rsa peer-public-key rsakey001
public-key-code begin
30820108
02820101
00DD8904 1A5E30AA 976F384B 5DB366A7 048C0E79 06EC6B08 8BB9567D 75914B5B
4EA7B2E5 1938D118 4B863A38 BA7E0F0D BE5C5AE4 CA55B192 B531AC48 B07D21E3
62E3F2A5 8C04C443 CF51CF51 136B5B9E 812AB1B7 1250EB24 A4AE5083 A1DB18EC
E2395C9B B806E8F0 0BE24FB5 16958784 403B617F 8AAAB1F8 C6DE8C3C F09E4D23
7D1C17BF 4AAF09C4 74C083AF 17CD3075 3396B322 32C57FF0 B1991971 02F1033B
81AA6D47 44520F23 685FAF72 04BA4B6E 615EF224 14E64E2A 331EEB7F 188D9805
96DBFD30 0C947A5A BA879DC4 F848B769 513C35CD B52B2917 02B77693 F79910EE
5287F252 977F985E 5F186C94 93F26780 4E7F5F9D 5287350A 0A4F4988 1BF6AB7C
1B
0201
25
public-key-code end
peer-public-key end
#
acl number 2001
rule 5 permit source [Link] 0
rule 10 permit source [Link] 0
rule 15 deny source [Link] 0
#
aaa
local-user client001 password irreversible-cipher $1c$-3P&"H{'b'$({Ak~<"{gM<C
$COLj\+R_yeo:|PaFRQh-r6OTch*$
local-user client001 service-type ssh
local-user client001 level 3
#
stelnet server enable
ssh server acl 2001
ssh user client001
ssh user client001 authentication-type password
ssh user client001 service-type stelnet
ssh user client002
ssh user client002 authentication-type rsa
ssh user client002 assign rsa-key rsakey001
ssh user client002 service-type stelnet
ssh authorization-type default root
#
user-interface vty 0 4
authentication-mode aaa
protocol inbound ssh
#
return
Figure 6-23 Networking diagram of configuring the device as the Telnet client to log in to
another device
Session Session
[Link]/24 [Link]/24
Network Network
PC Switch1 Switch2
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure the Telnet authentication mode and password on Switch2.
2. Configure the Switch2 to allow Switch1 access with ACL.
3. Log in to Switch2 from Switch1 through Telnet.
Procedure
Step 1 Configure the Telnet authentication mode and password on Switch2.
<HUAWEI> system-view
[~HUAWEI] sysname Switch2
[*HUAWEI] commit
[~Switch2] user-interface vty 0 4
[*Switch2-ui-vty0-4] user privilege level 3
[*Switch2-ui-vty0-4] authentication-mode aaa
[*Switch2-ui-vty0-4] quit
NOTE
----End
Configuration Files
Switch2 configuration file
#
sysname Switch2
#
acl number 2000
rule 5 permit source [Link] 0
#
aaa
local-user admin1234 password irreversible-cipher $1c$g8wLJ`LjL!
$CyE(V{3qg5DdU:PM[6=6O$[Link],Q}>^)OBzgoU$
local-user admin1234 level 3
local-user admin1234 service-type telnet
#
user-interface vty 0 4
acl 2000 inbound
authentication-mode aaa
user privilege level 3
#
return
[Link]/16
HUB
[Link]/16 [Link]/16
Client001 Client002
Configuration Roadmap
The configuration roadmap is as follows:
1. Generate a local key pair on the SSH server to implement secure data exchange between
the server and client.
2. Configure different authentication modes for the SSH users client001 and client002 on
the SSH server.
3. Enable the STelnet service on the SSH server.
4. Configure the STelnet server type for the SSH users client001 and client002 on the SSH
server.
5. Set the SSH server listening port number on the SSH server to prevent attackers from
accessing the SSH service standard port and ensure security.
6. Log in to the SSH server as the client001 and client002 users through STelnet.
Procedure
Step 1 Generate a local key pair on the server.
<HUAWEI> system-view
[~HUAWEI] sysname SSH Server
[*HUAWEI] commit
[~SSH Server] rsa local-key-pair create
The key name will be: SSH Server_Host
The range of public key size is (2048 ~ 2048).
NOTE: Key pair generation will take a short while.
There are eight authentication modes for an SSH user: password, RSA, password-RSA, DSA, password-
DSA, ECC, password-ECC, and all.
# Check the public key in the RSA key pair generated on the client.
[~client002] display rsa local-key-pair public
======================Host key==========================
Time of key pair created : 2014-03-03 08:56:38
Key name : client002_Host
Key type : RSA encryption key
========================================================
Key code:
3082010A
02820101
00A4BAB8 B964077E F7657F7F E4BE1DE8 71EE1707
E4EE2864 2D06FBE0 BFC1CB52 F99B7A99 0132B709
3F841CA2 3544B8B2 6EE0A9ED 04B19FE3 FB3DA86D
BE68FFE2 2303108D BDC24B80 A1793A08 FDA0B6C1
13C31EA5 298EC9B1 2B0BC8BD 32CFF896 29F8CA98
8B1724AF 5DA8A390 20906ADE 6A8AD77D 6234F0C8
DC965BA0 1771D9C0 A89ED49B 5ECF7EE2 D5997527
FC87FE03 E51658C1 0996DFDF DC456376 2FA4B268
4345131D 431419D2 DD5E4003 6A7D3295 145F3175
22E80686 E6B39A05 799D6BCF A78F69B6 BC2D0836
F5013421 77D68B89 A9EC182A 04B87BE3 500FCE14
9C95CF78 75704359 0C70FD60 1EFC0B99 32F02142
4CE781E4 36A60BFC 2CBD07F6 9E700CEE 4D
0203
010001
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkuri5ZAd+92V/f+S+Hehx7hcH5O4oZC0G++C/
wctS+Zt6mQEytwk/hByiNUS4sm7gqe0EsZ/j+z2obb5o/
+IjAxCNvcJLgKF5Ogj9oLbBE8MepSmOybErC8i9Ms/
4lin4ypiLFySvXaijkCCQat5qitd9YjTwyNyWW6AXcdnAqJ7Um17PfuLVmXUn/If+A+UWWMEJlt/
f3EVjdi
+ksmhDRRMdQxQZ0t1eQANqfTKVFF8xdSLoBobms5oFeZ1rz6ePaba8LQg29QE0IXfWi4mp7BgqBLh7
41APzhSclc94dXBDWQxw/WAe/AuZMvAhQkzngeQ2pgv8LL0H9p5wDO5N rsa-key
======================Server key========================
Time of key pair created : 2014-03-03 08:56:39
Key name : client002_Server
Key type : RSA encryption key
========================================================
Key code:
3081B9
0281B1
00B9AE42 B8419F19 35C49A7B A55DBB6F 67D931F3
9C19ECF9 9E17961B D01ED5DD 3AE68CFA 38C57113
C93663F2 86768B19 AD0F603E 98F2C6AB A71A6C26
8813411D 4AA56BC4 6505EC15 94647621 AB7D03BB
79DA9B24 09BB1FD2 3927E2F9 00F79116 466411CD
AC3D8FF6 A051FA5A 9BCE84CE 20842134 D2D27B4A
219CB801 9F5A90E0 518DEEFC F48F5ED4 49215B1F
11E1AC81 5E168A97 3AA5320D 7B158556 AF5CC95C
9B508BBC 6EEFEEF9 0E23AA13 59E1F746 D5
0203
010001
# Configure the RSA public key on the SSH server. (Information in bold in the display
command output is the RSA public key. Copy the information to the server.)
[~SSH Server] rsa peer-public-key rsakey001
[*SSH Server-rsa-public-key] public-key-code begin
[*SSH Server-rsa-public-key-rsa-key-code] 3082010A
[*SSH Server-rsa-public-key-rsa-key-code] 2820101
[*SSH Server-rsa-public-key-rsa-key-code] 00A4BAB8 B964077E F7657F7F E4BE1DE8
71EE1707
[*SSH Server-rsa-public-key-rsa-key-code] E4EE2864 2D06FBE0 BFC1CB52 F99B7A99
0132B709
[*SSH Server-rsa-public-key-rsa-key-code] 3F841CA2 3544B8B2 6EE0A9ED 04B19FE3
FB3DA86D
[*SSH Server-rsa-public-key-rsa-key-code] BE68FFE2 2303108D BDC24B80 A1793A08
FDA0B6C1
[*SSH Server-rsa-public-key-rsa-key-code] 13C31EA5 298EC9B1 2B0BC8BD 32CFF896
29F8CA98
[*SSH Server-rsa-public-key-rsa-key-code] 8B1724AF 5DA8A390 20906ADE 6A8AD77D
6234F0C8
[*SSH Server-rsa-public-key-rsa-key-code] DC965BA0 1771D9C0 A89ED49B 5ECF7EE2
D5997527
[*SSH Server-rsa-public-key-rsa-key-code] FC87FE03 E51658C1 0996DFDF DC456376
2FA4B268
[*SSH Server-rsa-public-key-rsa-key-code] 4345131D 431419D2 DD5E4003 6A7D3295
145F3175
[*SSH Server-rsa-public-key-rsa-key-code] 22E80686 E6B39A05 799D6BCF A78F69B6
BC2D0836
[*SSH Server-rsa-public-key-rsa-key-code] F5013421 77D68B89 A9EC182A 04B87BE3
500FCE14
[*SSH Server-rsa-public-key-rsa-key-code] 9C95CF78 75704359 0C70FD60 1EFC0B99
32F02142
# Bind the RSA public key of the STelnet client to the SSH user client002 on the SSH
server.
[*SSH Server] ssh user client002 assign rsa-key rsakey001
Step 4 Configure the STelnet service type for the client001 and client002 users.
[*SSH Server] ssh user client001 service-type stelnet
[*SSH Server] ssh user client002 service-type stelnet
# Log in to the SSH server from Client001 in password authentication mode by entering the
user name and password.
<client001> stelnet [Link] 1025
Trying [Link] ...
Press CTRL+K to abort
Connected to [Link] ...
The server's public key does not match the one cached before.
The server is not authenticated. Continue to access it?[Y/N]:y
The keyname:[Link] already exists. Update it? [Y/N]:n
Enter the password. The following information indicates that you have logged in successfully:
Warning: The initial password poses security risks.
The password needs to be changed. Change now? [Y/N]:n
Info: The max number of VTY users is 21, the number of current VTY users online
is 4, and total number of terminal users online is 4.
The current login time is 2013-12-31 11:22:06.
The last login time is 2013-12-31 10:24:13 from [Link] through SSH.
<SSH Server>
Info: The max number of VTY users is 21, the number of current VTY users online
is 4, and total number of terminal users online is 4.
The current login time is 2013-12-31 11:36:06.
<SSH Server>
If the user view is displayed, you have logged in successfully. If the message "Session is
disconnected" is displayed, the login fails.
Step 7 Verify the configuration.
Attackers fail to log in to the SSH server using the default listening port number 22.
<client002> stelnet [Link]
Trying [Link] ...
Press CTRL+K to abort
Error: Failed to connect to the remote host.
Run the display ssh server status commands. You can see that the STelnet service has been
enabled. Run the display ssh user-information command. Information about the configured
SSH users is displayed.
# Check the status of the SSH server.
[~SSH Server] display ssh server status
SSH Version : 2.0
SSH authentication timeout (Seconds) : 60
SSH authentication retries (Times) : 3
SSH server key generating interval (Hours) : 0
SSH version 1.x compatibility : Disable
SSH server keepalive : Enable
SFTP server : Enable
STelnet server : Enable
SNETCONF server : Disable
SNETCONF server port(830) : Enable
SCP server : Disable
SSH server DES : Disable
SSH server port : 1025
ACL name : --
ACL number : --
ACL6 name : --
ACL6 number : --
SSH server source address : [Link]
----End
Configuration Files
l SSH server configuration file
#
sysname SSH Server
#
rsa peer-public-key rsakey001
public-key-code begin
3082010A
02820101
00A4BAB8 B964077E F7657F7F E4BE1DE8 71EE1707 E4EE2864 2D06FBE0 BFC1CB52
F99B7A99 0132B709 3F841CA2 3544B8B2 6EE0A9ED 04B19FE3 FB3DA86D BE68FFE2
2303108D BDC24B80 A1793A08 FDA0B6C1 13C31EA5 298EC9B1 2B0BC8BD 32CFF896
29F8CA98 8B1724AF 5DA8A390 20906ADE 6A8AD77D 6234F0C8 DC965BA0 1771D9C0
A89ED49B 5ECF7EE2 D5997527 FC87FE03 E51658C1 0996DFDF DC456376 2FA4B268
4345131D 431419D2 DD5E4003 6A7D3295 145F3175 22E80686 E6B39A05 799D6BCF
A78F69B6 BC2D0836 F5013421 77D68B89 A9EC182A 04B87BE3 500FCE14 9C95CF78
75704359 0C70FD60 1EFC0B99 32F02142 4CE781E4 36A60BFC 2CBD07F6 9E700CEE
4D
0203
010001
public-key-code end
peer-public-key end
#
aaa
local-user client001 password irreversible-cipher $1a$v!=.5/:(q-$xL=\K
+if"'S}>k7vGP5$_ox0B@ys7.'DBHL~3*aN$
local-user client001 service-type ssh
local-user client001 level 3
#
ssh server port 1025
stelnet server enable
ssh user client001
ssh user client001 authentication-type password
ssh user client001 service-type stelnet
ssh user client002
ssh user client002 authentication-type rsa
ssh user client002 assign rsa-key rsakey001
ssh user client002 service-type stelnet
#
user-interface vty 0 4
authentication-mode aaa
protocol inbound ssh
#
return
#
sysname client002
#
ssh client first-time enable
#
return
Fault Description
The Telnet server fails to be logged in through Telnet.
Procedure
Step 1 Check whether the number of users who have logged in to the Telnet server reaches the upper
limit.
Log in to the device through a console port. Run the display users command to check
whether the current VTY channel is completely occupied. By default, a maximum number of
five VTY channels are allowed. You can run the display user-interface maximum-vty
command to check the maximum number of users allowed in the current VTY channel.
If the number of current users has reached the upper limit, run the user-interface maximum-
vty 21 command to increase the maximum number of users allowed in the VTY channel to
21.
Step 2 Check whether an ACL has been configured on the VTY user interface of the device.
Run the user-interface vty command on the Telnet server to display the user interface view.
Run the display this command to check whether an ACL has been configured on the VTY
user interface. If yes, record the ACL number.
Run the display acl acl-number command on the Telnet server to check whether the Telnet
client IP address is denied in the ACL. If yes, run the undo rule rule-id command in the ACL
view to delete the deny rule, and then run the rule permit source source-ip-address soucer-
wildcard command in the ACL view to permit the client IP address.
Step 3 Check the protocol configuration in the VTY user interface view.
Run the user-interface vty command on the Telnet server to display the user interface view.
Run the display this command to check whether protocol inbound on the VTY user
interface is set to telnet or all(By default, the system supports all protocols). If no, run the
protocol inbound { telnet | all } command to enable Telnet users to connect to the device.
Step 4 Check whether login authentication is configured in the VTY user interface view.
l If the password authentication mode for login is configured in the VTY channel using
the authentication-mode password command, you must enter the password upon login.
----End
Procedure
Step 1 Check whether the SSH service is enabled on the SSH server.
Log in to the SSH server through the console port or using Telnet. Run the display ssh server
status command to check the SSH server configuration.
If the STelnet service is disabled, run the stelnet server enable command to enable the
STelnet service on the SSH server.
Step 2 Check the protocol configuration in the VTY user interface view on the SSH server.
Run the user-interface vty command on the SSH server to display the user interface view.
Run the display this command to check whether protocol inbound on the VTY user
interface is set to ssh or all(By default, the system supports all protocols). If no, run the
protocol inbound { ssh | all } command to enable STelnet users to connect to the device.
Step 3 Check whether an SSH user is configured on the SSH server.
Run the display ssh user-information command to view the configuration of the SSH user. If
there is no configuration, run the ssh user, ssh user authentication-type, ssh user service-
type commands in the system view to create an SSH user and configure the SSH user
authentication mode and service type.
Step 4 Check whether the number of users who have logged in to the SSH server reaches the upper
limit.
Log in to the device through a console port. Run the display users command to check
whether the current VTY channel is completely occupied. By default, a maximum number of
five VTY channels are allowed. You can run the display user-interface maximum-vty
command to check the maximum number of users allowed in the current VTY channel.
If the number of current users has reached the upper limit, run the user-interface maximum-
vty 21 command to increase the maximum number of users allowed in the VTY channel to
21.
Step 5 Check whether an ACL is configured on the user interface of the SSH server.
Run the user-interface vty command on the SSH server to display the SSH user interface
view. Run the display this command to check whether an ACL has been configured on the
VTY user interface. If yes, record the ACL number.
Run the display acl acl-number command on the SSH server to check whether the SSH client
IP address is denied in the ACL. If yes, run the undo rule rule-id command in the ACL view
to delete the deny rule, and then run the rule permit source source-ip-address soucer-
wildcard command in the ACL view to permit the client IP address.
Step 6 Check the SSH version on the SSH client and server.
Run the display ssh server status command on the SSH server to check the SSH version.
If the version is SSHv1, run the ssh server compatible-ssh1x enable command to configure
the version compatibility function on the server.
Step 7 Check whether the first authentication function is enabled on the SSH client.
Run the display this command in the system view on the SSH client to check whether the
first authentication function is enabled on the SSH client.
If no, an STelnet user fails to log in to the SSH server for the first time because verifying the
RSA public key on the SSH server fails. Run the ssh client first-time enable command to
enable the first authentication function on the SSH client.
----End
7 File Management
This chapter provides information about file management. This information includes an
overview, descriptions, and other details related to file management.
Storage Medium
The device supports the flash memory and USB flash drive.
NOTE
A USB flash drive is mainly used for USB-based deployment or system file loading. The USB flash
drive must use the FAT32 format. Set the format to FAT32 (format the USB flash drive) before using the
USB flash drive.
l In the file operation command format, filename indicates the file name.
l In the file operation command format, directory indicates the path (drive + path).
Table 7-1 lists information about files queried through the dir command.
Item Description
l When the device functions as a server, you can access the device from a terminal to
manage files on the device and transfer files between the device and the terminal.
l When the device functions as a client, you can use the device to manage files on other
devices and transfer files between the device and other devices.
In Trivial File Transfer Protocol (TFTP) mode, the device can function only as a client. In File
Transfer Protocol (FTP), Secure File Transfer Protocol (SFTP), or Secure Copy Protocol
(SCP) mode, the device can function both as a server and a client.
NOTICE
To ensure high security, do not use the RSA key pair whose length is less than 2048 digits.
Table 7-2 describes the advantages and disadvantages of different file management modes.
In the scenario of
managing directories,
and files, log in to the
You can log in to the Only files on the local
device through the
Device device directly to device can be managed.
console port, Telnet, or
login manage directories and File transfer is not
STelnet. This login
files. supported.
mode is mandatory for
storage medium
management.
l Data is encrypted
and protected.
The SCP mode is
l In SCP mode, files Configurations are
applicable to the highly-
are uploaded or complicated (similar to
efficient file upload and
SCP downloaded when SFTP configurations),
download scenarios
the client is and interactions are not
with high network
connected to the supported.
security requirements.
server, which is
efficient.
Device login, FTP, and TFTP are easy to learn and configure. The following section describes
the SFTP mode and SCP mode in more detail.
SFTP Mode
As a part of Secure Shell (SSH), the SFTP protocol allows remote users to securely log in to
the device and perform file management and transmission through the security channel
provided by SSH. Therefore, SFTP improves data transmission security. In addition, the
device can function as the SSH client to connect to the remote SSH server for the secure file
transmission.
l Encrypted transmission: When an SSH connection is set up, two devices negotiate an
encryption algorithm and a session key to ensure secure communications between them.
l Public key-based authentication: The device supports the RSA, DSA or ECC
authentication mode.
l Server authentication: The SSH protocol authenticates a server based on the public key
to defend against attacks from bogus servers.
l Interaction data check: The SSH protocol uses the CRC (for SSH1.5) or MD5-based
MAC algorithm (for SSH2.0) to check the data integrity and authenticity. This
mechanism protects the system from man-in-the-middle attacks.
NOTE
Before an SSH connection is set up, the local key pair (RSA, DSA or ECC key pair) must be generated
on the server. The key pair is used to generate the session key and session ID and authenticate the server.
This step is the key to SSH server configuration.
SCP Mode
Based on the SSH remote file copy function, SCP is used to copy, upload, and download files.
SCP commands are easy to use, improving network maintenance efficiency.
NOTICE
When downloading files to the device or performing other operations on the device, ensure
that the power supply of the device is working properly; otherwise, the downloaded file or the
file system may be damaged. As a result, the storage medium on the device may be damaged
or the device cannot be properly started.
Pre-configuration Tasks
Before logging in to the device to manage files, complete the following tasks:
l Ensuring that routes are reachable between the terminal and the device
l Ensuring that a user have logged in to the device using a terminal
Configuration Process
After a user logs in to the device on a terminal, the user can perform operations on storage
media, directories, and files.
Procedure
l Perform operations on directories.
l The directory to be
deleted must be empty.
Delete a directory. rmdir directory l A deleted directory and
its files cannot be restored
from the recycle bin.
zip source-filename
Compress a file. -
destination-filename
unzip source-filename
Decompress a file. -
destination-filename
----End
Pre-configuration Tasks
Before connecting to the FTP server to manage files, complete the following tasks:
l Ensuring that routes are reachable between the terminal and the device.
l Ensuring that the terminal functions as the FTP client.
Configuration Process
NOTICE
The FTP protocol will bring risk to device security. The SFTPv2 or SCP mode is
recommended.
Table 7-5 describes the procedure for managing files when the device functions as an FTP
server. The 1, 2, 3 steps can be performed in any sequence.
Table 7-5 Managing files when the device functions as an FTP server
No. Task Description
Procedure
l Set FTP server parameters.
Submit the
commit -
configurations.
NOTE
l If the FTP service is enabled, the port number of the FTP service cannot be changed. To
change the port number, run the undo ftp [ ipv6 ] server command to disable the FTP service
first.
l After operations on files are complete, run the undo ftp [ ipv6 ] server command to disable
the FTP server function to ensure the device security.
l Configure local FTP user information.
Before performing operations on files using FTP, configure the local user name and
password, service type, and authorized directory on the FTP server.
local-user user-name
Configure the local
password irreversible-
user name and -
cipher irreversible-cipher-
password.
password
NOTE
You must set the local user level
Configure the local local-user user-name level
to the administrator level (3 or
user level. level 15). Otherwise, the FTP
connection cannot be established.
Configure the
local-user user-name service- By default, a local user can use
service type for
type ftp any access type.
local users.
Submit the
commit -
configurations.
– When deny is used in the ACL rule, devices that match the ACL rule cannot
establish FTP connections with the local device.
– When the ACL rule is configured but packets from devices do not match the rule,
other devices cannot establish FTP connections with the local device.
– When the ACL contains no rule, any device can establish FTP connections with the
local device.
Configure a basic
ftp [ ipv6 ] server acl { acl-
ACL for the FTP -
number | acl-name }
server.
Submit the
commit -
configurations.
Users can use the Windows CLI or third-party software to connect to the device from a
terminal using FTP. The following describes how to connect to the device using
commands in the Windows CLI:
– Run the ftp ip-address command to connect to the device using FTP.
In the preceding command, ip-address indicates the IP address configured on the
device. Routes between the terminal and the device are reachable.
– Enter the user name and password as prompted and press Enter. If command
prompt ftp> is displayed in the FTP client view, the user accesses the working
directory on the FTP server. (The following information is only for reference.)
C:\Windows\System32> ftp [Link]
Connected to [Link].
220 FTP service ready.
User([Link]:(none)):huawei
331 Password required for huawei.
Password:
After connecting to the FTP server, users can run FTP commands to perform file-related
operations including performing operations on directories and files, configuring the file
transfer mode, and viewing the online help about FTP commands.
NOTE
Change the
working directory cd remote-directory -
on the server.
Change the -
current working
cdup
directory to its
parent directory.
Display the -
working directory pwd
on the server.
Delete a directory
rmdir remote-directory -
from the server.
----End
Pre-configuration Tasks
Before connecting to the SFTP server to manage files, complete the following tasks:
l Ensuring that routes are reachable between the terminal and the device
l Ensuring that the SSH client software has been installed on the terminal
Configuration Process
NOTICE
l The SFTPv1 protocol will bring risk to device security. The SFTPv2 mode is
recommended.
l To ensure high security, do not use the RSA key pair whose length is less than 2048 digits.
Table 7-11 describes the procedure for managing files when the device functions as an SFTP
server.
Table 7-11 Managing files when the device functions as an SFTP server
No. Task Description Remarks
Procedure
l Set SFTP server parameters.
Method 1:
Run the rsa local-key-
pair create, dsa local-
key-pair create, or ecc
local-key-pair create
command to generate a
local RSA, DSA, or In method 1:
ECC key pair. After the key pair is generated,
Method 2: you can run the display rsa
local-key-pair public, display
1. Run the rsa key-pair dsa local-key-pair public, or
label label-name display ecc local-key-pair
[ modulus modulus- public command to view the
bits ], dsa key-pair public key in the local RSA,
label label-name DSA, or ECC key pair.
[ modulus modulus- In method 2:
bits ], or ecc key-
Generate a local key pair label label- After the key pair is generated,
pair. name [ modulus you can run the display rsa key-
modulus-bits ] pair [ brief | label label-name ],
command to generate display dsa key-pair [ brief |
an RSA, a DSA, or label label-name ], or display
an ECC key pair ecc key-pair [ brief | label label-
with a specific label name ] command to view the
name. RSA, DSA, or ECC key pair
with a specific label.
2. Run the ssh server
NOTE
assign { rsa-host- Because a longer key pair provides
key | dsa-host-key | higher security, you are advised to
ecc-host-key } label- use key pairs of the largest length.
name command to
assign the generated
RSA host key, RSA
server key, DSA host
key, or ECC host key
to the SSH server.
Submit the
commit -
configurations.
– When the local RSA key pair is generated, two key pairs (a server key pair and a
host key pair) are generated at the same time. Each key pair contains a public key
and a private key. The length of the two key pairs ranges from 512 bits to 2048 bits.
The default length is 2048 bits.
– When the local DSA key pair is generated, only the host key pair is generated. The
length of the host key pair can be 512, 1024, or 2048 bits. The default length is
2048 bits.
– When the local ECC key pair is generated, only the host key pair is generated. The
length of the host key pair can be 256, 384, or 521 bits. The default length is 521
bits.
l Configure SSH user information.
Configure SSH user information including the authentication mode. Authentication
modes including RSA, password, password-rsa, DSA, password-dsa, ECC, password-
ecc, and all are supported.
– The password-rsa authentication mode consists of the password and RSA
authentication modes.
– The password-dsa authentication mode consists of the password and DSA
authentication modes.
– The password-ecc authentication mode consists of the password and ECC
authentication modes.
– The all authentication mode indicates that SSH users only need to authenticated by
DSA, ECC, password, or RSA.
Submit the
commit -
configurations.
local-user user-name
Configure the local user password irreversible-
-
name and password. cipher irreversible-cipher-
password
Commit the
commit -
configurations.
NOTE
The level for the local user must be set to 3 or higher to ensure successful connection
establishment.
By default, the
authentication type for the
SSH connection is AAA.
When the authentication
type is AAA, only the
password authentication
mode can be configured. If
the public key
authentication mode is
Configure the used, perform either of the
ssh authorization-type following operations to
authentication type for the
default root implement successful
SSH connection.
login of the SSH user:
l Run this command to
set the authentication
type for the SSH
connection to root.
l In the AAA view,
create a local user with
the same name as the
SSH user.
Commit the
commit -
configurations.
The SSH client software supporting SFTP must be installed on the terminal to ensure
that the terminal can connect to the device using SFTP to manage files. The following
describes how to connect to the device using the OpenSSH and the Windows CLI.
– For details how to install the OpenSSH, see the OpenSSH installation description.
– To use the OpenSSH to connect to the device using SFTP, run the OpenSSH
commands. For details about OpenSSH commands, see OpenSSH help.
– Windows command prompt can identify commands supported by the OpenSSH
only when the OpenSSH is installed on the terminal.
Access the Windows CLI and run the commands supported by the OpenSSH to connect
to the device using SFTP to manage files.
If command prompt sftp> is displayed in the SFTP client view, the user accesses the
working directory on the SFTP server. (The following information is only for reference.)
C:/Documents and Settings/Administrator> sftp client001@[Link]
Connecting to [Link]...
The authenticity of host "[Link] ([Link])" can't be established.
DSA key fingerprint is 0d:48:82:fd:2f:52:1c:f0:c4:22:70:80:8f:7b:fd:78.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added "[Link]" (DSA) to the list of known hosts.
client001@[Link]'s password:
sftp>
In the SFTP client view, you can perform one or more file-related operations listed in
Table 7-17 in any sequence.
Display the file list in a dir/ls [ -l | -a ] [ remote- Outputs of the dir and ls
specified directory. directory ] commands are the same.
A maximum of 10
directories can be deleted at
one time.
Delete directories from rmdir remote-directory Before running the rmdir
the server. &<1-10> command to delete
directories, ensure that the
directories do not contain
any files. Otherwise, the
deletion fails.
Create a directory on
mkdir remote-directory -
the server.
----End
l Run the display ssh server session command to view session information of the SSH
client on the SSH server.
Pre-configuration Tasks
Before connecting to the SCP server to manage files, complete the following tasks:
l Ensuring that routes are reachable between the terminal and the device
l Ensuring that the SSH client software supporting SCP has been installed on the terminal
NOTICE
To ensure high security, do not use the RSA key pair whose length is less than 2048 digits.
Configuration Process
Table 7-18 describes the procedure for managing files when the device functions as an SCP
server.
Table 7-18 Managing files when the device functions as an SCP server
Time for updating the key pair of the server 0, indicating the key pair of the server is
never updated
Procedure
l Set SCP server parameters.
(Optional)
Configure the SSH ssh server timeout By default, the SSH authentication
authentication seconds timeout duration is 60 seconds.
timeout duration.
(Optional)
Configure the ssh server
By default, the number of SSH
number of SSH authentication-retries
authentication retries is 3.
authentication times
retries.
Submit the
commit -
configurations.
– When the local RSA key pair is generated, two key pairs (a server key pair and a
host key pair) are generated at the same time. Each key pair contains a public key
and a private key. The length of the two key pairs ranges from 512 bits to 2048 bits.
The default length is 2048 bits.
– When the local DSA key pair is generated, only the host key pair is generated. The
length of the host key pair can be 512, 1024, or 2048 bits. The default length is
2048 bits.
– When the local ECC key pair is generated, only the host key pair is generated. The
length of the host key pair can be 256, 384, or 521 bits. The default length is 521
bits.
l Configure SSH user information.
Configure SSH user information including the authentication mode. Authentication
modes including RSA, password, password-rsa, DSA, password-dsa, ECC, password-
ecc, and all are supported.
– The password-rsa authentication mode consists of the password and RSA
authentication modes.
– The password-dsa authentication mode consists of the password and DSA
authentication modes.
– The password-ecc authentication mode consists of the password and ECC
authentication modes.
– The all authentication mode indicates that SSH users only need to authenticated by
DSA, ECC, password, or RSA.
Submit the
commit -
configurations.
local-user user-name
Configure the local user password irreversible-
-
name and password. cipher irreversible-cipher-
password
Commit the
commit -
configurations.
By default, the
authentication type for the
SSH connection is AAA.
When the authentication
type is AAA, only the
password authentication
mode can be configured. If
the public key
authentication mode is
Configure the used, perform either of the
ssh authorization-type following operations to
authentication type for the
default root implement successful
SSH connection.
login of the SSH user:
l Run this command to
set the authentication
type for the SSH
connection to root.
l In the AAA view,
create a local user with
the same name as the
SSH user.
Commit the
commit -
configurations.
– To use the OpenSSH to connect to the device using SFTP, run the OpenSSH
commands. For details about OpenSSH commands, see OpenSSH help.
– Windows command prompt can identify commands supported by the OpenSSH
only when the OpenSSH is installed on the terminal.
Access the Windows CLI and run the commands supported by the OpenSSH to connect
to the device using SCP to manage files. (The following information is only for
reference.)
C:\Documents and Settings\Administrator> scp scpuser@[Link]:flash:/
[Link] [Link]
The authenticity of host '[Link] ([Link])' can't be established.
DSA key fingerprint is 46:b2:8a:52:88:42:41:d4:af:8f:4a:41:d9:b8:4f:ee.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[Link]' (DSA) to the list of known hosts.
scpuser@[Link]'s password:
[Link] 100% 1257 1.2KB/s 00:00
Read from remote host [Link]: Connection reset by peer
The user terminal uploads or downloads files while connecting to the SCP server and
access the user local directory.
----End
Pre-configuration Tasks
Before connecting to a device as a TFTP client to manage files, complete the following tasks:
l Ensuring that routes are reachable between the current device and the TFTP server
l Obtaining the IP address of the TFTP server and the directory for storing files to be
downloaded or uploaded
Configuration Process
NOTE
The TFTP protocol will bring risk to device security. The SFTPv2 or SCP mode is recommended.
Table 7-24 describes the procedure for managing files when the device functions as a TFTP
client.
Table 7-24 Procedure for managing files when the device functions as a TFTP client
Procedure
l (Optional) Configure the TFTP client source address.
When you specify the source address in an ACL, use the address of an interface in stable
state, for example, a loopback interface. This simplifies the ACL rule and security policy
configuration. After the client source address is configured as the source or destination
address in the ACL rule, IP address differences and interface status impact are shielded,
and incoming and outgoing packets are filtered.
The TFTP client source address must be set to the loopback interface IP address or
loopback interface.
Submit the
commit -
configurations.
An ACL is composed of a list of rules such as the source address, destination address,
and port number of packets. ACL rules are used to classify packets. After these rules are
applied to routing devices, the routing devices determine the packets to be received and
rejected.
An ACL can define multiple rules. ACLs are classified into basic ACLs, advanced
ACLs, and Layer 2 ACLs.
NOTE
TFTP supports only the basic ACL whose number ranges from 2000 to 2999.
ACL rule:
l When permit is used in the ACL rule, the local device can establish TFTP connections with
devices that match the ACL rule.
l When deny is used in the ACL rule, the local device cannot establish TFTP connections
with devices that match the ACL rule.
l When the ACL rule is configured but packets from devices do not match the rule, the local
device cannot establish TFTP connections with the devices.
l When the ACL contains no rule, the local device can establish TFTP connections with any
devices.
Submit the
commit -
configurations.
The source address or interface specified in the tftp command has a higher priority than
that specified in the tftp client source command. If you specify different source
addresses or interfaces in the tftp client source and tftp commands, the source address
or interface specified in the tftp command takes effect. The source address or interface
specified in the tftp client source command applies to all TFTP connections. The source
address or interface specified in the tftp command applies only to the current TFTP
connection.
----End
Pre-configuration Tasks
Before connecting to a device as an FTP client to manage files, complete the following tasks:
l Ensuring that routes are reachable between the current device and the FTP server
l Obtaining the IP address of the FTP server, FTP user name, and password
l Obtaining the listening port number of the FTP server if the default listening port number
is not used
Configuration Process
NOTICE
The FTP protocol will bring risk to device security. The SFTPv2 or SCP mode is
recommended.
Table 7-27 describes the procedure for managing files when the device functions as an FTP
client.
Table 7-27 Procedure for managing files when the device functions as an FTP client
No. Task Description Remarks
Procedure
l (Optional) Configure the FTP client source address.
When you specify the source address in an ACL, use the address of an interface in stable
state, for example, a loopback interface. This simplifies the ACL rule and security policy
configuration. After the client source address is configured as the source or destination
address in the ACL rule, IP address differences and interface status impact are shielded,
and incoming and outgoing packets are filtered.
The FTP client source address must be set to the loopback interface IP address or
loopback interface.
Submit the
commit -
configurations.
Run the corresponding command in the user view or FTP client view to connect to the
FTP server.
NOTE
If the device only needs to upload files to or download files from the FTP server, you can complete
a file transfer at one time by running the ftp { put | get } [ -a source-ip-address | -i interface-type
interface-number ] host-ip host-ip [ port portnumber ] [ public-net | vpn-instance vpn-instance-
name ] username username sourcefile local-filename [ destination remote-filename ] or ftp { put
| get } ipv6 [ -i interface-type interface-number ] host-ip host-ipv6 [ port portnumber ] username
username sourcefile local-filename [ destination remote-filename ] command in the user view.
This command cannot perform other FTP operations.
Table 7-29 Running FTP commands to connect to the FTP server (with an IPv4 address)
NOTE
Before connecting to the FTP server, run the set net-manager vpn-instance command to set the
VPN instance to the default VPN instance.
The source address specified in the ftp command has a higher priority than that specified in the ftp
client source command. If you specify different source addresses in the ftp client source and ftp
commands, the source address specified in the ftp command takes effect. The source address
specified in the ftp client source command applies to all TFTP connections. The source address
specified in the ftp command applies only to the current TFTP connection.
Table 7-30 Running FTP commands to connect to the FTP server (with an IPv6 address)
Operation Command Description
Users must enter the correct user name and password to connect to the server.
l Run FTP commands to perform file-related operations.
After connecting to the FTP server, users can run FTP commands to perform file-related
operations including performing operations on directories and files, configuring the file
transfer mode, and viewing the online help about FTP commands.
NOTE
Change the
working directory cd remote-directory -
on the server.
Change the -
current working
cdup
directory to its
parent directory.
Display the -
working directory pwd
on the server.
Delete a directory
rmdir remote-directory -
from the server.
----End
Pre-configuration Tasks
Before connecting to a device as an SFTP client to manage files, complete the following
tasks:
l Ensuring that routes are reachable between the current device and the SSH server
l Obtaining the IP address of the SSH server and SSH user information
l Obtaining the listening port number of the SSH server if the default listening port
number is not used
NOTICE
To ensure high security, do not use the RSA key pair whose length is less than 2048 digits.
Configuration Process
Table 7-32 describes the procedure for managing files when the device functions as an SFTP
client.
Table 7-32 Procedure for managing files when the device functions as an SFTP client
No. Task Description Remark
s
Procedure
l (Optional) Configure the SFTP client source address.
When you specify the source address in an ACL, use the address of an interface in stable
state, for example, a loopback interface. This simplifies the ACL rule and security policy
configuration. After the client source address is configured as the source or destination
address in the ACL rule, IP address differences and interface status impact are shielded,
and incoming and outgoing packets are filtered.
The SFTP client source address must be set to the loopback interface IP address or
loopback interface.
Submit the
commit -
configurations.
Perform this step only when the device logs in to the SSH server in RSA, DSA, or ECC
authentication mode, not the password authentication mode.
Commit the
commit -
configurations.
Enable first
By default, first authentication is
authentication for ssh client first-time enable
disabled on the SSH client.
the SSH client.
Commit the
commit -
configurations.
Table 7-36 Configuring the SSH client to assign the RSA, DSA, or ECC public key to
the SSH server
Action Command Description
Return to the
peer-public-key end -
system view.
Commit the
commit -
configurations.
Enter the
system system-view -
view.
(Optional)
ssh client key-exchange
Set a key
{ dh_group14_sha1 | dh_group1_sha1 |
exchange By default, an SSH
dh_group_exchange_sha1 |
algorithm client supports all key
dh_group_exchange_sha256 |
list on the exchange algorithms.
ecdh_sha2_nistp256 | ecdh_sha2_nistp384 |
SSH
ecdh_sha2_nistp521 | sm2_kep } *
client.
Operatio
Command Description
n
By default, an SSH
client supports
(Optional) encryption algorithms
Set an including DES_CBC,
encryption ssh client cipher { des_cbc | 3des_cbc | 3DES_CBC,
algorithm aes128_cbc | aes256_cbc | aes128_ctr | AES128_CBC,
list for the aes256_ctr | arcfour128 | arcfour256 } * AES256_CBC,
SSH AES128_CTR,
client. AES256_CTR,
Arcfour128, and
Arcfour256.
(Optional)
Set an By default, an SSH
HMAC client supports HMAC
authenticat authentication
ssh client hmac { md5 | md5_96 | sha1 |
ion algorithms including
sha1_96 | sha2_256 | sha2_256_96 } *
algorithm MD5, MD5_96, SHA1,
list for the SHA1_96, SHA2_256,
SSH and SHA2_256_96.
client.
Command example:
[~HUAWEI] sftp [Link]
When the SSH connection succeeds, sftp-client> is displayed, indicating the SFTP client
view is displayed.
l Run SFTP commands to perform file-related operations.
In the SFTP client view, you can perform one or more file-related operations listed in
Table 7-38 in any sequence.
Display the file list in a dir/ls [ -l | -a ] [ remote- Outputs of the dir and ls
specified directory. directory ] commands are the same.
A maximum of 10
directories can be deleted at
one time.
Delete directories from rmdir remote-directory Before running the rmdir
the server. &<1-10> command to delete
directories, ensure that the
directories do not contain
any files. Otherwise, the
deletion fails.
Create a directory on
mkdir remote-directory -
the server.
----End
Pre-configuration Tasks
Before connecting to a device as an SCP client to manage files, complete the following tasks:
l Ensuring that routes are reachable between the current device and the SSH server.
l Obtaining the host name or IP address of the SSH server and SSH user information.
l Obtaining the listening port number of the SSH server if the default listening port
number is not used.
NOTICE
To ensure high security, do not use the RSA key pair whose length is less than 2048 digits.
Configuration Process
Table 7-39 describes the procedure for managing files when the device functions as an SCP
client.
Table 7-39 Procedure for managing files when the device functions as an SCP client
No. Task Description Remarks
Procedure
l (Optional) Configure the SCP client source address.
Submit the
commit -
configurations.
Perform this step only when the device logs in to the SSH server in RSA, DSA, or ECC
authentication mode, not the password authentication mode.
Commit the
commit -
configurations.
– Enable the initial authentication function on the client. With the function enabled,
the client connects to the SSH server without checking the public key of the SSH
server. When the initial SSH connection succeeds, the client automatically saves the
public key of the SSH server for the next SSH connection. For details, see Table
7-35.
– Save the public key of the SSH server on the client so that the client can
authenticate the SSH server successfully. For details, see Table 7-36. This method
ensures higher security but becomes more complex than the first method.
Enable first
By default, first authentication is
authentication for ssh client first-time enable
disabled on the SSH client.
the SSH client.
Commit the
commit -
configurations.
Table 7-43 Configuring the SSH client to assign the RSA, DSA, or ECC public key to
the SSH server
Action Command Description
Return to the
peer-public-key end -
system view.
Commit the
commit -
configurations.
Enter the
system system-view -
view.
(Optional)
Set a key ssh client key-exchange { dh_group14_sha1 |
By default, an SSH
exchange dh_group1_sha1 | dh_group_exchange_sha1 |
client supports all
algorithm dh_group_exchange_sha256 |
key exchange
list on the ecdh_sha2_nistp256 | ecdh_sha2_nistp384 |
algorithms.
SSH ecdh_sha2_nistp521 | sm2_kep } *
client.
By default, an SSH
client supports
(Optional) encryption
Set an algorithms including
encryptio DES_CBC,
ssh client cipher { des_cbc | 3des_cbc |
n 3DES_CBC,
aes128_cbc | aes256_cbc | aes128_ctr |
algorithm AES128_CBC,
aes256_ctr | arcfour128 | arcfour256 } *
list for the AES256_CBC,
SSH AES128_CTR,
client. AES256_CTR,
Arcfour128, and
Arcfour256.
Operatio
Command Description
n
----End
l Run the display scp client command to check source configurations on the SCP client.
l Run the display ssh server-info command to check the mappings between the SSH
server and the public key.
Networking Requirements
After logging in to the device through the console interface, Telnet, or STelnet, perform the
following operations:
l View files and subdirectories in the current directory.
l Create the test directory, copy the [Link] file to test, and rename [Link] as
[Link].
l View files in the test directory.
Procedure
Step 1 View files and subdirectories in the current directory.
<HUAWEI> system-view
[~HUAWEI] sysname Switch
[*Switch] commit
[~Switch] quit
<Switch> dir
Directory of flash:/
Step 2 Create the test directory, copy the [Link] file to test, and rename [Link] as
[Link].
# Create the test directory.
<Switch> mkdir test
Info: Create directory flash:/test/......Done.
NOTE
If no target file name is specified, the source file and target file have the same name.
----End
Configuration File
Configuration file of the Switch
#
sysname Switch
#
return
Networking Requirements
As shown in Figure 7-1, PC1 connects to the device, and the IP address of the management
network interface on the device is [Link]. The device needs to be upgraded. The device
is required to function as the FTP server to upload the system software from PC1 to the
device and save the configuration file to PC1 for backup. A security policy is configured to
ensure that only PC1 is allowed to access the FTP server.
Figure 7-1 Networking diagram for managing files when the device functions as an FTP
server
[Link]/24 [Link]/24
PC1
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure the FTP function and FTP user information including user name, password,
user level, service type, and authorized directory on the FTP server.
2. Configure access permissions on the FTP server.
3. Save the [Link] file on the FTP server.
4. Connect to the FTP server from the PC1.
5. Upload [Link] to and download [Link] from the FTP server.
Procedure
Step 1 Configure the FTP function and FTP user information on the FTP server.
<HUAWEI> system-view
[~HUAWEI] sysname FTP_Server
[*HUAWEI] commit
[~FTP_Server] ftp server enable
[*FTP_Server] aaa
[*FTP_Server-aaa] local-user admin1234 password irreversible-cipher
Helloworld@6789
[*FTP_Server-aaa] local-user admin1234 level 3
[*FTP_Server-aaa] local-user admin1234 service-type ftp
[*FTP_Server-aaa] local-user admin1234 ftp-directory flash:/
[*FTP_Server-aaa] commit
[~FTP_Server-aaa] quit
Step 4 Connect to the FTP server from the PC1 as the admin1234 user whose password is
Helloworld@6789 and transfer files in binary mode.
Step 5 Upload [Link] to and download [Link] from the FTP server.
NOTE
The [Link] file to be uploaded and the [Link] file to be downloaded are stored in the local
directory on the FTP client. Before uploading and downloading files, obtain the local directory on the
client. The default FTP user's local directory on the Windows 7 operating system is C:\Windows
\System32.
----End
Configuration File
#
sysname Switch
#
FTP server enable
FTP server acl 2001
#
acl number 2001
rule 5 permit source [Link] 0
rule 10 deny source [Link] 0
#
aaa
local-user admin1234 password irreversible-cipher $1c$g8wLJ`LjL!
$CyE(V{3qg5DdU:PM[6=6O$[Link],Q}>^)OBzgoU$
local-user admin1234 service-type ftp
local-user admin1234 level 3
local-user admin1234 ftp-directory flash:
#
interface MEth0/0/0
ip address [Link] [Link]
#
return
7.5.3 Example for Managing Files Using SFTP When the Device
Functions as an SSH Server
Networking Requirements
As shown in Figure 7-2, PC1 connects to the device, and the IP address of the management
network interface on the device is [Link]. Files need to be securely transferred between
PC1 and the device. Configure the device as the SSH server to provide the SFTP service so
that the SSH server can authenticate the client and encrypt data in bidirectional mode,ensuring
secure file transfer. A security policy is configured to ensure that only PC1 is allowed to
access the SSH server.
Figure 7-2 Networking diagram for managing files using SFTP when the device functions as
an SSH server
[Link]/24 [Link]/24
PC1
Configuration Roadmap
The configuration roadmap is as follows:
1. Generate a local key pair and enable the SFTP server function on the SSH server so that
the server and client can securely exchange data.
2. Configure SSH user information including the authentication mode, service type,
authorized directory, user name, and password.
Procedure
Step 1 Generate a local key pair on the SSH server, and enable the SFTP server.
<HUAWEI> system-view
[~HUAWEI] sysname SSH Server
[*HUAWEI] commit
[~SSH Server] dsa local-key-pair create
Info: The key name will be: SSH
Server_Host_DSA
Info: The key modulus can be any one of the following : 2048.
Info: Key pair generation will take a short while.
Info: Generating keys...
Info: Succeeded in creating the DSA host keys.
[*SSH Server] sftp server enable
Step 2 Configure SSH user information including the authentication mode, service type, authorized
directory, user name, and password.
[*SSH Server] ssh user client001 authentication-type password
[*SSH Server] ssh user client001 service-type sftp
[*SSH Server] ssh user client001 sftp-directory flash:
[*SSH Server] aaa
[*SSH Server-aaa] local-user client001 password irreversible-cipher
Helloworld@6789
[*SSH Server-aaa] local-user client001 level 15
[*SSH Server-aaa] local-user client001 service-type ssh
[*SSH Server-aaa] quit
Step 4 Connect to the SSH server using the third-party software OpenSSH on the PC.
The Windows CLI can identify OpenSSH commands only when the OpenSSH is installed on
the PC.
C:/Documents and Settings/Administrator> sftp client001@[Link]
Connecting to [Link]...
The authenticity of host "[Link] ([Link])" can't be established.
DSA key fingerprint is 0d:48:82:fd:2f:52:1c:f0:c4:22:70:80:8f:7b:fd:78.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added "[Link]" (DSA) to the list of known hosts.
client001@[Link]'s password:
sftp>
After you connect to the SSH server through third-party software, the SFTP view is displayed.
Then you can perform file-related operations in the SFTP view.
----End
Configuration File
#
sysname SSH Server
#
acl number 2001
Networking Requirements
As shown in Figure 7-3, the remote device at [Link]/24 functions as the TFTP server. The
device at [Link]/24 functions as the TFTP client. Routes between the device and the server
are reachable.
The device needs to be upgraded. To upgrade the device, you must download system software
[Link] from and upload the configuration file [Link] to the TFTP server.
Figure 7-3 Networking diagram for managing files when the device functions as a TFTP
client
[Link]/24 [Link]/24
Internet
Configuration Roadmap
The configuration roadmap is as follows:
1. Run the TFTP software on the TFTP server and configure the working directory.
2. Run TFTP commands to download [Link] from and upload [Link] to the
TFTP server.
Procedure
Step 1 Run the TFTP software on the TFTP server and configure the working directory. (For details,
see related third-party documentation.)
Step 2 Run TFTP commands to download [Link] from and upload [Link] to the TFTP
server.
# Access the working directory on the TFTP server and check the [Link] file.
----End
Configuration File
None
Networking Requirements
As shown in Figure 7-4, the remote device at [Link]/24 functions as the FTP server. The
device at [Link]/24 functions as the FTP client. Routes between the device and the server
are reachable.
The device needs to be upgraded. To upgrade the device, you must download system software
[Link] from and upload the configuration file [Link] to the FTP server.
Figure 7-4 Networking diagram for managing files when the device functions as an FTP
client
[Link]/24 [Link]/24
Internet
Configuration Roadmap
The configuration roadmap is as follows:
1. Run the FTP software on the FTP server and configure FTP user information.
2. Connect to the FTP server.
3. Run FTP commands to download [Link] from and upload [Link] to the FTP
server.
Procedure
Step 1 Run the FTP software on the FTP server and configure FTP user information. (For details, see
related third-party documentation.)
Step 2 Connect to the FTP server.
<HUAWEI> ftp [Link]
Trying [Link] ...
Press CTRL + K to abort
Connected to [Link].
220 FTP service ready.
User([Link]:(none)):admin
331 Password required for admin.
Enter password:
230 User logged in.
[ftp]
Step 3 Run FTP commands to download [Link] from and upload [Link] to the FTP
server.
[ftp] binary
[ftp] get [Link]
[ftp] put [Link]
[ftp] quit
# Access the working directory on the FTP server and check the [Link] file.
----End
Configuration File
None
Networking Requirements
SSH secures file transfer on a traditional insecure network by authenticating the client and
encrypting data in bidirectional mode. The client uses SFTP to securely connect to the SSH
server and transfer files.
As shown in Figure 7-5, routes between the SSH server and clients client001 and client002
are reachable. In this example, Huawei device functions as an SSH server.
Client001 connects to the SSH server using the password authentication mode, and client002
using the DSA authentication mode.
Figure 7-5 Networking diagram for managing files when the device functions as an SFTP
client
[Link]/24
client001 [Link]/24
Internet
SSH Server
[Link]/24
client002
Configuration Roadmap
The configuration roadmap is as follows:
1. Generate a local key pair and enable the SFTP server function on the SSH server so that
the server and client can securely exchange data.
2. Create users client001 and client002 and set their authentication modes on the SSH
server.
3. Generate a local key pair on client002 and configure the DSA public key of client002 on
the SSH server so that the server can authenticate the client when the client connects to
the server.
4. Log in to the SSH server as users client001 and client002 using SFTP and manage files.
Procedure
Step 1 Generate a local key pair and enable the SFTP server function on the SSH server.
<HUAWEI> system-view
[~HUAWEI] sysname SSH Server
[*HUAWEI] commit
[~SSH Server] dsa local-key-pair create
Info: The key name will be: SSH
Server_Host_DSA
Info: The key modulus can be any one of the following : 2048.
Info: Key pair generation will take a short while.
Info: Generating keys...
Info: Succeeded in creating the DSA host keys.
[*SSH Server] sftp server enable
There are eight authentication modes for an SSH user: password, RSA, password-RSA, DSA, password-
DSA, ECC, password-ECC, and all.
# Create the client001 user and set the authentication mode to password for the user.
[*SSH Server] ssh user client001
[*SSH Server] ssh user client001 authentication-type password
[*SSH Server] ssh user client001 service-type sftp
[*SSH Server] ssh user client001 sftp-directory flash:
[*SSH Server] aaa
[*SSH Server-aaa] local-user client001 password irreversible-cipher
Helloworld@6789
[*SSH Server-aaa] local-user client001 service-type ssh
[*SSH Server-aaa] local-user client001 level 3
[*SSH Server-aaa] quit
# Create an SSH user client002 and set the authentication mode to dsa for the user.
[*SSH Server] ssh user client002
[*SSH Server] ssh user client002 authentication-type dsa
[*SSH Server] ssh authorization-type default root
[*SSH Server] ssh user client002 service-type sftp
[*SSH Server] ssh user client002 sftp-directory flash:
[*SSH Server] commit
Step 3 Generate a local key pair on client002 and configure the DSA public key of client002 on the
SSH server.
# Generate a local key pair on client002.
<HUAWEI> system-view
[~HUAWEI] sysname client002
[*HUAWEI] commit
[~client002] dsa local-key-pair create
Info: The key name will be: client002_Host_DSA
Info: The key modulus can be any one of the following : 2048.
Info: Key pair generation will take a short while.
Info: Generating keys...
Key name :
client002_Host_DSA
Key modulus :
2048
========================================================
Key code:
3082010A
02820101
00BBB7A0 4924AF13 04F2662D 2ED43B9D 589967EB
D8A4F785 5AD1F662 13845081 0C65F6B3 88A9C415
D81C34BD 41A4B580 70DC7460 E4A5407B 9B95630F
E211F4B3 1115772D FB95D3DC 915A1858 D0DE49F7
F39DD7A7 7795F2B9 C9562E8B 598CB50F 6D39240D
B5C6F1D3 33A218D0 98C30104 F8F3A8CA 7172C95B
03AEC0A0 8A7E99F6 6C1939AA 52CC2E31 B6703278
AEE1BCD8 DC21FCA2 041C9A4C 1856A935 6894998D
FBFA88FF 1708C3A6 7E092368 ACE983D7 C8DDCDF5
26F5D4E5 16A15C5C D6D0018E 4EAFE055 B93FCB87
2BB46EFB 02C04C3B F167A417 380CD0B0 0BC59493
646CBE96 BCAF3DB7 AD0AFA0A 5D14155E D7F97DC1
32693DE5 4B103442 8E0F4DAD 2598BE5E 19
0203
010001
# Configure the DSA public key of client002 on the SSH server. (Information in bold in the
display command output is the DSA public key of client002. Copy the information to the
server.)
[~SSH Server] dsa peer-public-key dsakey001 encoding-type der
[*SSH Server-dsa-public-key] public-key-code begin
[*SSH Server-dsa-public-key-dsa-key-code] 3082010A
[*SSH Server-dsa-public-key-dsa-key-code] 02820101
[*SSH Server-dsa-public-key-dsa-key-code] 00BBB7A0 4924AF13 04F2662D 2ED43B9D
589967EB
[*SSH Server-dsa-public-key-dsa-key-code] D8A4F785 5AD1F662 13845081 0C65F6B3
88A9C415
[*SSH Server-dsa-public-key-dsa-key-code] D81C34BD 41A4B580 70DC7460 E4A5407B
9B95630F
[*SSH Server-dsa-public-key-dsa-key-code] E211F4B3 1115772D FB95D3DC 915A1858
D0DE49F7
[*SSH Server-dsa-public-key-dsa-key-code] F39DD7A7 7795F2B9 C9562E8B 598CB50F
6D39240D
[*SSH Server-dsa-public-key-dsa-key-code] B5C6F1D3 33A218D0 98C30104 F8F3A8CA
7172C95B
[*SSH Server-dsa-public-key-dsa-key-code] 03AEC0A0 8A7E99F6 6C1939AA 52CC2E31
B6703278
[*SSH Server-dsa-public-key-dsa-key-code] AEE1BCD8 DC21FCA2 041C9A4C 1856A935
6894998D
[*SSH Server-dsa-public-key-dsa-key-code] FBFA88FF 1708C3A6 7E092368 ACE983D7
C8DDCDF5
[*SSH Server-dsa-public-key-dsa-key-code] 26F5D4E5 16A15C5C D6D0018E 4EAFE055
B93FCB87
[*SSH Server-dsa-public-key-dsa-key-code] 2BB46EFB 02C04C3B F167A417 380CD0B0
0BC59493
[*SSH Server-dsa-public-key-dsa-key-code] 646CBE96 BCAF3DB7 AD0AFA0A 5D14155E
D7F97DC1
[*SSH Server-dsa-public-key-dsa-key-code] 32693DE5 4B103442 8E0F4DAD 2598BE5E 19
[*SSH Server-dsa-public-key-dsa-key-code] 0203
[*SSH Server-dsa-public-key-dsa-key-code] 010001
[*SSH Server-dsa-public-key-dsa-key-code] public-key-code end
[*SSH Server-dsa-public-key] peer-public-key end
----End
Configuration Files
l Configure file on the SSH server
#
sysname SSH Server
#
dsa peer-public-key dsakey001 encoding-type der
public-key-code begin
3082010A
02820101
00BBB7A0 4924AF13 04F2662D 2ED43B9D 589967EB D8A4F785 5AD1F662
13845081
0C65F6B3 88A9C415 D81C34BD 41A4B580 70DC7460 E4A5407B 9B95630F
E211F4B3
1115772D FB95D3DC 915A1858 D0DE49F7 F39DD7A7 7795F2B9 C9562E8B
598CB50F
6D39240D B5C6F1D3 33A218D0 98C30104 F8F3A8CA 7172C95B 03AEC0A0
8A7E99F6
6C1939AA 52CC2E31 B6703278 AEE1BCD8 DC21FCA2 041C9A4C 1856A935
6894998D
FBFA88FF 1708C3A6 7E092368 ACE983D7 C8DDCDF5 26F5D4E5 16A15C5C
D6D0018E
4EAFE055 B93FCB87 2BB46EFB 02C04C3B F167A417 380CD0B0 0BC59493
646CBE96
BCAF3DB7 AD0AFA0A 5D14155E D7F97DC1 32693DE5 4B103442 8E0F4DAD
2598BE5E
19
0203
010001
public-key-code end
peer-public-key end
#
aaa
local-user client001 password irreversible-cipher $1c$g8wLJ`LjL!
$CyE(V{3qg5DdU:PM[6=6O$[Link],Q}>^)OBzgoU$
local-user client001 service-type ssh
local-user client001 level 3
#
sftp server enable
ssh user client001
ssh user client001 authentication-type password
ssh user client001 service-type sftp
ssh user client001 sftp-directory flash:
ssh user client002
ssh user client002 authentication-type dsa
ssh user client002 assign dsa-key dsakey001
ssh user client002 service-type sftp
ssh user client002 sftp-directory flash:
#
return
Networking Requirements
Compared with the SFTP protocol, the SCP protocol authenticates user identity while
transferring files, improving configuration efficiency.
As shown in Figure 7-6, routes between the device functioning as the SCP client and the SSH
server are reachable. The SCP client can download files from the SSH server.
Figure 7-6 Networking diagram for managing files when the device functions as an SCP
client
[Link]/24 [Link]/24
Internet
Configuration Roadmap
The configuration roadmap is as follows:
1. Generate a local key pair on the SSH server.
2. Create an SSH user on the SSH server.
3. Enable the SCP function on the SSH server.
4. Download files from the SSH server.
Procedure
Step 1 Generate a local key pair on the SSH server.
<HUAWEI> system-view
[~HUAWEI] sysname SSH Server
[*HUAWEI] commit
[~SSH Server] rsa local-key-pair create
The key name will be: SSH Server_Host
The range of public key size is (2048 ~ 2048).
NOTE: Key pair generation will take a short while.
# Create an SSH user client001 and set the authentication mode to password and service type
to all.
[*SSH Server] ssh user client001
[*SSH Server] ssh user client001 authentication-type password
[*SSH Server] ssh user client001 service-type all
# Use the 3des encryption algorithm to download the [Link] file from the remote SSH
server with IP address [Link] to the local user's directory.
[~SCP Client] scp -cipher 3des client001@[Link]:[Link] [Link]
Trying [Link] ...
Press CTRL+K to abort
Connected to [Link] ...
Continue to access it? [Y/N]:y
[Y/N]:y
The server's public key will be saved with the name [Link]. Please wait...
Enter password:
[Link] 100% 19174Bytes 7Kb/s
----End
Configuration File
l Configuration file on the SSH server
#
sysname SSH Server
#
aaa
local-user client001 password irreversible-cipher $#z$!9S<a#>H7{7dI>
%0S{AcKGC=t:zjv14LlQqHO\\P.*=<x1]u;y*P`'GR3[m}$
local-user client001 service-type ssh
local-user client001 level 3
#
scp server enable
ssh user client001
ssh user client001 authentication-type password
ssh user client001 service-type all
#
user-interface vty 0 4
authentication-mode aaa
protocol inbound ssh
#
return
Cause Analysis
l The FTP server is not running.
l The listening port number of the FTP server is not the default one, and no port number is
specified when you log in to the FTP server.
l The authentication information, authorized directory, and user level of the FTP user are
not configured.
l The number of online FTP users who have logged in to the FTP server reaches the upper
threshold 15.
l An ACL is configured on the FTP server, and the FTP client IP address is not specified
in the ACL.
Procedure
Step 1 Check whether the FTP server is running properly.
Run the display ftp server command in any view to check the FTP server status.
l The following information indicates that the FTP server is not running:
<HUAWEI> display ftp server
Server state : Disabled
IPv6 server state : Disabled
Timeout value (mins) : 30
IPv6 Timeout value (mins) : 30
Listen port : 21
IPv6 listen port : 21
ACL name :
ACL number :
Current user count : 0
Max user number : 15
Source IPv4 address : [Link]
Run the ftp server enable command in the system view to start the FTP server.
<HUAWEI> system-view
[~HUAWEI] ftp server enable
Info: Succeeded in starting the FTP server.
[*HUAWEI] commit
l The following information indicates that the FTP server is running properly:
<HUAWEI> display ftp server
Server state : Enabled
IPv6 server state : Disabled
Timeout value (mins) : 30
IPv6 Timeout value (mins) : 30
Listen port : 21
IPv6 listen port : 21
ACL name :
ACL number :
Current user count : 0
Max user number : 15
Source IPv4 address : [Link]
Step 2 Check whether the listening port number of the FTP server is the default port number 21.
1. Run the display tcp status command in any view to check the current TCP port listening
status.
<HUAWEI> display tcp status
------------------------------------------------------------------------------
--
2. Run the display ftp server command in any view to check the listening port number of
the FTP server.
<HUAWEI> display ftp server
Server state : Enabled
IPv6 server state : Disabled
Timeout value (mins) : 10
IPv6 Timeout value (mins) : 10
Listen port : 21
IPv6 listen port : 21
ACL name :
IPv6 ACL name :
ACL number :
IPv6 ACL number :
Current user count : 0
Max user number : 15
Source IPv4 address : [Link]
Source IPv6 Address : ::
Source IPv6 VpnName :
If the listening port number is not 21, run the ftp server port command to set the listening
port number to 21.
<HUAWEI> system-view
[~HUAWEI] undo ftp server
Info: Succeeded in closing the FTP server.
[*HUAWEI] ftp server port 21
[*HUAWEI] ftp server enable
Info: Succeeded in starting the FTP server.
[*HUAWEI] commit
Alternatively, enter the port number configured on the server when you set up an FTP
connection on the FTP client.
Step 3 Check whether the authentication information, authorized directory, and user level of the FTP
user are correctly configured.
The FTP user name, password, authorized directory, and user level must be configured. If the
FTP authorized directory and user level are not configured, login fails.
----End
Cause Analysis
l The FTP source or destination directory name consists of unsupported characters.
l The storage space of the FTP root directory is insufficient.
Procedure
Step 1 Check whether the FTP source and destination directory names consist of unsupported
characters.
The following characters and spaces are not supported: ~ */ \ : ' "
If the directory names consist of any unsupported characters, modify the directory names.
Step 2 Check whether the storage space of the FTP root directory is sufficient.
Run the dir command on the FTP server to check the free space of the FTP root directory.
If the space of the FTP root directory is insufficient, run the delete /unreserved command in
the user view to delete unnecessary files.
----End
l The upgrade of a device is closely related to the released software versions. The corresponding
upgrade guide is released with each new version and you can upgrade the device according to the
guide. To obtain the upgrade guides, visit [Link] and download the
upgrade guide based on the product name and version.
l For details about commands used for device upgrade, see "Basic Configurations Commands -
Upgrade Commands" in the CloudEngine 8800&7800&6800&5800 Series Switches Command
Reference.
System Software
The device software includes BIOS software and system software. After the device is
powered on, it runs the BIOS software to initialize the hardware and display the hardware
parameters. Then the device runs the system software. The system software provides drivers
and adaptation functions for hardware, and offers services features. The BIOS software and
system software are prerequisite for device startup and operation, providing support,
management, and services for the device.
A device upgrade includes BIOS software upgrade and system software upgrade.
NOTE
The BIOS software is included in the system software package (.cc file) of the device. The BIOS
software is automatically upgraded in system software upgrade.
Configuration File
A configuration file is a collection of command lines. The current configurations are saved in
configuration files, and continue to take effect after the device restarts. You can view
configurations in configuration files or upload the files to other devices to implement batch
configuration.
A configuration file is in the text format and meets the following requirements:
– A .cfg file is a text file. You can directly view the content of a .cfg file. After a .cfg
file is specified as the configuration file, the system restores the commands in the
file one by one when startup.
– A .zip file is the compression of a .cfg file, occupying less space. After a .zip file is
specified as the configuration file, the system decompresses the file into a .cfg file,
and then restores the commands in the file one by one when startup.
– A .dat file is a binary file. If the startup software version and the .dat file version are
the same, the system restores all configurations in the .dat file in batches when the
device starts. This speeds up the system startup.
The following table describes the configuration file, current configuration, and offline
configuration.
Configuratio When the device is powered on, the l Run the display startup
n file device reads the configuration file command to check the current
from the default directory to boot and next startup configuration
the system. Therefore, the files.
configuration in the file is called the l Run the display saved-
initial configuration. If no configuration command to
configuration file is stored in the check the configuration file for
default directory, the device uses the next startup.
default parameters for initialization.
Current The configurations that are valid Run the display current-
configuration during the device running are called configuration command to check
current configurations. the current configuration.
If you modify the current configuration and want to use the modified configuration as the next
startup configuration, run the save command to save the new configuration to the default
storage device.
NOTE
If a command in incomplete form is configured, the system saves the command to the configuration file
in its complete form, which may cause the command to have more than 1022 characters. (The maximum
length of a command supported by the system is 1022 characters.) The incomplete command cannot be
recovered after the system restarts.
Patch File
A patch is a kind of software compatible with the system software. It is used to remove a few
issues in the software that need to be solved immediately. Patches can also fix errors or
improve adaptation of the system software. For example, patches can fix defects of the system
and optimize some functions to meet service requirements.
The patches are released in patch files. A patch file may contain one or more patches with
different functions. When patch files are loaded from the storage device to the patch area in
the memory, they are assigned unique sequence number for users to identify, manage, and
operate the patches.
Patch classification
According to impact on services, patches can be classified into hot patch and cold patch.
l Hot patch (HP): The services are not interrupted when the HP is loaded and activated,
which reduces upgrade costs and eliminates upgrade risks.
l Cold Patch (CP): You must restart the device for the CP to take effect. Services are
interrupted during the restart.
According to patch dependency, patches can be classified into incremental and non-
incremental patches.
l An incremental patch is dependent on previous patches. A new patch file contains all the
patch information in the previous patch file. You can install the patch file without
uninstalling the original patch file.
l A non-incremental patch is exclusive in the current system. To install another patch file
when there is already one, uninstall the existing patch file, and then install and run the
new patch file.
NOTE
The currently released patches are hot patches and incremental patches. All the patches mentioned in the
subsequent sections are hot patches and incremental patches unless otherwise specified.
Status of Patches
Each patch has its own state that can only be changed with command line.
Idle The patch file is saved to the When a patch in the storage
storage device but has not been device is loaded to the patch area,
loaded to the patch area. the patch is in the deactive state.
Deactive When a patch is loaded to the You can perform either of the
patch area or stops running, the following operations on the patch
patch is in the deactive state. that is in the deactive state:
l Uninstall the patch to delete it
from the patch area.
l Run the patch file temporarily
to change the state to active.
Active When a patch is stored in the You can perform one of the
patch area and runs temporarily, following operations on the patch
the patch is in the active state. that is in the active state:
The active patch changes to the l Uninstall the patch to delete it
deactive state when the device is from the patch area.
restarted. l Stop running the patch to
change the patch to the
deactive state.
l Run the patch permanently to
change the patch to the running
state.
Running When a patch is stored in the You can unload the patch that is in
patch area and runs permanently, the running state so that it can be
the patch is in the running state. deleted from the patch area.
The running patch remains in the
running state when the device is
restarted.
Load a patch
Idle Deactive
Delete a patch
De
let
e Deactive a patch Activate a patch
a
Delete a patch pa
tch
Running Active
Run a patch
Installing Patches
Installing patches is a way of upgrading a device. Patches can be installed in the following
ways:
l The hot patches are generally installed while the device is running without interrupting
services. This is an advantage of hot patches.
For details on how to install patches, see the corresponding patch installation guide. For
details about commands used for device upgrade, see "Basic Configurations Commands
- Upgrade Commands" in the CloudEngine 8800&7800&6800&5800 Series Switches
Command Reference.
l Another way is to specify a patch file for next startup, which is described in this chapter.
The patch file takes effect after the device reboots. The method is often used during a
system upgrade.
Configuration Process
Perform one or multiple of the following tasks:
Procedure
l Save the configurations automatically.
a. Run:
system-view
The server information is configured. The information includes the IP address of the
server to which the configuration is automatically saved, user name and password,
the path to save the configuration file, and the mode in which the configuration file
is transmitted to the server.
NOTE
SFTP has higher security and is therefore recommended for saving the configuration file in the
file server.
The configuration file is saved on the server as a compressed package. The package is named in
the format of [Link] [Link], for example,
[Link]. After the package is decompressed, the file with the file
name extension of .cfg is the configuration file.
d. (Optional) Run:
configuration current backup-to-server monthly date date-value [ time
time-value ]
The function to upload a configuration file to the server on a specific date and time
every month is enabled.
By default, the function to upload a configuration file to the server on a specific
date and time every month is disabled.
e. Run:
commit
n You can run the cd (user view) command in the user view to modify the
current storage directory.
----End
NOTE
Procedure
l Run:
display configuration changes [ running file file-name | file file-name
running ]
The system starts to check whether the current running configurations are identical with
the specified configuration file.
l Run:
display configuration changes [ running label label | label label running ]
The system starts to check whether the current running configurations are identical with
the configuration based on a specific user label.
l Run:
compare configuration [ configuration-file ]
The system starts to check whether the current configurations are identical with the next
startup configuration file or a specified configuration file.
After completing a series of operations, you can compare whether the current
configurations are the same as the configurations in the next startup configuration file or
a specified configuration file starting from the first line of the current configurations.
You can determine whether to save the current configurations based on the comparison
result and specify the current configurations as the next startup configuration file.
After you run this command to compare the current configurations with the next startup
configuration file or a specified configuration file, the system displays the different
content starting from the first different line to the ninth different line. If the different
content contains fewer than nine lines, the system displays only the content from the first
different line to the end of the file.
----End
Procedure
l Copying the content in the display on the screen
Run the display current-configuration command and copy all command outputs to
a .txt file. The configuration file is backed up in the hard disk of the maintenance
terminal.
NOTE
If a configuration is too long, it may be displayed in two lines on the terminal screen, depending
on the terminal software. When copying a two-line configuration from the screen to a .txt file,
ensure that the configuration is displayed in only one line. Otherwise, configuration restoration
may fail when the .txt file is used.
l Backing up the configuration file to the storage device
The current configuration file can be backed up immediately to the flash memory of the
device. After the device starts, run the following commands to back up the configuration
file to the flash memory of the device:
<HUAWEI> save [Link]
<HUAWEI> copy [Link] [Link]
If the FTP user is authenticated, the FTP client displays the prompt character of
ftp>. Enter binary following the prompt character, and specify the path the
uploaded file is to be saved on the FTP client.
ftp> binary
200 Type set to I.
ftp> lcd c:\temp
Local directory now C:\temp.
On the PC, run the get command to load the configuration file to the specified path
and save the file as [Link].
ftp> get [Link] [Link]
e. Check whether the [Link] and [Link] files have the same size. If they have
the same size, the backup is successful.
----End
Context
When incorrect configurations are performed and functions are abnormal, you can use one of
the following methods:
l Recovering the configuration file that is backed up in the storage device
l Recovering the configuration file using FTP, TFTP, SFTP, or SCP
Procedure
l Recovering the configuration file that is backed up in the flash.
a. Recover the backup configuration file stored in the of the device to the current
system configuration file. When the device is working properly, run the following
command.
<HUAWEI> copy flash:/[Link] flash:/[Link]
Enable the FTP server function on the device. Create an FTP user with the name
huawei and password Helloworld@6789. The user is authorized to access the flash
directory.
<HUAWEI> system-view
[~HUAWEI] ftp server enable
Warning: FTP is not a secure protocol, and it is recommended to use SFTP.
[*HUAWEI] aaa
[*HUAWEI-aaa] local-user huawei password irreversible-cipher
Helloworld@6789
[*HUAWEI-aaa] local-user huawei ftp-directory flash:
[*HUAWEI-aaa] local-user huawei service-type ftp
[*HUAWEI-aaa] local-user huawei level 15
[*HUAWEI-aaa] commit
On the PC, set up an FTP connection to the device through the FTP client. Assume
that the device IP address is [Link].
C:\Documents and Setting\Administrator> ftp [Link]
Connected to [Link].
220 FTP service ready.
User ([Link]:(none)): huawei
331 Password required for huawei.
Password:
230 User logged in.
If the FTP user is authenticated, the FTP client displays the prompt character of
ftp>. Enter binary following the prompt character, and specify the path where the
uploaded file is to be saved on the FTP client.
ftp> binary
200 Type set to I.
ftp> lcd c:\temp
Local directory now C:\temp.
On the PC, run the put command to upload the configuration file to the specified
path and save the file as [Link].
ftp> put [Link] [Link]
e. Check whether the [Link] file is successfully uploaded. If the [Link] file
exists on the device and has the correct size, the configuration file recovery is
successful.
----End
Context
You need to delete the configuration file when:
l The software and configuration file do not match after the device software is upgraded.
l The configuration file is damaged or an incorrect configuration file is loaded.
NOTICE
Exercise caution when you run the reset saved-configuration command. You are advised to
run this command under the guide of technical support personnel.
To configure an interface on a device for other use, original configurations on the interface
need to be deleted one by one. If the interface has a large number of configurations, deleting
these configurations one-by-one takes a long time and increases the maintenance workload.
To reduce the maintenance workload and simplify the deletion operation, you can perform
one-touch configuration clearance on an interface.
Procedure
l Run the reset saved-configuration command to cancel the configuration file used for
next startup. The default device configurations are restored.
NOTE
If the next startup configuration file is empty, the device displays a message indicating that the file
does not exist.
l Delete configurations on an interface at a time to restore the default configurations.
For details, see Table 8-2.
Table 8-2 Commands for deleting configurations on an interface at a time to restore the
default configurations
View Command Description Precautions
l Clear the inactive configurations of the device that have not been installed.
a. Run:
system-view
NOTE
----End
Context
If faults are caused by incorrect configurations or an unexpected configuration result occurs
on the network after the configuration is submitted, you can roll back the configuration.
Before you roll back the configuration, the device has used either of two modes to submit the
configuration and generated a configuration rollback point.
l Immediate mode: After you enter the command and press Enter, the system checks
whether the current configuration is the same as the historical configuration. If they are
different, the system submits the configuration and generates the configuration rollback
point. Therefore, multiple configuration rollback points may be generated when one
feature is deployed.
l Two-stage mode: When running a series of configuration commands, you must use the
commit [ label label ] [ description description ] command to enable the system to
compare the current configuration with the historical configuration and generate a
configuration rollback point. In this way, all configurations for a certain service using a
series of commands can take effect. To quickly find the required configuration rollback
point, specify description description to configure the point description. You are advised
to use this mode to edit and submit the configuration.
Procedure
Step 1 Check the configuration rollback points and the latest configuration changes.
1. Run:
display configuration commit list [ verbose ] [ number-of-commits | label ]
Return to the user view to ensure that all data has been submitted before rollback.
2. Run:
rollback configuration { to { commit-id commit-id | label label | file file-
name } | last number-of-commits }
The system is rolled back to the historical configuration state based on the specified
configuration rollback point , a user label for a configuration rollback point, a
configuration file for configuration rollback, or the number of configuration changes.
Based on the configured rollback rule, run this command to delete the created
configuration, re-create the deleted configuration, or recover the quondam configuration.
– To roll back the system to the historical configuration state at a certain
configuration rollback point, specify commit-id commit-id.
– To roll back the system to the historical configuration state at a user label for a
configuration rollback point, specify label label.
– To roll back the system to the historical configuration state at a configuration file
for configuration rollback, specify file file-name.
– To roll back the system to the historical configuration state before one or more
latest configuration rollback points, specify last number-of-commits.
NOTE
After the configuration rollback operation is complete, you can run the display configuration
rollback result command to view the result of the latest configuration rollback operation.
----End
Context
Before specifying the files for next startup, you can run the display startup command to view
the specified files for next startup.
l If no system software is specified for next startup, the device will start with current
system software. To change the system software to be loaded for next startup (during an
upgrade for example), upload the new system software to the device and specify it as the
system file for next startup. The system software package must use .cc as the file name
extension and be saved to the root directory of the storage device.
l If no configuration file is specified for next startup, the device will start with the default
configuration file ([Link] for example). If no configuration file is stored in the
default directory, the device uses the default parameters for initialization. The
configuration file name extension must be .cfg, .dat, or .zip. In addition, the
configuration file must be saved to the root directory of the storage device.
l A patch file uses .pat as the file name extension. The specified patch file to be loaded for
next startup must also be saved to the root directory of the storage device.
Procedure
l Run:
The device reads the configuration file from the root directory of the storage device for
initialization when powered on.
l (Optional) Run:
startup patch patch-name { all | slot slot-id }
To make the patch file take effect after the device restarts, run this command to specify
the patch file for next startup.
----End
Context
If a required module does not exist in the system, you can use dynamic module loading to
successfully load the module file of the required module to the system, and use functions
corresponding to the module. You can also dynamically uninstall the module if the module
functions are not required.
Pre-configuration Tasks
Obtain the .mod or .MOD file and upload the file to the switch.
Procedure
l Load a module dynamically.
Run:
install-module file-name [ next-startup ]
Run:
uninstall-module { file-name [ next-startup ] | all }
----End
Context
Use either of the following methods to restart the device:
l Restart the device immediately after configuration: The device restarts immediately after
the reboot command is run.
l Restart the device at scheduled time: The device can be restarted at a specified time later.
When the configuration is complete, you can configure the device to restart at time when
few services are running to minimize the impact of device restart on services.
The device restarts with the specified startup software. If the specified startup software is
damaged, the device restarts with the startup software that works last time. If the software for
last startup does not exist, the device searches for a valid startup software package on the
storage devices.
NOTE
In a stack, when the system startup configuration file is large, member devices may register slowly during the
system startup.
NOTICE
l Do not restart the device unless necessary because device restart causes service
interruption in a short time.
l Save the current configuration so that it will take effect after the device restarts.
Procedure
l Restart the Device Immediately
In the user view, run the reboot [ fast | save diagnostic-information ] command to
restart the device.
– The fast parameter indicates quick restart of the device. The system does not ask
you whether to save the configuration file in fast startup.
– save diagnostic-information indicates that the system will save the diagnostic
information to root directory of the storage device before restarting.
l Restart the Device at Scheduled Time
In the user view, run the schedule reboot { at time | delay interval [ force ] } command
to restart the device at scheduled time.
----End
Networking Requirements
As shown in Figure 8-2, a user logs in to the device and backs up the configuration file to the
TFTP server. So the configuration file can be recovered in case that the device is damaged.
Network
Configuration Roadmap
The configuration roadmap is as follows:
NOTICE
Configuration file backup through TFTP is simple, but there are security risks. In
scenarios with high security requirements, configuration file backup through SFTP or
SCP is recommended. The following describes the configuration file backup process
using TFTP as an example.
Procedure
Step 1 Save configurations to the [Link] file.
<HUAWEI> save [Link]
Start the TFTP server program on the PC. Set the path for transmitting the configuration
file, and the IP address and port number of the TFTP server.
2. Transfer the configuration file.
# Run the tftp command in the user view to back up the specified configuration file.
<HUAWEI> tftp [Link] put flash:/[Link] [Link]
----End
Networking Requirements
As shown in Figure 8-3, a user logs in to the device and finds that some incorrect
configurations cause errors in the system. To recover the original configuration, the user
downloads the configuration file saved in the TFTP server to the device and specifies the
configuration file for the next startup.
Network
Configuration Roadmap
The configuration roadmap is as follows:
NOTICE
Configuration file recovery through TFTP is simple, but there are security risks. In
scenarios with high security requirements, configuration file recovery through SFTP or
SCP is recommended. The following describes how to recover the configuration file that
is backed up on a PC through TFTP.
Procedure
Step 1 Recover the configuration file that is backed up on the PC through TFTP.
1. Start the TFTP server program.
Start the TFTP server program on the PC. Set the path for transmitting the configuration
file, and the IP address and port number of the TFTP server.
2. Transfer the configuration file.
Step 2 Specify the recovered configuration file for the next startup.
<HUAWEI> startup saved-configuration [Link]
----End
Networking Requirements
As shown in Figure 8-4, a user logs in to the switch and configures an IP address for each
switch interface. Generally, after submitting the configuration, the user cannot check the latest
configurations and can only check the current configuration file. When the configurations are
incorrect or an unexpected configuration result occurs on the network, the user can only
manually delete or modify the configurations one by one and cannot perform the batch
recovery operation.
Network0 Network2
Switch
10GE1/0/1 10GE1/0/3
10GE1/0/2 10GE1/0/4
Network1 Network3
To solve the preceding problem, the user can check the difference between the historical and
current configurations and roll back the system configuration to the appropriate configuration
point without restarting the system or interrupting services.
In this example, the user finds that IP addresses are incorrectly configured for interfaces and
wants to reconfigure them. By using the traditional method, the user must enter each interface
view to delete the corresponding IP address and reconfigure the IP address. By using the
configuration rollback function, the user can recover the configurations to the configuration
state when the IP addresses have not been configured, which greatly simplifies configuration
recovery.
Configuration Roadmap
The configuration roadmap is as follows:
l Check the configuration rollback points and the latest configuration changes.
l Determine the configuration rollback point or the number of configuration changes to
roll back the configuration.
Procedure
Step 1 Configure IP addresses for 10GE1/0/1, 10GE1/0/2, 10GE1/0/3, and 10GE1/0/4 on the switch.
<HUAWEI> system-view
[~HUAWEI] sysname Switch
[*HUAWEI] commit
[~Switch] vlan batch 77 to 80
[*Switch] interface vlanif 77
[*Switch-Vlanif77] ip address [Link] 24
[*Switch] quit
[*Switch] interface vlanif 78
[*Switch-Vlanif78] ip address [Link] 24
[*Switch] quit
[*Switch] interface vlanif 79
[*Switch-Vlanif79] ip address [Link] 24
[*Switch] quit
[*Switch] interface vlanif 80
[*Switch-Vlanif80] ip address [Link] 24
[*Switch] quit
[*Switch] interface 10ge 1/0/1
[*Switch-10GE1/0/1] port link-type trunk
[*Switch-10GE1/0/1] port trunk allow-pass vlan 77
[*Switch-10GE1/0/1] quit
[*Switch] interface 10ge 1/0/2
[*Switch-10GE1/0/2] port link-type trunk
[*Switch-10GE1/0/2] port trunk allow-pass vlan 78
[*Switch-10GE1/0/2] quit
[*Switch] interface 10ge 1/0/3
[*Switch-10GE1/0/3] port link-type trunk
[*Switch-10GE1/0/3] port trunk allow-pass vlan 79
[*Switch-10GE1/0/3] quit
[*Switch] interface 10ge 1/0/4
[*Switch-10GE1/0/4] port link-type trunk
[*Switch-10GE1/0/4] port trunk allow-pass vlan 80
[*Switch-10GE1/0/4] quit
[*Switch] commit
[~Switch] quit
Step 2 Check the configuration rollback points and the difference between the historical and current
configurations.
# Check the configuration rollback points.
<Switch> display configuration commit list verbose
1) CommitId: 1000000006
Label: -
User: root
User-Intf: VTY 1
Type: CLI
TimeStamp: 2012-06-29 15:55:20
Description:
2) CommitId: 1000000005
Label: -
User: root
User-Intf: VTY 1
Type: CLI
TimeStamp: 2012-06-29 15:50:05
Description:
3) CommitId: 1000000004
Label: -
User: root
User-Intf: VTY 0
Type: CLI
TimeStamp: 2012-06-29 09:57:34
Description:
4) CommitId: 1000000003
Label: -
User: root
User-Intf: VTY 0
Type: CLI
TimeStamp: 2012-06-29 09:57:21
Description:
5) CommitId: 1000000002
Label: -
User: anonymous
User-Intf: CON 0
Type: CLI
TimeStamp: 2012-06-28 16:31:48
Description:
6) CommitId: 1000000001
Label: -
User: anonymous
User-Intf: CON 0
Type: CLI
TimeStamp: 2012-06-28 16:31:48
Description:
#
interface 10GE1/0/2
+ port link-type trunk
+ port trunk allow-pass vlan 78
#
interface 10GE1/0/3
+ port link-type trunk
+ port trunk allow-pass vlan 79
#
interface 10GE1/0/4
+ port link-type trunk
+ port trunk allow-pass vlan 80
#
# Roll system configurations back to what they were before the most recent configuration
rollback point was created.
<Switch> rollback configuration last 1
Warning: This operation will revert configuration changes to the previous status.
Continue? [Y/N]:y
Loading rollback changes
Committing
Check rollback result
Configuration rollback succeeded.
Please use 'display configuration commit changes last 1' to view the changes.
# Check whether a configuration rollback point is generated after the configuration rollback is
completed.
<Switch> display configuration commit list verbose
1) CommitId: 1000000007
Label: -
User: root
User-Intf: VTY 1
Type: ROLLBACK
TimeStamp: 2012-06-29 15:58:22
Description:
2) CommitId: 1000000006
Label: -
User: root
User-Intf: VTY 1
Type: CLI
TimeStamp: 2012-06-29 15:55:20
Description:
3) CommitId: 1000000005
Label: -
User: root
User-Intf: VTY 1
Type: CLI
TimeStamp: 2012-06-29 15:50:05
Description:
4) CommitId: 1000000004
Label: -
User: root
User-Intf: VTY 0
Type: CLI
TimeStamp: 2012-06-29 09:57:34
Description:
5) CommitId: 1000000003
Label: -
User: root
User-Intf: VTY 0
Type: CLI
6) CommitId: 1000000002
Label: -
User: anonymous
User-Intf: CON 0
Type: CLI
TimeStamp: 2012-06-28 16:31:48
Description:
7) CommitId: 1000000001
Label: -
User: anonymous
User-Intf: CON 0
Type: CLI
TimeStamp: 2012-06-28 16:31:48
Description:
----End
Configuration Files
Switch configuration file
#
sysname Switch
#
interface 10GE1/0/1
#
interface 10GE1/0/2
#
interface 10GE1/0/3
#
interface 10GE1/0/4
#
return
[Link]/24
Network
PC Device
Configuration Roadmap
The configuration roadmap is as follows:
1. Upload the new system software to the root directory of the device.
2. Save the current configuration so that it remains active after upgrade.
3. Specify the system software for next startup.
4. Specify the configuration file for next startup of the device.
5. Restart the device to complete upgrade.
Procedure
Step 1 Upload the new system software to the root directory of the device.
Before configuration, run the display startup command to view the files for next startup.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] quit
<Switch> display startup
MainBoard:
Configured startup system software: flash:/[Link]
Startup system software: flash:/[Link]
Next startup system software: flash:/[Link]
Startup saved-configuration file: flash:/[Link]
Next startup saved-configuration file: flash:/[Link]
Startup paf file: default
Next startup paf file: default
Startup patch package: NULL
Next startup patch package: NULL
# Upload the new system software to the device. This example uses FTP to transfer the
system software. Configure the device as an FTP server and upload the system software to the
device from the FTP client. Make sure there is enough space in the storage device before
uploading files. If the space is insufficient, delete unnecessary files to free up space in the
storage device.
<Switch> system-view
[Switch] ftp server enable
[Switch] aaa
[Switch-aaa] local-user huawei password irreversible-cipher Helloworld@6789
[Switch-aaa] local-user huawei service-type ftp
[Switch-aaa] local-user huawei ftp-directory flash:
[Switch-aaa] local-user huawei level 15
[Switch-aaa] commit
[Switch-aaa] quit
[Switch] quit
# Run the ftp [Link] command in the command line window of the PC to set up an FTP
connection with the device. Run the put command to upload new system software
[Link]. After the upload completes, run the dir command to check the system
software.
<Switch> dir
Directory of flash:/
NOTE
In step 1, you can run the display startup command to check the configuration file for next startup. The
message "Next startup saved-configuration file: flash:/[Link]" will be displayed. This means the
[Link] configuration file has been specified for next startup, so you do not need to perform this step.
To specify another file for next startup, perform this step.
# Run the following command to view the system software and configuration file for next
startup.
<Switch> display startup
MainBoard:
Configured startup system software: flash:/[Link]
Startup system software: flash:/[Link]
Next startup system software: flash:/[Link]
Startup saved-configuration file: flash:/[Link]
Next startup saved-configuration file: flash:/[Link]
Startup paf file: default
Next startup paf file: default
Startup patch package: NULL
Next startup patch package: NULL
# Since the configuration file has been saved, run the reboot fast command to restart the
device quickly.
<Switch> reboot fast
System will reboot! Continue? [Y/N]:y
Info: system is rebooting ,please wait...
# Wait for several minutes until the device restart is complete. Run the display version
command to check the current system version. If the current system software is new, the
upgrading has succeeded.
The display version command output is not provided here.
----End
Configuration File
#
FTP server enable
#
vlan batch 10
#
aaa
local-user huawei password irreversible-cipher $1c$g8wLJ`LjL!
$CyE(V{3qg5DdU:PM[6=6O$[Link],Q}>^)OBzgoU$
local-user huawei service-type ftp
local-user huawei level 15
local-user huawei ftp-directory flash:
#
interface Vlanif10
ip address [Link] [Link]
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
return
9 ISSU Configuration
In-Service Software Upgrade (ISSU) minimizes the service interruption time during a system
upgrade to improve service reliability.
Definition
In-Service Software Upgrade (ISSU) is a mechanism that upgrades the system software of a
stack or super virtual fabric (SVF) system while services are running. This mechanism
minimizes the service interruption time during system upgrades.
Purpose
On most networks, a device must be restarted after its system software is upgraded. The
restart interrupts services and traffic forwarding on the device. To relieve the impact of system
upgrades on services, you can set up multiple equal-cost links. Services can then be switched
to the backup links during a software upgrade. In this case, network configurations must be
modified, which increases the error probability and upgrade time. Additionally, services may
still be interrupted because some links may be too busy to transmit services.
ISSU provides a mechanism that allows a stack or SVF system to be upgraded while services
are running. This mechanism reduces the service interruption time during system upgrades.
Benefits
ISSU has the following advantages:
l Provides a simple and controllable upgrade mode.
l Effectively reduces the service interruption time caused by system upgrades.
9.2 Principles
Figure 9-1 and Figure 9-2 show the ISSU upgrade processes in a stack and the SVF system
respectively.
Slave Standby
4
Master Master
Standby Slave
Slave Slave
Old Version
New Version
Standby Standby
Master Master
Leaf Leaf
Leaf Leaf
Old Version
New Version
Version Rollback
ISSU provides a version rollback mechanism to allow a system to restore the previous version
during an ISSU upgrade. This mechanism reduces risks of version upgrades.
License Support
ISSU is a basic feature of a switch and is not under license control.
Version Support
For details, see Software Upgrade Path.
Notes:
l In V200R002C50 and later versions and VXLAN active-active or all-active access
scenarios, devices that have VXLAN active-active or all-active access configured can
be upgraded using ISSU.
l In TRILL active-active access scenarios, devices that have TRILL active-active access
configured cannot be upgraded using ISSU.
l Since V200R001C00, the remote mirroring function cannot be used with ISSU. The
remote mirroring function needs to be deleted from the switch in either of the following
situations:
– The switch needs to be upgraded from a version earlier than V200R001C00 to
V200R001C00 or later using ISSU.
– The switch needs to be upgraded from V200R001C00 or later using ISSU.
Precautions
Before performing an ISSU upgrade, ensure the following:
l The target system software has been uploaded to all member switches in a stack or to all
parent switches in an SVF system.
l Do not remove or reinstall optical module or power cycle the switch during an ISSU
upgrade.
l Ensure network stability and do not perform other service configurations on the network
during an ISSU upgrade.
l A standalone device cannot be upgraded using ISSU.
l A stack contains at least two member devices. If a stack contains three or more member
switches, only a stack connected in a ring topology can be upgraded using ISSU.
l In V100R006C00 and earlier versions, a stack of CE5855EI switches cannot be
upgraded using ISSU.
l A stack with more than two CE7850EI or CE6850HI switches cannot be upgrade from
V100R005C00SPC300 or V100R005C10SPC100 to V100R005C10SPC200 using ISSU.
l During the ISSU upgrade of a stack system, to ensure nonstop traffic forwarding, you
must use dual-homing networking. That is, connect ports on different cards to each other.
l During the ISSU upgrade of an SVF system, all the leaf switches must be dual-homed to
two parent switches.
l After the system resource mode is set to configurable in V100R003C00SPC600, a stack
of CE5850EIs cannot be upgraded to V100R005C00SPC300 using ISSU.
l When 40GE QSFP+ AOC cables are used for stack connections, the stack cannot be
upgraded using ISSU upgraded from a version earlier than V100R005C10 to
V100R005C10 or a later version.
l During an ISSU upgrade from V100R003C00 or V100R003C10 to a later version, after
port split is configured, the device is restarted to make the configuration take effect. If
the device is not restarted, the ISSU upgrade fails.
l When Layer 2 interconnection is implemented between data centers using EVN, backup
will be achieved among gateways of multiple data centers using VRRP, and VRRP
packets will be transparently transmitted over the EVN network. If you perform an ISSU
upgrade, run the vrrp vrid 1 timer advertise 5 command to set the interval at which the
master and backup devices in the VRRP group send VRRP packets to 5s before
upgrading EVN devices. This configuration prevents the backup device from becoming
the master device during the ISSU upgrade.
Notes
l If the upgrade path is not provided, ISSU upgrade is not supported.
Pre-configuration Tasks
Before configuring ISSU, complete the following tasks:
l Uploading the target system software to all member switches in a stack or to all parent
switches in an SVF system
Configuration Process
Perform the following configuration tasks in sequence.
Context
During an ISSU upgrade of an SVF system, the system groups leaf switches and upgrades the
leaf switches in ascending order of their group IDs.
By default, the system adds a device to a default group. You can manually add a device to a
different group to change the sequence in which devices are restarted. Upstream and
downstream devices then connect to devices in different groups, reducing the service
interruption time.
NOTE
You can add only leaf switches in an SVF system but not slave switches in a stack to a specified group.
Procedure
Step 1 (Optional) Run the display issu group command in the user view to check to which group the
current device belongs.
Step 2 Run the issu group group-id add slot slot-id command in the user view to add a device to the
specified group.
By default, the system adds a device to a default group. You can run the issu group reset
command to restore the group to which the current device belongs to the default group.
----End
Context
At the ISSU check phase, the system performs compatibility checks, such as the environment
check, hardware and software compatibility check, and version file integrity and validity
check to determine whether the ISSU upgrade can be performed.
Procedure
Step 1 Run the issu check system-file [ patch patch-name ] command in the user view to check
whether the ISSU upgrade can be performed.
After the ISSU pre-upgrade check is complete, run the display issu check-result command in
the user view to view the ISSU pre-upgrade check result.
----End
Context
Two ISSU upgrade modes are available according to the upgrade confirmation mode:
l Automatically confirmed upgrade: The system confirms the ISSU upgrade after the
ISSU start phase ends, so you do not need to run the issu confirm command to confirm
the ISSU upgrade. This mode implements one-click upgrade.
l Manually confirmed upgrade: After the ISSU start phase ends, you need to run the issu
confirm command to confirm the ISSU upgrade before the rollback timer expires.
Otherwise, the system rolls back to the previous software version after the rollback timer
expires.
NOTE
During the ISSU upgrade, the remote connection will be interrupted. Wait for about 20 seconds and then log
in the device again.
Procedure
l Configure automatically confirmed upgrade.
a. Run the issu start system-file [ patch patch-name ] command in the user view to
start the ISSU upgrade.
l Configure manually confirmed upgrade.
a. Run the issu start rollback-timer [ time ] system-file [ patch patch-name ]
command in the user view to start the ISSU upgrade.
By default, the ISSU rollback timer is 120 minutes.
b. (Optional) Run the issu reset rollback-timer [ time | limitless ] command in the
user view to reset the value of the ISSU rollback timer.
The ISSU rollback timer starts timing when the ISSU upgrade enters the ISSU start
phase. If the timer expires before the ISSU upgrade enters the ISSU confirm phase,
the system rolls back to the previous software version. After the ISSU upgrade
enters the ISSU start phase, you can reset the value of the timer according to
network requirements. After the rollback timer value is set, the new timer value
takes effect and the old timer value does not take effect.
c. (Optional) Run the issu abort command in the user view to abort the ISSU upgrade
so that the system can roll back to the previous software version.
To abort an ISSU upgrade, run the issu abort command to abort the ISSU upgrade
after the ISSU start phase ends. You can run the display issu state command to
check whether the ISSU start phase ends. If the issu start field displays finished,
the ISSU start phase ends. The system then restarts and rolls back to the previous
software version.
d. Run the issu confirm command in the user view to confirm the ISSU upgrade.
NOTE
In a manually confirmed upgrade, run this command to confirm the ISSU upgrade before the
rollback timer expires. Otherwise, the system rolls back to the previous version.
----End
Procedure
l Run the display issu state command in the user view to check which phase the ISSU
upgrade enters.
l Run the display issu rollback-timer command in the user view to check remaining time
of the ISSU rollback timer.
l Run the display issu report command in the user view to check detailed information
about the ISSU upgrade.
----End
Networking Requirements
As shown in Figure 9-3, a stack has two member devices, SwitchA and SwitchB, which
function as the master switch and standby switch. SwitchA at [Link]/24 functions as the
FTP server, and the PC at [Link]/24 functions as the FTP client. There are reachable routes
between the FTP server and client.
NOTE
FTP cannot ensure secure file transfer. If you require high network security, use SFTP.
The current system software version cannot meet users requirements and needs to be
upgraded, and the service interruption time caused by the upgrade must be minimized.
[Link]/24
Internet
SwitchA SwitchB PC
Master Standby [Link]/24
Configuration Roadmap
The configuration roadmap is as follows:
1. Upload the target system software to SwitchA and SwitchB.
2. Perform a pre-upgrade check to confirm that the system meets ISSU upgrade
requirements.
3. Start the ISSU upgrade.
Procedure
Step 1 Upload the target system software to SwitchA and SwitchB.
# Start FTP in the stack and set the FTP user name to ftpuser and password to
pWD@123456.
<HUAWEI> system-view
[~HUAWEI] ftp server enable
[*HUAWEI] commit
[~HUAWEI] aaa
[~HUAWEI-aaa] local-user ftpuser password irreversible-cipher pWD@123456
[*HUAWEI-aaa] local-user ftpuser service-type ftp
[*HUAWEI-aaa] local-user ftpuser level 3
[*HUAWEI-aaa] local-user ftpuser ftp-directory flash:/
[*HUAWEI-aaa] quit
[*HUAWEI] commit
[~HUAWEI] quit
# On the PC, initiate an FTP connection with SwitchA, enter the FTP user name and
password, and set the file transfer format to binary and the working directory to c:\temp.
C:\Documents and Settings\Administrator> ftp [Link]
Connected to [Link].
220 FTP service ready.
User ([Link]:(none)): ftpuser
331 Password required for ftpuser.
Password:
230 User logged in.
ftp> binary
200 Type set to I.
ftp> lcd c:\temp
Local directory now C:\temp.
# On the PC, upload the target system software and patch file from c:\temp to SwitchA.
ftp> put [Link]
200 Port command okay.
150 Opening BINARY mode data connection for /[Link].
226 Transfer complete
ftp> put [Link]
200 Port command okay.
150 Opening BINARY mode data connection for /[Link].
226 Transfer complete
# Copy the target system software and patch file on SwitchA to SwitchB and SwitchC.
<HUAWEI> copy flash:/[Link] all#flash:/CE6850EI-
[Link]
Info: Are you sure to copy flash:/[Link] to all#flash:/
[Link]? [Y/N]:y
100% complete
Info: Copying file flash:/[Link] to all#flash:/CE6850EI-
[Link]...Done.
<HUAWEI> copy flash:/[Link] all#flash:/CE6850EI-
[Link]
Info: Are you sure to copy flash:/[Link] to all#flash:/
[Link]? [Y/N]:y
100% complete
Info: Copying file flash:/[Link] to all#flash:/CE6850EI-
[Link]...Done.
------------------------------------------------------------------------------
Info: The upgrade procedure is:
Reboot the slave board with the upgrade system software.
Create standby process with the upgrade system software, and detailed process
groups are as follows:
process group: 10005 slot: 1
process group: 10006 slot: 1
Upgrade process with the upgrade system software, and detailed process groups
are as follows:
process group: 10005 slot: 1
process group: 10006 slot: 1
process group: 3 slot: 1
process group: 1000 slot: 1
process group: 10001 slot: 1
process group: 1002 slot: 1
process group: 1001 slot: 1
process group: 2 slot: 1
process group: 10002 slot: 1
Reboot the master board with the upgrade system software.
------------------------------------------------------------------------------
NOTE
During the ISSU upgrade, the remote connection will be interrupted. Wait for about 20 seconds and then log
in the device again.
# After logging in to the device again, run the display issu state command to check the
upgrade progress.
<SwitchA> display issu state
--------------------------------------------------------------------------------
Phase State Progress
--------------------------------------------------------------------------------
[Link] check : finished 100%
[Link] start : finished 100%
[Link] confirm : - 0%
--------------------------------------------------------------------------------
# When the issu start status displays finished, the ISSU start phase ends. You can run the
issu confirm command to confirm the ISSU upgrade.
NOTE
During the ISSU upgrade, if the rollback timer value is set, confirm the ISSU upgrade before the rollback
timer expires. Otherwise, the system rolls back to the previous version.
<SwitchA> issu confirm
Info: Operating, please wait for a
moment............................................
Info: The upgrade is complete, and the system is running target system software.
done.
---------------------------------------------------------------------------
Upgrade procedure details:
slot: 1 [reboot]
begin time: 2015/08/15 16:46:07
end time: 2015/08/15 16:54:26
duration: 0 Hours 8 Minutes 19 Seconds
slot: 2 [upgrade process]
process group: 10003
begin time: 2015/08/15 16:54:32
end time: 2015/08/15 16:56:04
duration: 0 Hours 1 Minutes 32 Seconds
slot: 2 [upgrade process]
process group: 10004
begin time: 2015/08/15 16:54:33
end time: 2015/08/15 16:56:04
duration: 0 Hours 1 Minutes 31 Seconds
slot: 2 [reset process]
process group: 3
begin time: 2015/08/15 16:54:59
end time: 2015/08/15 16:55:52
duration: 0 Hours 0 Minutes 53 Seconds
slot: 2 [reset process]
process group: 1000
begin time: 2015/08/15 16:54:59
end time: 2015/08/15 16:55:53
duration: 0 Hours 0 Minutes 54 Seconds
slot: 2 [reset process]
process group: 10001
begin time: 2015/08/15 16:54:59
end time: 2015/08/15 16:55:54
duration: 0 Hours 0 Minutes 55 Seconds
slot: 2 [reset process]
process group: 1002
begin time: 2015/08/15 16:54:59
end time: 2015/08/15 16:55:55
duration: 0 Hours 0 Minutes 56 Seconds
slot: 2 [reset process]
process group: 1001
begin time: 2015/08/15 16:54:59
end time: 2015/08/15 16:55:56
duration: 0 Hours 0 Minutes 57 Seconds
slot: 2 [reset process]
process group: 2
begin time: 2015/08/15 16:54:59
end time: 2015/08/15 16:55:57
duration: 0 Hours 0 Minutes 58 Seconds
slot: 2 [reset process]
process group: 10002
begin time: 2015/08/15 16:54:59
end time: 2015/08/15 16:55:58
# Run the display startup command to check whether the current system software version is
correct.
<HUAWEI> display startup
MainBoard:
Configured startup system software: flash:/[Link]
Startup system software: flash:/[Link]
Next startup system software: flash:/[Link]
Startup saved-configuration file: flash:/[Link]
Next startup saved-configuration file: flash:/[Link]
Startup paf file: default
Next startup paf file: default
Startup patch package: flash:/[Link]
Next startup patch package: flash:/[Link]
SlaveBoard:
Configured startup system software: flash:/[Link]
Startup system software: flash:/[Link]
Next startup system software: flash:/[Link]
Startup saved-configuration file: flash:/[Link]
Next startup saved-configuration file: flash:/[Link]
Startup paf file: default
Next startup paf file: default
Startup patch package: flash:/[Link]
Next startup patch package: flash:/[Link]
----End
Configuration Files
None
10 BIOS Menu
The basic input/output system (BIOS) provides the configuration restoration and software
upgrade functions to ensure device security and implement basic device maintenance.
10.1 BIOS Menu Description
10.2 BIOS Memory Test Menu
10.3 BIOS Main Menu
10.4 Update from serial interface
10.5 Update from ethernet interface
10.6 Modify startup parameters
10.7 File system
10.8 DFX Submenu
10.9 Modify stack parameters
For details about how to log in to the device using the console port, see 6.2.1 Logging In to the Device
Through a Console Port. To use third-party terminal emulation software, set the communication
parameters correctly. If the parameter settings are incorrect, the BIOS menu operations will be abnormal
if you enter excess characters when operating the third party software through the BIOS menu.
Restart the device. When the following information is displayed, press CTRL+T within 3
seconds to enter the BIOS memory test menu for a system memory test.
Press CTRL+T for full memory test .............. 3
You have 30 seconds to select the submenu, the system will reboot when time is up.
Enter your choice(1-4): 3
[a] MSCAN ( 186s) [b] MARCH_SR ( 620s) [c] MARCH_LA ( 885s)
[d] MARCH_G ( 873s) [e] MARCH_LR ( 517s) [f] MARCH_RAW ( 1309s)
[g] MARCH_SS ( 964s) [h] MARCH_SL ( 1665s) [i] MARCH_U ( 516s)
[j] MARCH_B ( 493s) [k] MARCH_Y ( 117s) [l] MARCH_C- ( 346s)
[m] MOVI ( 582s) [n] MATS+ ( 157s) [o] MATS++ ( 240s)
[p] CHECKER ( 262s) [q] BUTTERFLY ( 801s) [r] SURROUND ( 1404s)
[s] PRBS-15 ( 21s) [t] PRBS-7 ( 3s) [u] QIOT ( 754s)
[v] PIN ( 0s) [w] ISSI ( 6186s) [x] NINESTEP ( 362s)
[y] INCREASE ( 101s) [0] Return To Upper Menu
You have 60 seconds to select the algorithm, the system will reboot when time is
up.
k t
NOW FULL MEMORY TEST ...........................start
Memory pin test start.
Memory pin DataBus test...........pass
Memory pin AddrBus test...........pass
Memory March y test start.
Memory March y test...............pass
Memory Prbs 7 test start.
Memory prbs 7 test................pass
Took time: 374s
NOTICE
When the device is running normally, it not recommended to perform a memory test.
After a memory test is complete, the device restarts.
For details about how to log in to the device using the console port, see 6.2.1 Logging In to the Device
Through a Console Port. To use third-party terminal emulation software, set the communication
parameters correctly. If the parameter settings are incorrect, the third-party software may enter excess
characters, leading to abnormal BIOS menu functions.
Restart the device. When the message Press CTRL+T for full memory test is displayed,
press Ctrl+T in 3 seconds to perform a memory test. If you do not need to test the memory,
no action is required. When the message Press CTRL+B to enter BIOS menu is displayed,
press Ctrl+B in 3 seconds to enter the BIOS main menu. The following example shows
information displayed on a CE6850EI. Information displayed on other models may be
different.
NOTICE
When the device is properly running, a memory test is not recommended.
Starting ...
Password:
Info: The entered password is the same as the default one. You are advised to
change the password to ensure security.
1. Continue to boot
2. Update from serial interface
3. Update from ethernet interface
4. Modify startup parameters
5. File system
6. Modify BIOS password
7. Modify console password
8. Restore factory defaults
9. Reboot
The leaf switches in a super virtual fabric (SVF) system support the 6. Modify stack
parameters menu. The menu is used to select the device's working mode. For details, see
10.9 Modify stack parameters. The BIOS menu is as follows:
BIOS Menu (Version: 281)
1. Continue to boot
2. Update from serial interface
3. Update from ethernet interface
4. Modify startup parameters
5. File system
6. Modify stack parameters
7. Modify BIOS password
8. Modify console password
9. Restore factory defaults
10. Reboot
NOTE
The description in Table 10-2 uses the information displayed on a CE6850EI as an example. Perform
operations according to the BIOS menu supported by the device.
Press CTRL+T for full memory test Press Ctrl+T in 3 seconds to perform a
memory test.
Perform this operation during the installation or
maintenance. The memory test is not a risky
operation but takes a long time. When the
device is properly running, a memory test is
not recommended.
Item Description
Press CTRL+B to enter BIOS menu Press Ctrl+B within 3 seconds to access the
BIOS main menu.
You can access the BIOS main menu to
perform operations such as the device upgrade
when failing to access the CLI on the device.
2. Update from serial interface Access the serial interface submenu to update
the complex programmable logical device
(CPLD) or modify the serial interface rate.
This operation can be performed after a PC is
connected to the device using the serial
interface, without other configuration.
However, the file transfer speed is low.
Item Description
Item Description
1. Continue to boot
2. Update from serial interface
3. Update from ethernet interface
4. Modify startup parameters
5. File system
6. Modify BIOS password
7. Modify console password
8. Restore factory defaults
9. Reboot
Serial Submenu
1. Update CPLD
2. Modify baud rate
3. Return
Item Description
2. Modify baud rate Modify the transmission rate on the serial interface. The
default transmission rate is 9600 bit/s.
The serial interface supports the following transmission
rates:
l 9600 bit/s
l 19200 bit/s
l 38400 bit/s
l 57600 bit/s
l 115200 bit/s
After the transmission rate on the serial interface is
modified, synchronize the transmission rate on the PC to
that on the serial interface and re-establish the connection.
1. Continue to boot
2. Update from serial interface
3. Update from ethernet interface
4. Modify startup parameters
5. File system
6. Modify BIOS password
7. Modify console password
8. Restore factory defaults
9. Reboot
Ethernet Submenu
1. Update CPLD
2. Update system software
3. Update system software with disk format
4. Modify parameters
5. Return
Item Description
2. Update system software Start the system software and patch file through the
Ethernet interface.
When no system software or patch file exists in the storage
medium, access this menu to download the required file
from the server and specify the downloaded file for the
next startup.
3. Update system software Format the storage medium and start the system software
with disk format and patch file through the Ethernet interface.
When the system version is incompatible or the device
cannot be started using the menu Update system software,
access this menu to format the system software or patch
file.
Access the Ethernet interface submenu and select 2 to access the menu for updating system
software. The following example shows information displayed on a CE6850EI. Information
displayed on other models may be different.
Ethernet Submenu
1. Update CPLD
2. Update system software
3. Update system software with disk format
4. Modify parameters
5. Return
If the device supports the combo interface, the menu for modifying parameters contains the
MEth port field, as shown in the following menu.
Please check network parameters:
'.' = clear field; '-' = go to previous field; Ctrl+C = quit
FTP type : TFTP
MEth port : MEth1 -
Server IP address : [Link] -
Switch IP address : [Link] -
Network Mask : [Link] -
Values of Ethernet interface parameters cannot contain spaces. The values must be numerals.
To delete the current setting, enter a period (.). To return to the preceding setting, enter a
hyphen (-). To cancel the configuration, press Ctrl+C. The Ethernet interface parameters are
as follows:
l MEth port: indicates a management interface. To select MEth1, enter 1. To select
MEth2, enter 2.
l Server IP address: indicates the IP address of the server.
l Switch IP address: indicates the IP address of the Ethernet interface on the device.
l Network Mask: indicates the subnet mask.
NOTE
The preceding Ethernet interface parameters (192.168.X.X is a private IP address.) are set during the
factory acceptance test. The output provided here is used for reference only. The actual output
information may differ from the preceding information. You can set the Ethernet interface parameters as
required.
Before accessing this menu, modify Ethernet interface parameters. After accessing this
menu, enter the required system software and patch file.
The device downloads the specified files from the server and starts using the specified system
software and patch file.
NOTE
If you do not need specify the new system software or patch file, press Enter and continue operations.
The device starts using the running system software or patch file.
When the device downloads a file, consecutive asterisks (#) are displayed. If the letter T is consecutively
displayed, the network is not properly connected. Check the network connectivity and try again.
Do not stop the TFTP server program when the device is loading a file.
NOTICE
After the storage medium is formatted through the Ethernet interface, all data in the storage
medium, including history system software and configuration files, is deleted. Exercise
caution when formatting the storage medium.
Ethernet Submenu
1. Update CPLD
2. Update system software
3. Update system software with disk format
4. Modify parameters
5. Return
Warning: This operation will delete all system data in the flash.
Continue now? Yes(y) or No(n): y
Please check network parameters:
'.' = clear field; '-' = go to previous field; Ctrl+C = quit
FTP type : TFTP
Server IP address : [Link] -
Switch IP address : [Link] -
Network Mask : [Link] -
If the device supports the combo interface, the menu for modifying parameters contains the
MEth port field, as shown in the following menu.
Please check network parameters:
'.' = clear field; '-' = go to previous field; Ctrl+C = quit
FTP type : TFTP
MEth port : MEth1 -
Server IP address : [Link] -
Switch IP address : [Link] -
Network Mask : [Link] -
Values of Ethernet interface parameters cannot contain spaces. The values must be numerals.
To delete the current setting, enter a period (.). To return to the preceding setting, enter a
hyphen (-). To cancel the configuration, press Ctrl+C. The Ethernet interface parameters are
as follows:
l MEth port: indicates a management interface. To select MEth1, enter 1. To select
MEth2, enter 2.
l Server IP address: indicates the IP address of the server.
l Switch IP address: indicates the IP address of the Ethernet interface on the device.
l Network Mask: indicates the subnet mask.
NOTE
The preceding Ethernet interface parameters (192.168.X.X is a private IP address.) are set during the
factory acceptance test. The output provided here is used for reference only. The actual output
information may differ from the preceding information. You can set the Ethernet interface parameters as
required.
Before accessing this menu, modify Ethernet interface parameters. After accessing this
menu, enter the required system software and patch file.
The storage medium is formatted, and then the device downloads the specified files from the
server and starts using the specified system software and patch file.
NOTE
When the device downloads a file, consecutive asterisks (#) are displayed. If the letter T is consecutively
displayed, the network is not properly connected. Check the network connectivity and try again.
Do not stop the TFTP server program when the device is loading a file.
Access the Ethernet interface submenu and select 4 to access the menu for modifying
parameters. The following example shows information displayed on a CE6850EI. Information
displayed on other models may be different.
Ethernet Submenu
1. Update CPLD
2. Update system software
3. Update system software with disk format
4. Modify parameters
5. Return
If the device supports the combo interface, the menu for modifying parameters contains the
MEth port field, as shown in the following menu.
Please check network parameters:
'.' = clear field; '-' = go to previous field; Ctrl+C = quit
FTP type : TFTP
MEth port : MEth1 -
Server IP address : [Link] -
Switch IP address : [Link] -
Network Mask : [Link] -
l Values of Ethernet interface parameters cannot contain spaces. The values must be
numerals. To delete the current setting, enter a period (.). To return to the preceding
setting, enter a hyphen (-). To cancel the configuration, press Ctrl+C. The Ethernet
interface parameters are as follows:
– MEth port: indicates a management interface. To select MEth1, enter 1. To select
MEth2, enter 2.
– Server IP address: indicates the IP address of the server.
– Switch IP address: indicates the IP address of the Ethernet interface on the device.
– Network Mask: indicates the subnet mask.
NOTE
The preceding Ethernet interface parameters (192.168.X.X is a private IP address.) are set during
the factory acceptance test. The output provided here is used for reference only. The actual output
information may differ from the preceding information. You can set the Ethernet interface
parameters as required.
l Run the transfer protocol program on the PC and specify the directory where the system
software or patch file is stored. The following uses TFTP program as an example.
NOTE
The TFTP server program is not installed on the device. Customers need to buy the TFTP server
program and install it. The TFTPD32 program is recommended.
Run the TFTP server program on a PC and set the TFTP server parameters, as shown in
Figure 10-1.
– Current Directory: Click Browse and specify the directory for storing files to be
uploaded or downloaded.
– Server interfaces: Enter the TFTP server IP address, for example, [Link].
Generally, the system automatically sets this IP address.
1. Continue to boot
2. Update from serial interface
3. Update from ethernet interface
4. Modify startup parameters
5. File system
6. Modify BIOS password
7. Modify console password
8. Restore factory defaults
9. Reboot
Startup Submenu
3. Return
1. Display current startup Display the system software, configuration file, and
configuration patch file for startup.
You can view the system software, configuration file,
and patch file for the next startup before system
upgrade or rollback.
The system software, configuration file, and patch file for device startup are displayed.
The system software, configuration file, and patch file must exist in the storage medium.
Otherwise, the configuration fails.
To clear the current value, enter a period (.). To cancel the operation under the Modify
startup configuration menu, press Ctrl+C. To make the configuration take effect, press
Enter.
NOTE
If you do not need specify the new system software, configuration file, or patch file, press Enter and
continue operations. The device starts using the running system software, configuration file, or patch
file.
1. Continue to boot
2. Update from serial interface
3. Update from ethernet interface
4. Modify startup parameters
5. File system
6. Modify BIOS password
7. Modify console password
8. Restore factory defaults
9. Reboot
Item Description
2. Upload file to server Back up files to the server through the Ethernet
interface.
You can select this item to back up the system software,
configuration file, and patch file in the storage medium
before formatting the storage medium.
If the device supports the combo interface, the menu for modifying parameters contains the
MEth port field, as shown in the following menu.
Please check network parameters:
'.' = clear field; '-' = go to previous field; Ctrl+C = quit
FTP type : TFTP
MEth port : MEth1 -
Server IP address : [Link] -
Switch IP address : [Link] -
Network Mask : [Link] -
Values of Ethernet interface parameters cannot contain spaces. The values must be numerals.
To delete the current setting, enter a period (.). To return to the preceding setting, enter a
hyphen (-). To cancel the configuration, press Ctrl+C. The Ethernet interface parameters are
as follows:
l MEth port: indicates a management interface. To select MEth1, enter 1. To select
MEth2, enter 2.
l Server IP address: indicates the IP address of the server.
l Switch IP address: indicates the IP address of the Ethernet interface on the device.
l Network Mask: indicates the subnet mask.
NOTE
The preceding Ethernet interface parameters (192.168.X.X is a private IP address.) are set during the
factory acceptance test. The output provided here is used for reference only. The actual output
information may differ from the preceding information. You can set the Ethernet interface parameters as
required.
Before uploading files in the storage medium to the server, check files in the storage medium
by referring to 1. List flash files and set Ethernet interface parameters. For details about
Ethernet interface parameters, see Modify parameters.
1. Continue to boot
2. Update from serial interface
3. Update from ethernet interface
4. Modify startup parameters
5. File system
6. Modify BIOS password
7. Modify console password
8. Restore factory defaults
9. Reboot
******************************************************************
* You have entered Engineering Mode. In this mode, any operation *
* may cause irreversible damage to the device. Please note! *
******************************************************************
DFX Submenu
NOTE
Only the leaf switches in a super virtual fabric (SVF) system have this menu.
Access the BIOS main menu and select 6 to access the submenu for selecting the working
mode. The following example shows information displayed on a CE6810EI. Information
displayed on other models may be different.
6
Stack Submenu
Stack Submenu
Current leaf uplink-port type is "Auto negotiation mode", modify the type if
needed.
Stack Submenu
Context
The declaration information of an open source software includes the following items:
l Warranty Disclaimer
l Copyright Notice
l Written Offer
Procedure
l Run the display copyright command to check declaration information of an open source
software.
----End