Cisco 路由器操作核心指令匯總,涵蓋記憶體架構認知、運行/啟動配置管理、系統狀態監控、TFTP 遠端備份升級、ACL 存取控制、啟動順序控制,適合網管速查與考證複習。
| 記憶體 | 特性 | 儲存內容 | 對應指令 |
|---|---|---|---|
| RAM | 易失性、執行中 | Running-config (活動配置) | show running-config |
| NVRAM | 非易失性 | Startup-config (啟動配置) | show startup-config |
| Flash | 非易失性、可寫入 | IOS 映像檔 | show flash |
# 顯示配置
show running-config
show startup-config
# 備份:RAM → NVRAM (存檔)
copy running-config startup-config
# 別名:write memory (舊版)
# 還原:NVRAM → RAM
copy startup-config running-config
# 刪除啟動配置
erase startup-config
reload # 重啟進入 Setup Mode
show version # 硬體、IOS 版本、配置檔來源、重啟原因
show processes # 活動進程 CPU/記憶體佔用
show protocols # 已配置 L3 協議狀態
show memory # 記憶體統計
show stacks # 進程堆疊使用
show buffers # 緩衝區統計
show flash # 閃存裝置資訊
show interface # 所有介面統計、錯誤計數器
show clock # 系統時間
clock set hh:mm:ss dd/mm/yyyy # 設定時間
show history # 指令歷史
terminal history size 256 # 歷史緩衝區大小
terminal editing / no editing # 啟用/關閉指令編輯快捷鍵
Router> enable # User → Privileged
Router# configure terminal # Privileged → Global Config
Router(config)# hostname R1 # 設定主機名
Router(config)# enable secret P@ssw0rd # 加密特權密碼
Router(config)# no enable secret # 刪除加密密碼
Router(config)# no enable password # 刪除明文密碼
Router(config)# interface FastEthernet0/0 # 進入介面模式
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Router(config-if)# no shutdown
Router(config-if)# end / Ctrl+Z # 返回 Privileged
Router# reload # 重啟
Router# disable # 返回 User
# 配置備份至 TFTP
copy running-config tftp
copy startup-config tftp
# IOS 備份至 TFTP
copy flash tftp
# 從 TFTP 還原配置
copy tftp running-config
copy tftp startup-config
# 從 TFTP 升級 IOS (需足夠 Flash 空間)
copy tftp flash
Router(config)# boot system flash [filename] # 從 Flash 啟動 (預設)
Router(config)# boot system tftp [filename] [ip] # 從 TFTP 啟動
Router(config)# boot system rom # 從 ROM 啟動 (rxboot)
Router(config)# no boot system flash # 移除指定啟動項
Router# erase flash # 刪除 Flash 中 IOS (慎用!)
# 標準 ACL (1-99, 1300-1999) - 僅依來源 IP
access-list 1 deny host 192.168.0.101
access-list 1 deny 192.168.0.0 0.0.0.255 # 反向遮罩:封鎖整個 /24
access-list 1 permit any # 隱含 deny all,需明確 permit
# 應用至介面
interface FastEthernet0/0
ip access-group 1 in # 入向套用
# 查看 ACL 定義
show access-lists
copy run start,否則重啟遺失。deny any,忘記 permit any 會斷所有流量。archive config 或手動備份 running-config。熟練掌握上述指令集,是 Cisco 網管日常運維與 CCIE 實驗考試的基本功。