萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 電腦基礎知識 >  >> 電腦入門

Cisco 路由器配置指令大全:記憶體架構、顯示/備份/升級、ACL、TFTP 互備與啟動順序控制

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 遠端備份與 IOS 升級

# 配置備份至 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

啟動順序控制 (Boot System)

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) 基礎配置

# 標準 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,否則重啟遺失。
  • 升級 IOS 前先備份舊版至 TFTP,確保可回滾。
  • ACL 隱含 deny any,忘記 permit any 會斷所有流量。
  • 生產環境修改前先 archive config 或手動備份 running-config。

熟練掌握上述指令集,是 Cisco 網管日常運維與 CCIE 實驗考試的基本功。

copyright © 萬盛學電腦網 all rights reserved