思科 IOS 指令數量龐大,掌握分類體系與高頻指令是網管效率的關鍵。本文將常用命令歸類為五大類,並附上模式切換速查表,方便日常操作與考試複習。
| 分類 | 用途 | 代表指令 |
|---|---|---|
| 顯示命令 | 查看運行狀態、統計、鄰居、路由表、介面計數器等 | show running-config、show ip route、show interfaces、show version、show cdp neighbors |
| 幫助命令 | 任意模式輸入 ? 取得語法提示、關鍵字列表、參數說明 | ?、command ?、command keyword ? |
| 模式切換命令 | 在用戶/特權/全域/介面/線路/路由協議等模式間切換 | enable、disable、configure terminal、interface、line、router、exit、end |
| 配置/修改命令 | 實際修改設備行為:IP、路由、ACL、QoS、安全、管理等 | ip address、ip route、access-list、username、enable secret |
| 基礎工具命令 | 連通性測試、檔案管理、升級、除錯、時間同步 | ping、traceroute、copy、archive、debug、ntp |
| 提示符 | 模式名稱 | 進入指令 | 退出指令 | 典型任務 |
|---|---|---|---|---|
Router> | 用戶執行模式 | 登入預設 | exit/logout | Ping、Telnet、查看非敏感資訊 |
Router# | 特權執行模式 | enable | disable | 所有 show、debug、copy、檔案系統、進入配置模式 |
Router(config)# | 全域配置模式 | configure terminal | end/Ctrl-Z | 主機名、密碼、IP 路由、VLAN、SNMP、AAA 等全域參數 |
Router(config-if)# | 介面配置模式 | interface | exit | IP/掩碼、封裝、頻寬、ACL、Port-channel、HSRP |
Router(config-line)# | 線路配置模式 | line console/vty/aux | exit | 密碼、傳輸協定、逾時、登入認證方式 |
Router(config-router)# | 路由協議配置 | router ospf/eigrp/rip | exit | 網路宣告、區域、度量、重發佈、鄰居認證 |
rommon> | ROM Monitor | 開機 Ctrl+Break | reset/boot | IOS 災難恢復、修改配置暫存器、Xmodem 載入 |
! 系統資訊
show version ! IOS 版本、硬體、記憶體、配置暫存器、啟動映像
show inventory ! 模組序號、PID、VID、SN(申請 SmartNet 必備)
show processes cpu history! CPU 歷史走勢圖 (60秒/60分/72時)
show memory statistics ! 記憶體碎片、可用、最低水位
! 配置備份與比對
show running-config ! 當前運行配置
show startup-config ! NVRAM 開機配置
show archive config differences nvram:startup-config system:running-config ! 差異比對
! 介面與連結
show ip interface brief ! 所有介面 IP/狀態/協定 一行摘要
show interfaces [id] ! 詳細計數器、錯誤、MTU、封裝、隊列
show controllers [id] ! 物理層控制器狀態 (T1/E1/DSL/Serial)
! 路由與轉發
show ip route ! 路由表
show ip route ! 特定前綴最長匹配路徑
show ip cef ! CEF 轉發資訊基底 (FIB/Adjacency)
show ip protocols ! 動態路由協議參數、計時器、重發佈
! 鄰居與發現
show cdp neighbors detail ! 直接相連思科設備詳細資訊
show lldp neighbors ! 多廠商鄰居發現 (需啟用 lldp run)
! 安全與存取
show access-lists ! ACL 匹配計數
show logging ! 緩衝區日誌
show ssh ! SSH 會話狀態
show users ! 當前 VTY/Console 連線用戶
dir flash: ! 列出檔案系統內容
copy running-config startup-config ! 存檔 (wr)
copy running-config tftp://1.1.1.1/backup.cfg ! 遠端備份
copy tftp://1.1.1.1/c2900-universalk9-mz.SPA.152-4.M5.bin flash: ! IOS 升級
archive download-sw /overwrite /reload tftp://1.1.1.1/...tar ! 交換機自動解壓升級
verify /md5 flash:xxx.bin ! 校驗完整性
debug 指令極度消耗 CPU,嚴禁生產環境長時間開啟。debug condition interface 或 debug condition ip 限制範圍。terminal monitor (VTY) 將訊息導向終端機,並開啟 logging buffered 存檔。undebug all 或 no debug all。將上述指令整理為個人速查卡(或匯入 Anki/Notion),配合實驗環境反覆練習,即可建立扎實的 IOS 操作肌肉記憶。