思科交换机配置命令简写与完整对照版


简写命令 完整命令



1)用户模式:

switch> switch>

2)特权模式:

switch>en switch>enable
switch# switch#

3)全局配置模式:

switch#conf t switch#config terminal
switch(config)# switch(config)#

4)接口配置模式:

switch(config)#in f0/1 switch(config)#interface f0/1
switch(config-if)# switch(config-if)#

5)line模式:

switch(config)#lin c 0 switch(config)#line console 0
switch(config-line)# switch(config-line)#

6)更改交换机主机名:

switch(config)#ho benet switch(config)#hostname benet
benet(config)# benet(config)#

7)配置进入特权模式的明文口令:

switch(config)#en pass 123 switch(config)#enable password 123

8)删除进入特权模式的明文口令:

switch(config)#no ena pass switch(config)#no enable password

9)配置进入特权模式的加密口令:

switch(config)#en se 456 switch(config)#enable secret 456

10)删除进入特权模式的加密口令

switch(config)#no ena se switch(config)#no enable secret

11)查看交换机配置:

switch#sh run switch#show running-config

12)配置console口令:

switch(config)#lin cons 0 switch(config)#line console 0
switch(config-line)#pass 123 switch(config-line)#password 123
switch(config-line)#logi switch(config-line)#login

13)配置交换机IP地址:

switch(config)#in vl 1 switch(config)#interface vlan 1
switch(config-if)#ip ad 192.168.0.2 255.255.255.0 switch(config-if)#ip address 192.168.0.2 255.255.255.0
switch(config-if)#no sh switch(config-if)#no shutdown

14)配置交换机默认网关:

switch(config)#ip default-g 192.168.0.1 switch(config)#ip default-gateway 192.168.0.1

15)查看交换机的MAC地址表:

switch#sh mac-a switch#show mac-address-table

16)查看思科交换机相邻设备的详细信息:

switch#sh cdp nei de switch#show cdp neighbors detail

17)保存交换机配置:
1:s

witch#cop run st 1:switch#copy running-config startup-config

2:switch#wr 2:switch#write

18)恢复交换机出厂配置:

switch#er st switch#erase startup-config
switch#relo switch#reload

19)创建VLAN:

1:switch#vl da switch#vlan database
switch(vlan)#vl 30 switch(vlan)#vlan 30
switch(vlan)#e switch(vlan)#exit
2:

20)删除VLAN:

switch(vlan)#n vl 20 switch(vlan)#no vlan 20
Deleting VLAN 2... Deleting VLAN 2...
switch(vlan)#e switch(vlan)#exit

21)将端口加入到VLAN:

switch(config)#in f0/2 switch(config)#interface f0/2
switch(config-if)#sw a v 30 switch(config-if)#switchport access vlan 30

22)验证VLAN配置信息:

switch#sh vlan b switch#show vlan brief
switch#sh vlan-s switch#show vlan-switch

23)删除VLAN中的端口:

1:switch(config-if)#no sw a v 3 switch(config-if)#no switchport access vlan 3
switch(config-if)#end switch(config-if)#end

2:switch(config-if)#def interface f0/2 switch(config-if)#default interface f0/2
Building configuration... Building configuration...
Interface FastEthernet0/2 set to default configuration Interface FastEthernet0/2 set to default configuration
switch(config)#end switch(config)#end

24)同时将多个端口加入VLAN并验证:

switch(config)#in r f0/3 - 10 switch(config)#interface range f0/3 - 10
switch(config-if-range)#sw a v 3 switch(config-if-range)#switchport access vlan 3
switch(config)#end switch(config)#end
switch#sh vlan-s switch#show vlan-switch

25)配置VLAN TRUHK:

switch(config)#in f0/15 switch(config)#interface f0/15
switch(config-if)#sw m t switch(config-if)#switchport mode trunk

26)从TRUNK中添加某个VLAN:
switch(config)#in f0/15 switch(config)#interface f0/15
switch(config-if)#sw t a v ad 3 switch(config-if)#switchport trunk allowed vlan add 3
switch(config-if)#end sw

itch(config-if)#end

27)从TRUNK中删除某个VLAN:

switch(config)#in f0/15 switch(config)#interface f0/15
switch(config-if)#sw t a v r 3 switch(config-if)#switchport trunk allowed vlan remove 3
switch(config-if)#end switch(config-if)#end

28)验证接口模式(检查中断端口允许的VLAN列表):

switch#sh int f0/15 switchp switch#show interface f0/15 switchport

29)查看用过的命令:

switch#sh hi switch#show history

相关文档
最新文档