No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

CX11x, CX31x, CX710 (Earlier Than V6.03), and CX91x Series Switch Modules V100R001C10 Configuration Guide 12

The documents describe the configuration of various services supported by the CX11x&CX31x&CX91x series switch modules The description covers configuration examples and function configurations.
Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
How to Use Command Lines

How to Use Command Lines

This section describes how to use command lines and some techniques to improve operating efficiency.

Entering Command Views

This section describes how to enter and exit from command views.

The device has many functions; therefore various configuration commands and query commands are provided to facilitate device management and maintenance. Huawei switch modules registers commands to different command views based on the functions of the commands, so users can easily use them. To use a function, enter the corresponding command view first and then run corresponding commands.

The device provides various command views. For the methods of entering the command views except the following views, see the CX11x&CX31x&CX91x Series Switch Modules Command Reference.

Common Command Views

Name

How To Enter

Function

User view

When a user logs in to the device, the user enters the user view and the following prompt is displayed on the screen:

<HUAWEI>

In the user view, you can view the running status and statistics of the device.

System view

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]

In the system view, you can set the system parameters of the device, and enter other function views from this view.

Interface view

Run the interface command and specify an interface type and number to enter an interface view.

[~HUAWEI] interface 10ge X/Y/Z
[~HUAWEI-10GEX/Y/Z] 
NOTE:
  • X/Y/Z indicates the number of an interface that needs to be specified. It is in the format of stack ID/sub card number/interface sequence number.

  • The interface 10GE is only an example.

You can configure interface parameters in the interface view. The interface parameters include physical attributes, link layer protocols, and IP addresses.

Routing protocol view

Run a command to activate the routing protocol process in the system view. The corresponding routing protocol view is displayed.

[~HUAWEI] isis
[~HUAWEI-isis-1] 

In routing protocol views, you can configure most routing protocol parameters. The routing protocol views include the IS-IS view, the OSPF view, and the RIP view.

NOTE:
  • 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 user view.

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

  • In the system view, you can run the diagnose command to enter the diagnosis view. Diagnostic commands are used for device fault diagnosis. If you run some commands in the diagnosis view, the device may run improperly or services may be interrupted. Contact Huawei technical support personnel and use these diagnostic commands with caution.
Quitting Command Views

You can run the quit command to return from the current view to an upper-level view.

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>

If you want 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> 
# Run the return command to return directly to the user view.
[~HUAWEI-aaa] return
<HUAWEI> 

Selecting a Mode for the Configuration to Take Effect

The system allows configurations to take effect immediately or in two stages to ensure reliability of user configurations.

Before configuring a service, enter the system view. After the system view is displayed, the system initiates the corresponding configuration process based on the configured mode.

  • The immediate mode is the traditional mode.

    After you enter a command line and press Enter, the system performs the syntax check. The configuration takes effect as soon as it passes the syntax check.

  • In the two-stage mode, the system configuration process is divided into two stages.

    • In the first stage, a user enters command lines and the system performs syntax and semantics checks in the candidate database. If syntax or semantics errors are found in the command lines, the system displays a message on the terminal to inform the user of the error and the cause.

    • In the second stage, a user commits the configuration, and the system enters the configuration commitment stage. The system delivers configurations in the candidate database to a service. If the configurations take effect, the system adds them to the running database of the current system. During the configuration commitment stage, the system checks the configuration validity and displays messages when configurations in the candidate databases are identical with those in the running databases.

Table 1-1 Advantages and disadvantages of each mode

Mode

Advantage

Disadvantage

Immediate mode

The system can immediately detect the configuration impact on services.

Configuration errors impact services immediately because configurations take effect immediately. Besides, you cannot delete configurations from the services as a whole but have to delete commands one by one.

Two-stage mode

  • Allows several service configurations to take effect as a whole.
  • Allows users to preview configurations in the candidate database.
  • Clears a configuration that does not take effect if an error occurs or the configuration does not meet the expectation.
  • Minimizes the impact of configuration process on current services.

Configurations take effect only after the commit command is run.

Immediate Mode

Procedure

Command

Description

Enable the immediate mode.

system-view immediately

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

Procedure

Command

Description

Enable the two-stage mode.

system-view

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

The following is an example:

