CISCO交換機常用命令

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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章