萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 網路安全 >  >> 路由器知識 >> 路由器設定 >> Cisco 思科路由器

思科路由器/交換機 Flash IOS 遺失救援:Xmodem 兩大恢復實戰教學

隨著網路設備技術日新月異,思科路由器與交換機廣泛部署於企業骨幹網路。然而,若不慎刪除 Flash 中的 IOS 映像檔導致設備無法開機,唯有透過 Console 連接線配合 Xmodem 協定將 IOS 重新載入。本文將詳細解析兩種 Xmodem 恢復方案,助您快速讓設備「起死回生」。

方案一:高效率 Xmodem 恢復法(調高 Baud Rate 至 115200)

此法透過調整 ROMMON 環境變數與終端機傳輸速率,大幅縮短傳輸時間,適合 IOS 檔案較大的情境。

操作步驟

  1. 開啟超級終端機(或 PuTTY/Tera Term),以 9600-8-N-1 連線 Console 埠。
  2. 設備通電時按下 Ctrl+Break 進入 rommon 模式。
  3. 輸入 confreg 並依提示修改設定:
    rommon 1 > confreg
    Configuration Summary
    enabled are:
    load rom after netboot fails
    console baud: 9600
    boot: image specified by the boot system commands
    or default to: cisco2-C2600
    do you wish to change the configuration? y/n [n]: y
    enable "diagnostic mode"? y/n [n]: n
    enable "use net in IP bcast address"? y/n [n]: n
    disable "load rom after netboot fails"? y/n [n]: n
    enable "use all zero broadcast"? y/n [n]: n
    enable "break/abort has effect"? y/n [n]: n
    enable "ignore system config info"? y/n [n]: n
    change console baud rate? y/n [n]: y
    enter rate: 0=9600, 1=4800, 2=1200, 3=2400
    4=19200, 5=38400, 6=57600, 7=115200 [0]: 7
    change the boot characteristics? y/n [n]: n
    Configuration Summary
    enabled are:
    load rom after netboot fails
    console baud: 115200
    boot: image specified by the boot system commands
    or default to: cisco2-C2600
    do you wish to change the configuration? y/n [n]: n
    You must reset or power cycle for new config to take effect
  4. 輸入 reset 重啟設備。關鍵動作:在按下 Enter 前,先將電腦裝置管理員中 COM 埠速率改為 115200,再將終端機軟體速率同步調整為 115200,否則會出現亂碼。
  5. 重新進入 rommon 後,執行 xmodem -c <檔名.bin> 並從終端機選擇「傳送檔案」→ 協定選 Xmodem/Xmodem-1K → 選取 IOS 檔案開始傳輸。
  6. 傳輸完成後輸入 boot flash:<檔名.bin> 啟動系統。

方案二:標準 Xmodem 恢復法(9600 Baud,步驟直觀)

適合不想調整 Baud Rate、或終端機軟體不支援高速傳輸的初學者。缺點是傳輸較慢(大檔案約 60-90 分鐘)。

操作步驟

  1. Console 線連接 PC COM1,終端機設定 9600-8-N-1、無流控。
  2. 設備斷電重啟,出現 switch: 提示符(表示無 IOS)。
  3. 依序輸入指令:
    switch: flash_init(初始化 Flash)
    switch: copy xmodem: flash:image_filename.bin(啟動 Xmodem 接收)
  4. 畫面出現連續 C 字元時,於終端機選擇「傳送檔案」→ 協定 Xmodem/Xmodem-1K → 選取 IOS .bin 檔。
  5. 耐心等待傳輸完成(顯示 File "xmodem:" successfully copied to ...)。
  6. 輸入 switch: boot 啟動新 IOS,最後重新加電確認恢復正常。

小結

兩種方法各有優劣:方案一速度快但需同步調整兩端 Baud Rate;方案二操作直觀但耗時較長。建議網管根據現場條件選擇,並平時養成備份 IOS 至 TFTP/FTP 伺服器的習慣,才能從容應對 Flash 損毀或誤刪風險。

copyright © 萬盛學電腦網 all rights reserved