<HUAWEI> system-view
Enter system view, return user view with return command.
[~HUAWEI] sysname HUAWEIA
[*HUAWEI] commit
[~HUAWEIA]
NOTE:
The symbol * has two meanings:
  1. When * is displayed in an interactive operation, it indicates the configurations that have not been submitted.
  2. After the display current-configuration inactive or display current-configuration all command is executed, * in the command output indicates offline configuration.

(Optional) Display all uncommitted configurations.

display configuration candidate [ merge ]

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.

(Optional) Delete all the uncommitted configurations.

clear configuration candidate

If you do not need to execute the uncommitted configurations in the current configuration process, you can delete them.

Commit configurations.

commit

-

NOTE:
  • 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.

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

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

Setting Command Levels

The system divides commands into four levels and sets the command level in the specified view. The device administrator can change the command level as required, so that a lower-level user can use some high-level commands. The device administrator can also change the command level to a larger value to improve device security.

Context

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

    Table 1-2 Relationship between command levels and user levels

    User Level

    Command Level

    Name

    Description

    0

    0

    Visit level

    Commands of this level include network diagnosis tool commands (such as ping and tracert), commands for accessing external devices from the local device (such as Telnet) and some display commands.

    1

    0, 1

    Monitoring level

    Commands of this level are used for system maintenance, including display commands.

    NOTE:

    Some display commands are not at this level. For example, the display current-configuration and display saved-configuration commands are at level 3. For details about command levels, see the CX11x&CX31x&CX91x Series Switch Modules Command Reference.

    2

    0, 1, 2

    Configuration level

    Commands of this level are used for service configuration to provide direct network services, including routing commands and commands of each network layer.

    3 to 15

    0, 1, 2, 3

    Management level

    Commands of this level are used for basic system operations, including file system, FTP, TFTP download, user management, command level configuration, and debugging.

  • If refined right management is required, run the command-privilege level rearrange command to extend command levels.

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

  1. Run:

    system-view

    The system view is displayed.

  2. Run:

    command-privilege level level view view-name command-key

    The command level is set in the specified view.

  3. (Optional) Run:

    command-privilege level rearrange

    The command levels are extended in a batch.

    You can use the command only when your user level is 15.

    If the level of a command has been changed using the command-privilege level command, the level of this command remains unchanged after you run the command-privilege level rearrange command. Levels of the other commands are changed as follows:

    • The visit level and monitoring level are retained.

    • The configuration level is upgraded to level 10, and the management level is upgraded to level 15.

    The original command levels 0, 1, 2, and 3 are updated to 0, 1, 10, and 15 respectively. There are no commands at levels 2 to 9 and levels 11 to 14. You can set commands to any of these levels to manage user rights.

  4. Run:

    commit

    The configuration is committed.

Editing Command Lines

This sections describes operating techniques for editing command lines.

Editing Feature

You can edit commands in a CLI that supports multi-line edition. Each command can contain a maximum of 1022 characters. The keywords in the commands are case insensitive. Whether a command parameter is case sensitive or not depends on what the parameter is.

Table 1-3 lists keys that are frequently used for command editing.

Table 1-3 Keys for command editing

Key

Function

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+B

Moves the cursor to the left by the space of a character. When the cursor reaches the head of the command, an alarm is generated.

Right cursor key → or Ctrl+F

Moves the cursor to the right by the space of a character. When 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.

NOTE:

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.
  • 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:
    1. Enter an incomplete keyword.

      [~HUAWEI] info-
    2. 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
  • 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:
    1. Enter an incomplete keyword.

      [~HUAWEI] info-center log
    2. 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

      Stop pressing Tab when the desired keyword is displayed.

  • When an incorrect keyword is entered, press Tab and it is displayed in a new line without being changed. For example:
    1. Enter an incorrect keyword.

      [~HUAWEI] info-center loglog
    2. 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.

Using Command Line Online Help

When using a command line, you can use the online help to obtain real-time help without memorizing a large number of complex commands.

