萬盛學電腦網

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

Cisco 思科路由器/交換機 Xmodem 恢復 IOS 映像檔教學與多用戶 Telnet 權限開啟

當 Cisco 設備無 IOS 映像檔 (僅剩 ROMMON 模式) 時,可透過 Console 線使用 Xmodem 協議上傳 IOS 映像檔 (.bin) 恢復系統。本文詳細記錄 Xmodem 傳輸流程、ROMMON 指令集、IOS 啟動驗證,並補充多用戶 Telnet 權限配置要點。

Xmodem 恢復 IOS 完整流程 (超級終端機/PuTTY/Tera Term)

  1. Console 線連接設備 Console 口與電腦序列埠 (COM1)。
  2. 終端軟體設定:9600, 8, N, 1, 無流控 (或點「預設」)。
  3. 連接後按 Enter 出現無 IOS 提示符 switch:。
  4. 拔掉電源重啟設備 (Power Cycle)。
  5. 輸入 switch: flash_init 初始化 Flash,顯示 Initializing Flash...。
  6. 輸入 Xmodem 複製指令:
    switch: copy xmodem: flash:image_filename.bin
    顯示 Begin the Xmodem or Xmodem-1K transfer now...。
  7. 系統持續發送 C 字元表示準備接收。
  8. 終端軟體選單:「傳送」→「發送檔案」→ 協議選 Xmodem 或 Xmodem-1K → 選擇 IOS 映像檔 (*.bin) → 開始傳送。
  9. 耐心等待:9600 Baud 傳輸極慢,大檔案可能需 60-120 分鐘,切勿中斷。
  10. 傳完顯示 File "xmodem:" successfully copied to ...,提示符回 switch:。
  11. 輸入 switch: boot 啟動新 IOS。
  12. 重新上電完成恢復。

ROMMON 模式指令參考 (無 IOS 時可用指令)

rommon 8 > ?
alias, boot, break, confreg, cont, context, cookie, dev, dir, dis, dnld, frame, help, history, meminfo, repeat, reset, set, stack, sync, sysret, tftpdnld, unalias, unset, xmodem

關鍵指令:xmodem (進入 Xmodem 接收模式)、tftpdnld (TFTP 下載)、confreg (修改配置暫存器)、boot (啟動映像檔)。

Cisco 路由器 Xmodem 恢復替代流程 (直接進入 ROMMON)

若設備直接進入 ROMMON (提示 rommon # >):

  1. 輸入 xmodem。
  2. 確認警告:WARNING: All existing data in bootflash will be lost! Invoke only for disaster recovery. Continue? y/n [n]: y。
  3. 顯示 Ready to receive file ...。
  4. 終端軟體發送檔案 → 選 Xmodem → 指定 IOS 路徑 → 上傳。
  5. 等待完成:顯示擦除/寫入 Flash 進度、解壓縮驗證 (Self decompressing the image : ##################################### [OK])。
  6. IOS 啟動資訊輸出:版本、記憶體、介面狀態 (Up/Down)、配置載入訊息。
Erasing flash at 0x603c0000
program flash location 0x602f0000
Download Complete!
program load complete, entry point: 0x80008000, size: 0x2f0074
Self decompressing the image : ################################################# [OK]
Restricted Rights Legend...
Cisco IOS Software, C2600 Software (C2600-I-M), Version 11.3(6)T...
cisco 2610 (MPC860) processor... 12288K/4096K bytes memory...
Press RETURN to get started!
%LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up

補充:開啟多用戶 Telnet 權限 (VTY 設定)

IOS 恢復後,預設僅允許單一 VTY 連線。需配置多條 VTY 並設定密碼/權限:

Router# configure terminal
Router(config)# line vty 0 4          ! 開啟 5 條 VTY (0-4),支援 5 同時 Telnet/SSH
Router(config-line)# password cisco   ! 設定登入密碼
Router(config-line)# login            ! 啟用密碼驗證
Router(config-line)# transport input telnet ssh  ! 允許 Telnet 與 SSH
Router(config-line)# exit
Router(config)# enable secret cisco   ! 設定加密特權密碼
Router(config)# service password-encryption  ! 加密配置檔中所有明文密碼
Router(config)# end
Router# write memory

配合 AAA (Authentication, Authorization, Accounting) 可實現 RADIUS/TACACS+ 集中認證、命令授權、計費審計。

Logo/Banner 設定 (登入提示語)

Router(config)# banner motd #Authorized Access Only! Violators Prosecuted.#

以分隔符 `#` 包裹訊息,用戶登入前將看到此法律/安全警告。

copyright © 萬盛學電腦網 all rights reserved