當 Cisco 設備無 IOS 映像檔 (僅剩 ROMMON 模式) 時,可透過 Console 線使用 Xmodem 協議上傳 IOS 映像檔 (.bin) 恢復系統。本文詳細記錄 Xmodem 傳輸流程、ROMMON 指令集、IOS 啟動驗證,並補充多用戶 Telnet 權限配置要點。
switch:。switch: flash_init 初始化 Flash,顯示 Initializing Flash...。switch: copy xmodem: flash:image_filename.binBegin the Xmodem or Xmodem-1K transfer now...。C 字元表示準備接收。*.bin) → 開始傳送。File "xmodem:" successfully copied to ...,提示符回 switch:。switch: boot 啟動新 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 (啟動映像檔)。
若設備直接進入 ROMMON (提示 rommon # >):
xmodem。WARNING: All existing data in bootflash will be lost! Invoke only for disaster recovery. Continue? y/n [n]: y。Ready to receive file ...。Self decompressing the image : ##################################### [OK])。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
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+ 集中認證、命令授權、計費審計。
Router(config)# banner motd #Authorized Access Only! Violators Prosecuted.#
以分隔符 `#` 包裹訊息,用戶登入前將看到此法律/安全警告。