When entering command lines, you can enter a question mark (?) at any time to obtain online help. You can choose to obtain full help or partial help.

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.

  • 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
      copy            Copy from one file to another
    ...
  • Enter some keywords of a command and a question mark (?) separated by a space. All keywords associated with this command, as well as simple descriptions, are displayed. For example:
    <HUAWEI> system-view
    [~HUAWEI] user-interface vty 0 4
    [~HUAWEI-ui-vty0-4] authentication-mode ?
      aaa       AAA authentication
      password  Authentication through the password of a user terminal interface
    [~HUAWEI-ui-vty0-4] authentication-mode aaa ?
      <cr>
    
    [~HUAWEI-ui-vty0-4] authentication-mode aaa
    • "aaa" and "password" are keywords. "AAA authentication" and "Authentication through the password of a user terminal interface" describe the keywords respectively.

    • "|" indicates that you can specify a method to display matching information. For details, see Filtering Command Outputs.

    • ">" indicates that you can export the command output to a specified file. If the destination file exists, overwrite the content in the previous file.

    • ">>" indicates that you can add the command output to the end of a specified file and reserve the content in the original file.

    • <cr> indicates that there is no keyword or parameter in this position. You can press Enter to run this command.

  • Enter some keywords of a command and a question mark (?) separated by a space. All parameters associated with this keyword, as well as simple descriptions, are listed. For example:
    <HUAWEI> system-view
    [~HUAWEI] ftp server timeout ?
      INTEGER<1-35791>  The value of FTP timeout, the default value is 30 minutes
    [~HUAWEI] ftp server timeout 35 ?
      <cr>
    
    [~HUAWEI] ftp server timeout 35

    "INTEGER<1-35791>" describes the value range of the parameter. "The value of FTP timeout, the default value is 30 minutes" briefly describes the function of this parameter.

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.

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

Interpreting Command Line Error Messages

If a command is entered and passes syntax check, the system executes it. Otherwise, the system reports an error message.

Table 1-4 lists the common error messages.

Table 1-4 Common error messages of the command line

Error Message

Cause of the Error

Error: Unrecognized command found at '^' position.

No command is found.

No keyword is found.

Error: Wrong parameter found at '^' position.

The parameter type is incorrect.

The parameter value exceeds the limit.

Error: Incomplete command found at '^' position.

The entered command is incomplete.

Error: Too many parameters found at '^' position.

Too many parameters are entered.

Error: Ambiguous command found at '^' position.

Indefinite command is entered.

Using the undo Command Line

If a command line begins with the keyword undo, it is an undo command line. The undo command lines restore default settings of parameters, disable functions, or delete configurations. Almost each configuration command line has a corresponding undo command.

Some examples of using the undo command are listed as follows:

  • The undo command restores the default setting.

    The sysname command sets a device host name. For example:

    <HUAWEI> system-view
    [~HUAWEI] sysname Server
    [*HUAWEI] commit
    [~Server] undo sysname
    [*Server] commit
    [~HUAWEI]
  • The undo command disables a specified function.

    The ftp server enable command enables the FTP server function on the device. For example:

    <HUAWEI> system-view
    [~HUAWEI] ftp server enable
    Warning: FTP is not a secure protocol, and it is recommended to use SFTP.
    [*HUAWEI] commit
    [~HUAWEI] undo ftp server
    Info: Succeeded in closing the FTP server. 
    [*HUAWEI] commit
  • The undo command deletes a specified configuration.

    The header command configures the header information displayed on terminals when users log in. For example:

    <HUAWEI> system-view
    [~HUAWEI] header login information "Hello,Welcome to Huawei!"
    [*HUAWEI] commit

    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.

Displaying History Commands

The device automatically stores history commands entered by a user. If you need to enter a command that has been executed, you can use this function to call up the history command.

By default, the system saves 10 history commands for each user. Run the history-command max-size size-value command to reset the number of history commands that are allowed to be saved in a specified user interface view. The maximum number is 256.

NOTE:

If the value is too large, it may take a long time to obtain a required history command. Therefore, a large value is not recommended.

Table 1-5 shows operations of history commands.

Table 1-5 Accessing history commands

Action

Command or Key

Result

Display history commands.

display history-command [ all-users ]

  • Display the history commands entered by the current users when all-users is not selected.

  • Display the history commands entered by all users when all-users is selected.

Display the earlier history command.

Up arrow key ↑ or Ctrl+P

If there is an earlier history command, the earlier history command is displayed. Otherwise, an alarm is generated.

Display the later history command.

Down arrow key ↓ or Ctrl+N

If there is a later history command, the later history command is displayed. Otherwise, the command is cleared and an alarm is generated.

NOTE:

