交换机常用命令

各种模式之间的切换

Command Mode

Access Method

Prompt

Exit or Access Next Mode

User EXEC

This is the first level of access.(For the switch) Change terminal settings, perform basic tasks, and list system information.

Switch>

Enter the logout command.To enter privileged EXEC mode, enter the enable command.

Privileged EXEC

From user EXEC mode, enter the enable command.

Switch#

To exit to user EXEC mode, enter the disable command.To enter global configuration mode, enter the configure command.

Global configuration

From privileged EXEC mode, enter the configure command.

Switch(config)#

To exit to privileged EXEC mode, enter the exit or end command, or press Ctrl-Z.To enter interface configuration mode, enter the interface configuration command.

Interface configuration

From global configuration mode, specify an interface by entering the interface command followed by an interface identification.

Switch(config-if)#

To exit to privileged EXEC mode, enter the end command, or press Ctrl-Z.To exit to global configuration mode, enter the exit command.

Config-vlan

In global configuration mode, enter the vlan vlan-id command.

Switch(config-vlan)#

To exit to global configuration mode, enter the exit command.To return to privileged EXEC mode, enter the end command, or press Ctrl-Z.

VLAN configuration

From privileged EXEC mode, enter the vlan database command.

Switch(vlan)#

To exit to privileged EXEC mode, enter the exit command.

Line configuration

From global configuration mode, specify a line by entering the line command.

Switch(config-line)#

To exit to global configuration mode, enter the exit command.To return to privileged EXEC mode, enter the end command, or press Ctrl-Z.

用户模式与特权模式

用户模式:可以使用一些基本的查询命令

特权模式:可以对交换机进行相关的配置

切换特权模式

进入特权模式命令
Switch>enable

退出特权模式命令
Switch#disable

查看帮助信息

设置时间

显示信息命令

注意:可以用TAB键补齐命令,自选参数为用户自定义参数,可选参数为交换机设定参数

保存交换机配置

全局配置模式

切换全局配置模式

设置主机名

设置特权模式密码

显示信息命令

注意:配置模式中无法使用show命令,如果要使用的话,请使用do show

指定根交换机命令

注意:设置根交换机是基于VLAN的

关闭生成树协议命令

接口配置模式

切换接口配置模式

启用和停用端口

进入多端口配置

二层端口的配置

端口速率

双工模式

启用和禁用链路协商

VLAN 的配置

新建VLAN

删除VLAN

将一个接口加入VLAN

将一个接口退出VLAN

配置vlan的ip地址

修改一个接口为端口汇聚模式

VLAN的验证命令

VTP的配置

VTP Domain Name (VTP域名)

VTP mode (VTP模式)

VTP Pruning (VIP修剪)

注意:有的交换机不支持VTP修剪命令

查看VTP的配置命令

远程登录交换机设置

  1. 配置管理VLAN

    注意: IP 地址必须与远程连接交换机的PC机地址在同一网段

  2. 在交换机上指定默认网关

    注意:指定的默认网关仅当前交换机有效。

  3. 将交换机连接PC机的端口加入VLAN 1

  4. 配置交换机的远程登录

Last updated

Was this helpful?