當前位置:才華齋>計算機>網路技術>

Cisco交換機命令大全

網路技術 閱讀(2.35W)

交換機是一種用於電訊號轉發的網路裝置。它可以為接入交換機的任意兩個網路節點提供獨享的電訊號通路。最常見的交換機是乙太網交換機。其他常見的還有電話語音交換機、光纖交換機等。下面給大家介紹Cisco交換機命令大全,一起來了解一下吧!

Cisco交換機命令大全
  Cisco交換機命令大全

ch(config)#interface vlan 1 進入vlan 1

ch(config-if)#ip address 設定IP地址

ch(config-if)#ip default-gateway 設定預設閘道器

ch(config)#line vty 0 4 進入虛擬終端

ch(config-line)#login 允許登入

ch(config-line)#password xx 設定登入口令

ch#exit 返回命令

o交換機命令之控制檯口令

ch(config)#line console 0 進入控制檯口

ch(config-line)#login 允許登入

ch(config-line)#password xx 設定登入口令

ch#exit 返回命令

o交換機命令之基本介面配置

ch(config)#interface f0/1 進入f0/1介面

ch(config-if)#duplex full 配置全雙工模式

ch(config-if)#speed 100 配置速率

ch(config-if)#description to ***** 介面描述

ch(config)#ip domain-name *** 設定或名伺服器

ch(config)#mac-address-table aging-time 設定mac表超時時間

ch#write 儲存配置資訊

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

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

o交換機命令之交換機VLAN設定:

24.#vlan database 進入VLAN設定

ch(vlan)#vlan 2 建VLAN 2

ch(vlan)#name 名字 建VLAN 2的'名稱

ch(vlan)#no vlan 2 刪vlan 2

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

ch(config)#int f0/1 進入埠1

ch(config-if)#switchport mode access 當前埠工作莫試

ch(config-if)#switchport access vlan 2 當前埠加入vlan 2

ch(config-if)#switchport mode trunk 設定為幹線

ch(config-if)#switchport trunk encapsulation dot1q 設定vlan 中繼協議

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

ch(config-if)#switchport trunk allowed vlan add 1,2 ; 從Trunk中新增vlans

ch(config-if)#switchport trunk allowed vlan remove 1,2 ;從Trunk中刪除vlans

ch(config-if)#switchport trunk pruning vlan remove 1,2 ;從Trunk中關閉區域性修剪

 Cisco交換機命令之乙太網通道配置

ch(config)#interface range fasternet0/1 - 2 將fasternet0/1和0/2 口捆綁

ch(config-if)#channel-group 1 mode on 配置以太通道模式

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

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

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

o交換機命令之vtp配置

ch(config)#vtp domain 設定vtp域名

ch(config)#vtp password 設定vtp密碼

ch(config)#vtp mode server 設定vtp伺服器模式

ch(config)#vtp mode client 設定vtp客戶機模式

11switch(config)#vtp mode transparent 設定vtp 透明模式

ch(config)#vtp version 設定vtp版本

ch(config)#vtp pruning 啟用vtp修解

ch(config)#no vtp pruning 關閉vtp修解

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

 Cisco交換機命令之生成樹stp:

ch(config)#spanning-tree vlan 啟用stp生成樹(基於vlan)

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

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

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

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

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

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

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

ch(config)#spanning-tree uplinkfast 配置上行速埠

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

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

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

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

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

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

o交換機命令之交換機顯示命令:

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

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

ch#show vlan 檢視vlan配置資訊

ch#show interface 檢視埠資訊

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

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

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

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

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

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

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

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

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