CISCO交换机常用命令<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

1 Switch>                            模式

2 Switch>enable                      入特模式

     Switch#

3 Switch#config terminal                入全局模式

     Switch config)#

4 Switch config)#interface f0/1        入接口模式

     Switch config-if)#

5 Switch config)#line console 0        line 模式

     Switch config-line)#

     exit 退回上

     end 束所有操作

6 Switch config)#hostname aaa         配置主机名

7 switch#show running-config            看配置情

8 Switch config)#enable password 111    置使能密(明文)

9 Switch config)#enable secret 111       置使能密(密文)

     Switch config)#line console 0         console

     Switch config-line)#password 333

     Switch(config-line)#login

10 Switch config)#interface vlan1

     Switch config-if)#ip address 192.168.1.1 255.255.255.0     IP 地址

     Switch config-if)#no shutdown

11 Switch config)#ip default-gateway 192.168.1.10 网关

12 Switch#show mac-address-table       MAC 地址表

13 Switch#show cdp                      cdp 全局配置信息

14 Switch#show cdp interface f0/1        cdp 接口配置信息

15 Switch#show cdp traffic               cdp 包的配置信息

16 Switch#show cdp neighbors            cdp 居基本信息

17 Switch#show cdp neighbors detail       cdp 详细信息

    Switch#show cdp neighbors entry

18 Switch#copy running-config startup-config

    Switch#write                       保存交机配置信息

19 Switch#erase startup-config        信息

    Switch#reload                      重新加

20 机密

   * 断开电

   * 按住 MODE ,加(等待秒)

   *switch: 此符

   *switch:flash_init 初始化 flash

   *switch:dir flash: ( 看文件,可省去)

   *switch:rename config.text config.old     改名

   *switch:boot                            

   *switch>enable                          入特

   *switch#dir flash:                       ( 看文件,可省去)

   *switch#rename config.old config.text     改名

   *switch#copy flash:config.text running-config   制到系统内

   *switch#confit terminal                        入全局模式

   *switch(config)#enable password 222         置新密

21 switch#show vlan-sw brief                  vlan

22 switch#vlan database                     vlan 模式

    switch(vlan)#vlan 20 name bbb           vlan 命名

23 switch(vlan)#no vlan 20                        vlan

24 、添加端口到 vlan 单个

   switch(config)#interface f0/1                入接口模式

   switch(config-if)#switchport access vlan 10    添加至 vlan10

   switch(config-if)#end                     退出

   switch#show vlan brief (id)                 验证 vlan

 switch(config)#show running-config interface f0/1 ( 看某接口)

25 、添加端口到 vlan( 批量)

    switch(config)#interface range f0/1 - 5

    switch(config-if-range)#switchport access vlan 10

26 switch(config)#interface f0/1                入接口

    switch(config-if)#switchport mode trunk  trunk( 永久)

    switch(config-if)#switchport mode dynamic desirable/auto( trunk)

switch(config-if)#switchport trunk allowed vlan remove 10 移除 vlan10)

 switch(config-if)#switchport trunk allowed vlan add 20    添加 vlan20

27 switch#show interface f0/1 switchport         看接口模式

    show ip interface brief