熟練掌握 Cisco IOS 命令模式與核心指令是網管必備基本功。本文將命令分為六大類,提供任務導向速查表,涵蓋模式切換、顯示、拷貝/備份、網絡測試、基礎配置,適合列印作為桌邊手冊。
| 提示符 | 模式名稱 | 進入指令 | 主要功能 |
|---|---|---|---|
Router> | User EXEC | 預設登入 | 基本檢視、連通性測試,不可改配置 |
Router# | Privileged EXEC | enable | 完整檢視、Debug、檔案操作、進入配置模式 |
Router(config)# | Global Config | configure terminal | 全域參數:hostname、routing、ACL、user、NAT |
Router(config-if)# | Interface Config | interface type num | 介面 IP、封裝、帶寬、NAT inside/outside |
Router(config-line)# | Line Config | line vty 0 4 | Console/AUX/VTY 密碼、傳輸協議、逾時 |
Router(config-router)# | Routing Config | router ospf 1 | 動態路由協議參數 |
退出層級:exit (上一層) / end / Ctrl+Z (直回 #)。
?:任何模式、任何位置皆可用,顯示可用命令/關鍵字/參數。command ?:顯示該命令下一步可用參數。command keyword:自動補全。enable ! User -> Privileged
disable ! Privileged -> User
configure terminal ! Privileged -> Global Config
end / ^Z ! 任意配置模式 -> Privileged
interface Gig0/0 ! Global -> Interface Config
line vty 0 4 ! Global -> Line Config
router ospf 1 ! Global -> Router Config
exit ! 退出當前配置子模式
show version ! 硬體/軟體版本、Config Register、Uptime
show running-config ! 當前運行配置 (RAM)
show startup-config ! 啟動配置 (NVRAM)
show interface [type num] ! 介面詳細統計、錯誤計數
show ip route ! 完整路由表
show ip interface brief ! 介面 IP/狀態一覽
show ip nat translations ! NAT 表項
show cdp neighbors detail ! CDP 鄰居詳細資訊
copy running-config startup-config ! 存檔 (RAM->NVRAM)
copy startup-config running-config ! 合併啟動配置到運行
copy running-config tftp ! 備份配置到 TFTP
copy startup-config tftp ! 備份啟動配置到 TFTP
copy tftp running-config ! 從 TFTP 還原配置到運行
copy tftp flash ! 從 TFTP 升級 IOS 到 Flash
copy flash tftp ! 備份 IOS 到 TFTP
erase startup-config ! 清除 NVRAM 配置 (慎用)
reload ! 重啟裝置
ping ip|hostname ! ICMP 連通性
ping ip repeat 100 size 1500 df-bit ! 壓力測試、MTU 測試
traceroute ip|hostname ! 路徑追蹤 (TTL 遞增)
telnet ip|hostname [port] ! 遠端登入/測試 TCP 埠
ssh -l user ip ! SSH 登入 (Client 端)
hostname R1
enable secret StrongPass
username admin privilege 15 secret AdminPass
ip domain-name corp.local
crypto key generate rsa modulus 2048
ip ssh version 2
interface Gig0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
ip route 0.0.0.0 0.0.0.0 192.168.1.254
line vty 0 4
login local
transport input ssh
access-list 23 permit 192.168.100.0 0.0.0.255
line vty 0 4
access-class 23 in