Cisco 路由器是企業網路核心設備,掌握其配置方式與命令模式是網管必修課。本文系統整理五種管理存取管道、六種命令提示字模式與首次設定關鍵參數,建立扎實 CLI 基礎。
| 方式 | 連接介面 | 適用場景 | 備註 |
|---|---|---|---|
| 1. Console | Console 埠 + 終端機/終端模擬軟體 | 首次設定、故障救援、頻外管理 | 必經之路,預設 9600/8/N/1 |
| 2. AUX + Modem | AUX 埠 + Modem + 電話線 | 遠端頻外管理、備用存取 | 需撥號、速度慢 |
| 3. TFTP Server | 乙太網介面 + TFTP | 大量部署、配置備份/還原、IOS 升級 | 需網路通、TFTP 服務 |
| 4. Telnet | 乙太網介面 + TCP 23 | 遠端 CLI 管理 | 明文傳輸,建議停用改用 SSH |
| 5. SNMP NMS | 乙太網介面 + UDP 161/162 | 集中監控、配置下發、告警 | 需配置 Community/String、ACL |
鐵律:路由器首次設定必須透過 Console,終端參數固定為 9600 bps、8 data bits、no parity、1 stop bit、no flow control。
| 提示字 | 模式名稱 | 權限與用途 | 進入/退出方式 |
|---|---|---|---|
Router> | 使用者執行模式 | 僅檢視連線狀態、ping/traceroute,不可變更設定 | 預設登入 / disable 退回 |
Router# | 特權執行模式 | 所有 show、debug、clear、copy、reload、configure terminal | enable 進入 / disable 或 exit 退回 |
Router(config)# | 全域配置模式 | 設定全域參數:hostname、IP routing、SNMP、logging、AAA 等 | configure terminal / end 或 Ctrl+Z |
Router(config-if)# | 介面配置模式 | 設定介面 IP、封裝、頻寬、描述、VLAN、Port-channel 等 | interface <type> <num> / exit |
Router(config-line)# | 線路配置模式 | 設定 Console/AUX/VTY 線路:密碼、逾時、傳輸協定、登入驗證 | line console 0 等 / exit |
Router(config-router)# | 路由協定配置模式 | 設定 RIP、OSPF、EIGRP、BGP 等動態路由程序 | router <protocol> / exit |
> (無 hostname) | RXBOOT / ROMMON | 開機 60 秒內 Ctrl+Break 進入,僅供 IOS 升級、密碼恢復、手動引導 | 重開機或 boot 指令離開 |
| Setup 對話模式 | 初始配置對話 | 新路由器開機或 setup 指令進入,引導式基本設定 | 按提示完成或 Ctrl+C 取消 |
Router> enable
Router# configure terminal
Router(config)# hostname Core-Router
Core-Router(config)# enable secret cisco123
Core-Router(config)# line console 0
Core-Router(config-line)# password consolepwd
Core-Router(config-line)# login
Core-Router(config-line)# exec-timeout 10 0
Core-Router(config-line)# exit
Core-Router(config)# line vty 0 4
Core-Router(config-line)# password vtypwd
Core-Router(config-line)# login
Core-Router(config-line)# transport input ssh
Core-Router(config-line)# exit
Core-Router(config)# ip domain-name corp.local
Core-Router(config)# crypto key generate rsa modulus 2048
Core-Router(config)# ip ssh version 2
Core-Router(config)# interface GigabitEthernet0/0
Core-Router(config-if)# ip address 192.168.1.1 255.255.255.0
Core-Router(config-if)# no shutdown
Core-Router(config-if)# description LAN-Gateway
Core-Router(config-if)# exit
Core-Router(config)# ip route 0.0.0.0 0.0.0.0 192.168.1.254
Core-Router(config)# end
Core-Router# write memory
write memory (或 copy running-config startup-config)。copy running-config tftp://server/backup.cfg 備份。do show run | section ... 在配置模式下快速檢視。? 與 Tab 補全,減少輸入錯誤。熟練掌握模式切換與基礎指令,即可從容應對 Cisco 路由器日常配置、故障排除與自動化部署。