1. 程式人生 > >思科交換機常用命令總結

思科交換機常用命令總結

a、更改遠端TELNNET密碼


  
  1. Switch#configure terminal  
  2.  
  3. Switch(config)#line vty 0 4  
  4.  
  5. Switch(config-line)#password qycx123  
  6.  
  7. Switch(config-line)#login  
  8.  
  9. Switch(config-line)#exit 

b、更改進入全域性配置模式時的密碼


  
  1. Switch#configure terminal  
  2.  
  3. Switch(config)#enable secret qycx123 

思科交換機常用命令——建立並劃分VLAN

a、建立VLAN


  
  1. Switch#vlan database  
  2.  
  3. Switch(vlan)#vlan 99 name office 

    (建立vlan 99 並命名為office)

b、將埠劃分至vlan


  
  1. Switch(config)#interface fastEthernet 0/8  
  2.  
  3. Switch(config-if)#switchport mode access  
  4.  
  5. Switch(config-if)#switchport access vlan 99 

    (將8號快速以太口劃分至vlan 99)

思科交換機常用命令——除錯命令

a、顯示所有配置命令:Switch#show run

b、顯示所有介面狀態:Switch#show ip int brief

c、顯示所有VLAN的資訊:Switch#show vlan brief

switch>enable 進入特權模式

  switch#config terminal 進入全域性配置模式

  switchconfig#hostname 設定交換機的主機名

  switchconfig#enable secret xxx 設定特權加密口令

  switchconfig#enable password xxa 設定特權非密口令

  使用Telnet遠端式管理

  switchconfig#interface vlan 1 進入vlan 1

  switchconfig-if#ip address 設定IP地址

  switchconfig-if#ip default-gateway 設定預設閘道器

  switchconfig#line vty 0 4 進入虛擬終端

  switchconfig-line#login 允許登入

  switchconfig-line#password xx 設定登入口令

  switch#exit 返回命令

  控制檯口令

  switchconfig#line console 0 進入控制檯口

  switchconfig-line#login 允許登入

  switchconfig-line#password xx 設定登入口令

  switch#exit 返回命令

  基本介面配置

  switchconfig#interface f0/1 進入f0/1介面

  switchconfig-if#duplex full 配置全雙工模式

  switchconfig-if#speed 100 配置速率

  switchconfig-if#description to ***** 介面描述

  switchconfig#ip domain-name ***.com 設定或名伺服器

  switchconfig#mac-address-table aging-time 設定mac表超時時間

  switch#write 儲存配置資訊

  switch#copy running-config startup-config 儲存當前配置nvram

  switch#erase startup-config 清除配置檔案

  交換機VLAN設定:

  switch#vlan database 進入VLAN設定

  switchvlan#vlan 2 VLAN 2

  switchvlan#name 名字 建VLAN 2的名稱

  switchvlan#no vlan 2 vlan 2

  注:刪除vlan時原屬於此vlan的埠處於非啟用狀態,直到重新分配為止

  switchconfig#int f0/1 進入埠1

  switchconfig-if#switchport mode access 當前埠工作莫試

  switchconfig-if#switchport access vlan 2 當前埠加入vlan 2

  switchconfig-if#switchport mode trunk 設定為幹線

  switchconfig-if#switchport trunk encapsulation dot1q 設定vlan 中繼協議

  switchconfig-if#no switchport mode 或 ( switchport mode access) 禁用幹線

  switchconfig-if#switchport trunk allowed vlan add 1;從Trunk中新增vlans

  switchconfig-if#switchport trunk allowed vlan remove 1;從Trunk中刪除vlans

  switchconfig-if#switchport trunk pruning vlan remove 1;從Trunk中關閉區域性修剪

  乙太網通道配置

  switchconfig#interface range fasternet0/1 - 2 fasternet0/10/2 口捆綁 (成雙不成單)

  switchconfig-if#channel-group 1 mode on 配置以太通道模式

  switchconfig-if#port-channel load-balance {dst-mac | src-mac}在鏈路間實現負載均衡

  switch#show etherchannel 1 summary 檢視通道資訊

  switch#show etherchannel load-balance 檢視通道資訊

  vtp配置

  switchconfig#vtp domain 設定vtp域名

  switchconfig#vtp password 設定vtp密碼

  switchconfig#vtp mode server 設定vtp伺服器模式

  switchconfig#vtp mode client 設定vtp客戶機模式

  switchconfig#vtp mode transparent 設定vtp 透明模式

  switchconfig#vtp version 設定vtp版本

  switchconfig#vtp pruning 啟用vtp修解

  switchconfig#no vtp pruning 關閉vtp修解

  注:要想從vtp中減少一臺交換機只需將該交換機vtp 名更改

  生成樹stp

  switchconfig#spanning-tree vlan 啟用stp生成樹(基於vlan

  switchconfig#spanning-tree vlan root primary 指定根交換機(基於vlan

  switchconfig#spanning-tree vlan root secondary 指定備用根交換機(基於vlan

  switchconfig#spanning-tree vlan priority 指定交換機優先順序(基於vlan

  switchconfig#no spanning-tree vlan priority 將交換機的優先順序恢復預設值(基於vlan

  switchconfig-if#spanning-tree vlan cost 指定埠成本(起用trunk的埠模式下)

  switchconfig-if#spanning-tree vlan port-prioty 指定交換機埠優先順序(基於vlan

  switchconfig-if#spanning-tree portfast 配置速埠(連線終端裝置的埠狀態)如pc

  switchconfig#spanning-tree uplinkfast 配置上行速埠

  注:在配置上行速埠前要先將基於vlan上的網橋優先順序,網橋成本恢復預設值。起用了該命令後在進行優先順序更改,

  switchconfig#spanning-tree vlan hello-time 配置交換機hello時間(基於vlan

  switchconfig#spanning-tree vlan forward-time 修改轉發延遲計時器(基於vlan

  switchconfig#spanning-tree vlan max-time 修改最大老化時間(基於vlan

  注:vlan為可選引數,當沒有該引數時將修改所有vlan網橋的優先順序及所有的vlan埠成本

  switch#show spanning-tree summery 檢測vlan生成樹配置

  switch#show spanning-tree vlan detail 瀏覽詳細生成樹配置資訊

  switch#show spanning-tree interface detail 瀏覽詳細生成樹埠配置資訊

  交換機顯示命令:

  switch#show vtp status 檢視vtp配置資訊

  switch#show running-config 檢視當前配置資訊

  switch#show vlan 檢視vlan配置資訊

  switch#show interface 檢視埠資訊

  switch#show int f0/0 檢視指定埠資訊

  switch#dir flash: 檢視快閃記憶體

  switch#show version 檢視當前版本資訊

  switch#show mac-address-table aging-time 檢視mac超時時間

  switch#show cdp cisco裝置發現協議 (可以檢視聆接裝置)

  switch#show cdp traffic 杳看接收和傳送的cdp包統計資訊

  switch#show cdp neighbors 檢視與該裝置相鄰的cisco裝置

  switch#show interface f0/1 switchport 檢視有關switchport的配置

  switch#show cdp neighbors 檢視與該裝置相鄰的cisco裝置