You cannot access history commands using the Up arrow key ↑ in HyperTerminal Windows 9X. The Up arrow key ↑ has a different function in Windows 9X and need to be replaced by the shortcut key Ctrl+P.

When using history commands, note the following:

  • The saved history commands are the same as that those entered by users. For example, if the user enters an incomplete command, the saved command also is incomplete.

  • If the user runs the same command several times, only the latest command is saved. If the command is entered in different forms, they are considered as different commands.

    For example, if the display current-configuration command is run several times, only one history command is saved. If the display current-configuration command and the dis curr command are used, both of them are saved.

Using Command Line Shortcut Keys

You can use shortcut keys provided by the device to quickly enter commands.

There are two types of shortcut keys:
  • User-defined shortcut keys: include Ctrl+G, Ctrl+L, Ctrl+O, and Ctrl+U. You can associate these shortcut keys with any commands. When a shortcut key is pressed, the system runs the corresponding command.

  • System-defined shortcut keys: shortcut keys defined in the system that have fixed functions. Users cannot define these shortcut keys. Table 1-6 lists the frequently used system-defined shortcut keys.

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.

User-defined Shortcut Keys
When a user frequently uses a command or some commands, the user can use shortcut keys to define these commands. Only management-level users have the rights to define shortcut keys. The configurations are as follows:
  1. Run the system-view command to enter the system view.
  2. Run the hotkey { CTRL_G | CTRL_L | CTRL_O | CTRL_U } command-text command to configure a shortcut key corresponding to a command.
  3. Run the commit command to commit the configuration.
The system supports four user-defined shortcut keys and the default values are as follows:
  • Ctrl+G: display current-configuration

  • Ctrl+L: display ip routing-table

  • Ctrl+O: undo debugging all

  • Ctrl+U: Null

NOTE:
  • 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.

  • Run the display hotkey command to view the status of the defined, undefined, and system-defined shortcut keys.

  • Run the undo hotkey command to restore default values of the configured shortcut keys.

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

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

System-defined Shortcut Keys
Table 1-6 System-defined shortcut keys

Key

Function

Ctrl+A

Moves the cursor to the beginning of the current line.

Ctrl+B

Moves the cursor back one character.

Ctrl+C

Stops performing current functions.

Ctrl+D

Deletes the character where the cursor is located at.

Ctrl+E

Moves the cursor to the end of the current line.

Ctrl+F

Moves the cursor forward one character.

Ctrl+H

Deletes the character on the left side of the cursor.

Ctrl+K

Stops outgoing connections in the call establishment stage.

Ctrl+N

Displays the next command in the history command buffer.

Ctrl+P

Displays the previous command in the history command buffer.

Ctrl+R

Redisplays information about the current line.

Ctrl+T

Stops outgoing connections.

Ctrl+V

Pastes the text of the clipboard.

Ctrl+W

Deletes a character string on the left side of the cursor.

Ctrl+X

Deletes all the characters on the left side of the cursor.

Ctrl+Y

Deletes all the characters on the right side of the cursor and the character where the cursor is located at.

Ctrl+Z

Returns to the user view.

Ctrl+]

Stops incoming connections or redirects the connections.

Esc+B

Moves the cursor back one word.

Esc+D

Deletes one word on the right side of the cursor.

Esc+F

Moves the cursor forward one word.

Esc+N

Moves the cursor downward a line.

Esc+P

Moves the cursor upward a line.

Esc+<

Locates the cursor at the start of text in the clipboard.

Esc+>

Locates the cursor at the end of text in the clipboard.

Configuring an Alias for a Command

The command alias function sets a user-defined character string as the alias for a command on the device.

Context

The alias command can be used in the following scenarios:
  • Configure an easy-to-rember string of characters as the alias for a command. Then, you can just 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.

  • 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

  1. Run:

    system-view

    The system view is displayed.

  2. Run:

    command alias

    The command alias view is displayed.

  3. Run:

    alias alias-string [ parameter parameter & <1-32> ] command command

    An alias is configured for a command.

  4. Run:

    commit

    The configuration is committed.

Follow-up Procedure

  • 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
Translation
Download
Updated: 2019-08-09

Document ID: EDOC1000041694

Views: 59800

Downloads: 3623

Average rating:
This Document Applies to these Products
Related Version
Related Documents
Share
Previous Next