Cisco交換機命令大總結

cisco交換機還是比較常用的,於是我研究了一下Cisco交換機命令的大總結,在這裏拿出來和大家分享一下,希望對大家有用。我所針對的都是Cisco的設備而言的,華爲的可以跟據手冊來查,配置都是差不多的,這裏華子就不多寫華爲的設備了,瞭解的也不是很多。

Cisco交換機命令之使用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 返回命令

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

switch(config)#line console 0 進入控制檯口
switch(config-line)#login 允許登錄
switch(config-line)#password xx 設置登錄口令
switch#exit 返回命令

Cisco交換機命令之基本接口配置

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 清除配置文件

Cisco交換機命令之交換機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中關閉局部修剪

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

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 查看通道信息

Cisco交換機命令之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 名更改

Cisco交換機命令之生成樹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 配置上行速端口
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)
switch#show spanning-tree summery 檢測vlan生成樹配置
switch#show spanning-tree vlan detail 瀏覽詳細生成樹配置信息
switch#show spanning-tree interface detail 瀏覽詳細生成樹端口配置信息

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

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