2011年12月5日 星期一

Cisco 29XX系列密碼重置(可保留設定)

在網路設備管理上 總是會遇到有前人離職時而忘了告知設備的管理密碼資訊,一旦 遇到接手人要新增機器想參考原有機器的設定時,就會遇到這個讓人尷尬的情況,想直接重置 也不是,想設定機器的參數也不知道前台機器是否有設定什麼特定的指令,難到只能送回原廠進行處理??身為一個公司的老闆,想當然是不會肯讓網管人員把設備停掉這麼多天只為了重置密碼這個動作,此篇 就是為了這種情況 而將心得放上給予大家參考。

一般來說路由器Router的密碼恢復比較常見,也比較簡單一點,只要修改註冊鍵值即可完成,而交換器的部份因為是寫入在NVRAM-Config內,所以需要一些手法來進行修改。

而以一般企業來說,可能使用最多的就是Cisco 29XX系列以及35XX系列的交換器。
以下就拿這兩種來介紹如何恢復 重置這兩種系列的交換器密碼

首先,我們要準備的Tools有以下幾樣
一、桌機或筆電(廢話.....)
二、Console連接線一條
三、USB轉RS232(連接Console線與Switch做傳輸連接用)
四、要有一些些的細心及耐心

接下來就準備進入正題 廢話就不多說了

第一步:先將Switch關機斷電。

第二步:將筆電或PC接上USB轉RS232接Console線與Switch做連接。

第三步:開啟超級終端機的程式進行設定COM Port連接,此時需要先確認COM Port為多少如下圖所示




第四步:設定完之後先不要急著進行連接動作,請注意 以下步驟。

步驟:將Switch前方面板上有一個MODE的按鍵按著之後才將Switch接電開機啟動,大概五~十秒鐘之後即可放開該按鍵,面板上的燈號SYST應該會一直閃爍 之後將超級終機進行連接。

第五步:此時應該會看到以下訊息

C2950 Boot Loader (C2950-HBOOT-M) Version 12.1(11r)EA1, RELEASE SOFTWARE (fc1)
Compiled Mon 22-Jul-02 17:18 by antonino
WS-C2950G-48-EI starting...
Base ethernet MAC Address: XX:XX:XX:XX:XX:XX(此為MAC位置)
Xmodem file system is available.

The system has been interrupted prior to initializing the
flash filesystem.  The following commands will initialize
the flash filesystem, and finish loading the operating
system software:

    flash_init
    load_helper
    boot

switch:

第六步:載入flash_init


switch: flash_init   (直接key上之後按Enter 會出現以下畫面)

Initializing Flash...
flashfs[0]: 324 files, 5 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 7741440
flashfs[0]: Bytes used: 4977152
flashfs[0]: Bytes available: 2764288
flashfs[0]: flashfs fsck took 7 seconds.
...done initializing flash.
Boot Sector Filesystem (bs:) installed, fsid: 3
Parameter Block Filesystem (pb:) installed, fsid: 4

第七步:載入load_helper

switch: load_helper

第八步:確認開機時的啟動設定檔


switch: dir flash:     (查看flash內的檔案有哪些)

Directory of flash:/
2    -rwx  110       <date>               info
3    -rwx  3132004   <date>               c2950-i6q4l2-mz.121-22.EA12.bin
4    drwx  4416      <date>               html
326  -rwx  110       <date>               info.ver
327  -rwx  365       <date>               env_vars
328  -rwx  1991      <date>               config.text        (此處會看到 我們需要修改的就是這個檔案 )
329  -rwx  5         <date>               private-config.text

2764288 bytes available (4977152 bytes used)

第九步:修改設定檔並重新開機


switch: rename flash:config.text flash:old.text    (將原有的設定檔更名為old.text)

switch: dir flash:                                               (再次查看確認舊設定檔已更名為old.text)
Directory of flash:/

2    -rwx  110       <date>               info
3    -rwx  3132004   <date>               c2950-i6q4l2-mz.121-22.EA12.bin
4    drwx  4416      <date>               html
326  -rwx  110       <date>               info.ver
327  -rwx  365       <date>               env_vars
328  drwx  64        <date>               lost+found
329  -rwx  5         <date>               private-config.text
332  -rwx  2038      <date>               old.text        (已可確認更名為old.text)

2762240 bytes available (4979200 bytes used)
switch:

第十步:重新啟動機器
switch: boot                     (下這個指令之後按下y即會重新進行開機)

Are you sure you want to reset the system (y/n)?y
System resetting...


機器重新啟動畫面

C2950 Boot Loader (C2950-HBOOT-M) Version 12.1(11r)EA1, RELEASE SOFTWARE (fc1)
Compiled Mon 22-Jul-02 17:18 by antonino
WS-C2950G-48-EI starting...
Base ethernet MAC Address: XX:XX:XX:XX:XX:XX
Xmodem file system is available.
Initializing Flash...
flashfs[0]: 325 files, 6 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 7741440
flashfs[0]: Bytes used: 4979200
flashfs[0]: Bytes available: 2762240
flashfs[0]: flashfs fsck took 6 seconds.
...done initializing flash.
Boot Sector Filesystem (bs:) installed, fsid: 3
Parameter Block Filesystem (pb:) installed, fsid: 4
Loading "flash:c2950-i6q4l2-mz.121-22.EA12.bin"...###########################################################################################################################################################################################################

File "flash:c2950-i6q4l2-mz.121-22.EA12.bin" uncompressed and installed, entry point: 0x80010000
executing...

              Restricted Rights Legend

Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.

           cisco Systems, Inc.
           170 West Tasman Drive
           San Jose, California 95134-1706



Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA12, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2008 by cisco Systems, Inc.
Compiled Mon 07-Jul-08 23:39 by amvarma
Image text-base: 0x80010000, data-base: 0x80570000


Initializing flashfs...
flashfs[1]: 325 files, 6 directories
flashfs[1]: 0 orphaned files, 0 orphaned directories
flashfs[1]: Total bytes: 7741440
flashfs[1]: Bytes used: 4979200
flashfs[1]: Bytes available: 2762240
flashfs[1]: flashfs fsck took 7 seconds.
flashfs[1]: Initialization complete.
Done initializing flashfs.
POST: System Board Test : Passed
POST: Ethernet Controller Test : Passed
ASIC Initialization Passed

POST: FRONT-END LOOPBACK TEST : Passedcisco WS-C2950G-48-EI (RC32300) processor (revision Q0) with 20957K bytes of memory.
Processor board ID FOC0936Z18G
Last reset from system-reset
Running Enhanced Image
48 FastEthernet/IEEE 802.3 interface(s)
2 Gigabit Ethernet/IEEE 802.3 interface(s)

32K bytes of flash-simulated non-volatile configuration memory.
Base ethernet MAC Address: 00:15:62:DC:9D:00
Motherboard assembly number: 73-7409-12
Power supply part number: 34-0965-01
Motherboard serial number: FOC09350KJU
Power supply serial number: 446943
Model revision number: Q0
Motherboard revision number: A0
Model number: WS-C2950G-48-EI
System serial number: FOC0936Z18G

         --- System Configuration Dialog ---

Would you like to enter the initial configuration dialog? [yes/no]:      (此處請按 No 不要進入設定)


Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA12, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2008 by cisco Systems, Inc.
Compiled Mon 07-Jul-08 23:39 by amvarma
SNMP agent on host Switch is undergoing a cold start

Would you like to enter the initial configuration dialog? [yes/no]: n

Press RETURN to get started!


Switch>en    (此時應該不用密碼了)

第十一步:重新載入舊有設定
Switch#
Switch#rename flash:old.text flash:config.text        (先將原本被更名的舊設定檔名改為正確的檔名)
Source filename [config.text]?


Switch#copy flash:config.text system:running-config   (將原本的資料檔copy回running)
Destination filename [running-config]?


第十二步:重新修改enable、console、vty密碼資料
Switch#configure terminal
Switch(config)#enable password XXXXXXXX     (此部份看是要明碼或是加密密碼隨使用者而訂)
Switch(config)#line console 0
Switch(config-line)#password XXXXXXX
Switch(config-line)#login
Switch(config-line)#exit
Switch(config)#line vty 0 4                                     (可依需要Telnet進入Switch的人數設定登入量)
Switch(config-line)#password XXXXXXX
Switch(config-line)#login
Switch(config-line)#exit
Switch(config)#exit
Switch#copy running-configuration startup-configuration

第十二步:搞定收工
此時可以進行確認 應該已經把所有的密碼設定為自己想要的密碼囉。

沒有留言:

張貼留言