思科交換機常用命令總結
a、更改遠端TELNNET密碼
- Switch#configure terminal
- Switch(config)#line vty 0 4
- Switch(config-line)#password qycx123
- Switch(config-line)#login
- Switch(config-line)#exit
b、更改進入全域性配置模式時的密碼
- Switch#configure terminal
- Switch(config)#enable secret qycx123
思科交換機常用命令——建立並劃分VLAN
a、建立VLAN
- Switch#vlan database
- Switch(vlan)#vlan 99 name office
(建立vlan 99 並命名為office)
b、將埠劃分至vlan
- Switch(config)#interface fastEthernet 0/8
- Switch(config-if)#switchport mode access
- 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 進入全域性配置模式
switch(config)#hostname 設定交換機的主機名
switch(config)#enable secret xxx 設定特權加密口令
switch(config)#enable password xxa 設定特權非密口令
使用Telnet遠端式管理
switch(config)#interface vlan 1 進入vlan 1
switch(config-if)#ip address 設定IP地址
switch(config-if)#ip default-gateway 設定預設閘道器
switch(config)#line vty 0 4 進入虛擬終端
switch(config-line)#login 允許登入
switch(config-line)#password xx 設定登入口令
switch#exit 返回命令
控制檯口令
switch(config)#line console 0 進入控制檯口
switch(config-line)#login 允許登入
switch(config-line)#password xx 設定登入口令
switch#exit 返回命令
基本介面配置
switch(config)#interface f0/1 進入f0/1介面
switch(config-if)#duplex full 配置全雙工模式
switch(config-if)#speed 100 配置速率
switch(config-if)#description to ***** 介面描述
switch(config)#ip domain-name ***.com 設定或名伺服器
switch(config)#mac-address-table aging-time 設定mac表超時時間
switch#write 儲存配置資訊
switch#copy running-config startup-config 儲存當前配置nvram
switch#erase startup-config 清除配置檔案
交換機VLAN設定:
switch#vlan database 進入VLAN設定
switch(vlan)#vlan 2 建VLAN 2
switch(vlan)#name 名字 建VLAN 2的名稱
switch(vlan)#no vlan 2 刪vlan 2
注:刪除vlan時原屬於此vlan的埠處於非啟用狀態,直到重新分配為止
switch(config)#int f0/1 進入埠1
switch(config-if)#switchport mode access 當前埠工作莫試
switch(config-if)#switchport access vlan 2 當前埠加入vlan 2
switch(config-if)#switchport mode trunk 設定為幹線
switch(config-if)#switchport trunk encapsulation dot1q 設定vlan 中繼協議
switch(config-if)#no switchport mode 或 ( switchport mode access) 禁用幹線
switch(config-if)#switchport trunk allowed vlan add 1,2 ;從Trunk中新增vlans
switch(config-if)#switchport trunk allowed vlan remove 1,2 ;從Trunk中刪除vlans
switch(config-if)#switchport trunk pruning vlan remove 1,2 ;從Trunk中關閉區域性修剪
乙太網通道配置
switch(config)#interface range fasternet0/1 - 2 將fasternet0/1和0/2 口捆綁 (成雙不成單)
switch(config-if)#channel-group 1 mode on 配置以太通道模式
switch(config-if)#port-channel load-balance {dst-mac | src-mac}在鏈路間實現負載均衡
switch#show etherchannel 1 summary 檢視通道資訊
switch#show etherchannel load-balance 檢視通道資訊
vtp配置
switch(config)#vtp domain 設定vtp域名
switch(config)#vtp password 設定vtp密碼
switch(config)#vtp mode server 設定vtp伺服器模式
switch(config)#vtp mode client 設定vtp客戶機模式
switch(config)#vtp mode transparent 設定vtp 透明模式
switch(config)#vtp version 設定vtp版本
switch(config)#vtp pruning 啟用vtp修解
switch(config)#no vtp pruning 關閉vtp修解
注:要想從vtp中減少一臺交換機只需將該交換機vtp 名更改
生成樹stp:
switch(config)#spanning-tree vlan 啟用stp生成樹(基於vlan)
switch(config)#spanning-tree vlan root primary 指定根交換機(基於vlan)
switch(config)#spanning-tree vlan root secondary 指定備用根交換機(基於vlan)
switch(config)#spanning-tree vlan priority 指定交換機優先順序(基於vlan)
switch(config)#no spanning-tree vlan priority 將交換機的優先順序恢復預設值(基於vlan)
switch(config-if)#spanning-tree vlan cost 指定埠成本(起用trunk的埠模式下)
switch(config-if)#spanning-tree vlan port-prioty 指定交換機埠優先順序(基於vlan)
switch(config-if)#spanning-tree portfast 配置速埠(連線終端裝置的埠狀態)如pc機
switch(config)#spanning-tree uplinkfast 配置上行速埠
注:在配置上行速埠前要先將基於vlan上的網橋優先順序,網橋成本恢復預設值。起用了該命令後在進行優先順序更改,
switch(config)#spanning-tree vlan hello-time 配置交換機hello時間(基於vlan)
switch(config)#spanning-tree vlan forward-time 修改轉發延遲計時器(基於vlan)
switch(config)#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裝置