cisco交換機命令

2021-09-21 17:04:55 字數 4939 閱讀 2141

交換機口令設定:

switch>enable 進入特權模式

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

switch(config)#hostname 設定交換機的主機名

switch(config)#enable secret *** 設定特權加密口令

switch(config)#enable password xxa 設定特權非密口令

使用telnet遠端式管理

switch(config)#inte***ce 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)#inte***ce 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)#inte***ce range fasternet0/1 - 2 將fasternet0/1和0/2 口** (成雙不成單)

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

switch(config-if)#port-channel load-balance 在鏈路間實現負載均衡

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 inte***ce detail 瀏覽詳細生成樹埠配置資訊

交換機顯示命令:

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

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

switch#show vlan 檢視vlan配置資訊

switch#show inte***ce 檢視埠資訊

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 inte***ce f0/1 switchport 檢視有關switchport的配置

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

2950交換機密碼恢復

撥下交換機的電源線

用手按在mode按鍵上,插上電源線。

看到出現 flash_init load_helper boot switch: 畫面時鬆開mode鍵

在switch:後執行flash_init命令檢視flash中的檔案

把config.text 檔案改名為"config.old rename flash:config.text flash:config.old

執行boot命令啟動交換機

交換機出現是否進入配置的對話, 執行no命令

進入特權模式檢視flas**件 執行enable 在switch#show flash:

把config.old改為config.text rename flash:config.old flash:config.text

把config.text考入系統的running-config

copy flash:config.text system:running-config

重新設定密碼並存檔

Cisco 交換機基本配置命令

交換機基本狀態 switch rom狀態,路由器是 rommon hostname 使用者模式 hostname 特權模式 hostname config 全域性配置模式 hostname config if 介面狀態 交換機口令設定 switch enable 進入特權模式 switch conf...

Cisco交換機常用配置命令

1 配置ip位址 a 進入全域性模式 switch configure terminal b 進入vlan 1介面模式 switch config inte ce vlan 1 如果當前vlan 不是管理vlan 只需要將上面第b處命令的vlan的號碼換成管理vlan的號碼即可。2 開啟snmp協議...

cisco交換機配置snmp命令

簡單網路管理協議 snmp 由一組網路管理的標準組成,包含乙個 應用層協議 資料庫模型 database schema 和一組資源物件。該協議能夠支援 網路管理系統 用以監測連線到網路上的裝置是否有任何引起管理上關注的情況。正確配置命令如下 1.先進入裝置的配置模式 2.配置snmp的團體字 snm...