交換機命令

交換機命令
switch>         用戶模式
1:進入特權模式
switch> enable
switch#
2:進入全局配置模式
switch> enable
switch#config terminal
switch(conf)#
3:交換機命名 (以aptech2950爲例)
switch#config terminal
switch(conf)#hostname aptch-2950
aptech2950(conf)#
4:配置使能口令
cisco爲例
switch> enable
switch#config terminal
switch(conf)#hostname aptch2950
aptech2950(conf)# enable password cisco
5:配置使能密碼  (以123456爲例)
switch> enable
switch#config terminal
switch(conf)#hostname aptch2950
aptech2950(conf)# enable secret 123456
6:設置虛擬局域網vlan 1
switch> enable
switch#config terminal
switch(conf)#hostname aptch2950
aptech2950(conf)# interface vlan 1
aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0      配置交換機端口ip和子網掩碼
aptech2950(conf-if)#no shut   使配置處於運行中
aptech2950(conf-if)#exit
7:進入交換機某一端口(以17端口爲例)
switch> enable
switch#config terminal
switch(conf)#hostname aptch2950
aptech2950(conf)# interface fastethernet 0/17
aptech2950(conf-if)#
8:查看命令show
switch> enable
switch# show version  察看系統中的全部版本信息
show interface vlan 1  查看交換機有關ip 協議的配置信息
show running-config 查看交換機當前起做用的配置信息
show interface fastethernet 0/1  察看交換機1接口具體配置和統計信息
show mac-address-table        查看mac地址表
show mac-address-table aging-time  查看mac地址表自動老化時間
9:查找直連cisco設備show cdp
switch#show cdp 查看CDP全局配置
switch#show cdp interface f0/17 查某端口直連設備
switch#show cdp neighbors 查鄰居設備摘要信息
switch#show cdp neighbors detail 查鄰居詳細信息
switch#show cdp entry * 查鄰居詳細信息
switch#show cdp traffic 查看CDP包統計信息
10:保存交換機配置
switch#copy running-config startup-config
或者 switch#write
11:交換機恢復出廠默認恢復命令 
switch> enable
switch# erase startup-config
switch# reload
12:雙工模式設置(以17端口爲例)
switch> enable
switch#config terminal
switch2950(conf)#hostname aptch-2950
aptech2950(conf)# interface fastethernet 0/17                
aptech2950(conf-if)#speed 10/100/auto
10100auto 三個可選項
aptech2950(conf-if)#duplex full/half/auto                    full , half, auto 三個可選項
13csico2950的密碼恢復  175
拔下交換機電源線。
用手按着交換機的MODE鍵,插上電源線
switch:後執行flash_init命令:
switch: flash_init
查看flash中的文件:
switch: dir flash:
config.text文件更名爲config.old
   switch: rename flash: config.text flash: config.old
執行boot  
switch: boot
交換機進入是否進入配置的對話,執行no
進入特權模式察看flash裏的文件:
switch#show flash :
config.old文件更名爲 config.text  
switch# rename flash: config.old flash: config.text
config.text拷入系統的running-config
#copy flash: config.text system : running-config
把配置模式從新設置密碼存盤,
    switch#config terminal
switch (conf)# enable secret 123456
密碼恢復成功。
 
 
交換機命令:
15:在全局配置模式下建立VLAN:
aptech2950(conf)# vlan 2
aptech2950(conf-vlan)#name v2
aptech2950(conf-vlan)#mtu 1350
aptech2950#copy running-config startup-config
16:在VLAN數據庫中建立VLAN
aptech2950#vlan database
aptech2950(vlan)#vlan 3 name v3
aptech2950(vlan)#vlan 3 mtu 1350
17:查看vlan 信息:
aptech2950#show vlan
aptech2950#show vlan brief
aptech2950#show vlan 2
aptech2950#show interface fa 0/2 switchport
18:刪除vlan
aptech2950(vlan)# no vlan 3
aptech2950(conf)# no vlan 2
 
19:在VLAN 中添加端口:
aptech2950(conf)#interface fa 0/2
aptech2950(conf-if)#switchport mode access
aptech2950(conf-if)#switchport access vlan2
 
20:在VLAN 中刪除端口:
aptech2950(conf)#interface fa 0/2
aptech2950(conf-if)# no switchprot access vlan2
aptech2950(conf-if)# default interface fa 0/2
21:配置VLAN Trunk:
1       配置接口爲TRUNK模式:
   aptech2950(conf)#interface fa 0/24
aptech2950(conf-if)#switchport  mode trunk
②配置接口爲動態協商模式:
aptech2950(conf)#interface fa 0/24
aptech2950(conf-if)#switchport mode dynamic desirable | auto
③查看接口模式:
aptech2950(conf-if)# do show interface fastethernet 0/24 switchport
④在TRUNK中添加 VLAN
aptech2950(conf)#interface fa 0/24
aptech2950(conf-if)#switchport trunk allowed vlan add vlan 3
⑤ 在TRUNK中刪除 VLAN
aptech2950(conf)#interface fa 0/24
aptech2950(conf-if)#switchport trunk allowed vlan remove vlan 3
相關文章
相關標籤/搜索