認識路由器:特殊用途的電腦
路由器本質是擁有多個網路介面的專用電腦:具備 CPU、RAM、ROM、Flash、NVRAM、系統匯流排、輸入輸出介面等硬體,運行嵌入式作業系統——Cisco IOS(Internetwork Operating System),提供路由、交換、存取控制、QoS、VPN 等網路服務。
Cisco IOS 架構與 CLI 模式
IOS 核心服務
- 基本路由與交換功能
- 可靠與安全的網路資源存取
- 可擴展的網路架構支援
CLI 階層模式
IOS 採用分層命令結構,不同模式對應不同配置範圍:
| 模式 | 提示符 | 進入方式 | 主要用途 |
| 用戶 EXEC | Router> | 預設登入 | 基本監控、ping、traceroute、show 部份指令 |
| 特權 EXEC | Router# | enable | 完整 show、debug、檔案操作、進入配置模式 |
| 全域配置 | Router(config)# | configure terminal | 全域性參數:主機名、IP 路由、安全、時間等 |
| 介面配置 | Router(config-if)# | interface type num | 單一介面參數:IP、封裝、頻寬、關閉/開啟 |
| 路由協議配置 | Router(config-router)# | router protocol | 動態路由協議參數 |
| 線路配置 | Router(config-line)# | line con/vty/aux 0 | Console、VTY、AUX 存取控制 |
EXEC 為命令解譯器,每條指令輸入後即時執行。? 可在任何模式顯示可用指令與說明。
首次連線:Console 埠實作
硬體準備
- Rollover 線纜(藍色扁平線)一條。
- RJ-45 轉 DB-9/DB-25 轉接頭(視 PC 序列埠而定)。
- 支援 VT100 終端機模擬的軟體:Windows 內建 HyperTerminal、Putty、Tera Term、SecureCRT 等。
連線步驟
- Rollover 線一端接路由器 Console 埠(標示 CONSOLE 或 CON),另一端接轉接頭再接 PC COM 埠(或 USB 轉序列埠)。
- 啟動終端機軟體,建立新連線:
連接埠:對應 COM 號(裝置管理員確認)
位元率:9600 bps
資料位:8
奇偶校驗:None
停止位:1
流量控制:None(硬體/軟體皆無)
- 開啟路由器電源,終端機顯示 POST 過程,最後出現:
Would you like to enter the initial configuration dialog? [yes/no]:
- 輸入
no 略過引導式安裝,按 Enter 進入用戶模式 Router>。
為何選 Console 而非 AUX?
所有思科路由器皆有 Console 埠,但並非所有機型有 AUX 埠。Console 提供直接、獨立、不依賴網路的管理通道,是故障排除的最後防線。
基礎配置實作範例
Router> enable
Router# configure terminal
Router(config)# hostname Taipei-BR
Taipei-BR(config)# enable secret Cis$co123
Taipei-BR(config)# line console 0
Taipei-BR(config-line)# password Con$olePwd
Taipei-BR(config-line)# login
Taipei-BR(config-line)# logging synchronous
Taipei-BR(config-line)# exec-timeout 10 0
Taipei-BR(config-line)# exit
Taipei-BR(config)# line vty 0 4
Taipei-BR(config-line)# password VtyP@ss
Taipei-BR(config-line)# login
Taipei-BR(config-line)# transport input ssh
Taipei-BR(config-line)# exit
Taipei-BR(config)# ip domain-name corp.local
Taipei-BR(config)# ip name-server 192.168.1.10
Taipei-BR(config)# no ip domain-lookup
Taipei-BR(config)# service password-encryption
Taipei-BR(config)# banner motd # Authorized Access Only! #
Taipei-BR(config)# end
Taipei-BR# write memory
常用導航熱鍵
- Ctrl+Z / end:任意配置模式返回特權模式。
- Ctrl+C:中斷指令或退出 Setup Mode。
- ↑/↓:歷史指令上下翻閱。
- Tab:指令自動補全。
do show running-config:在配置模式直接執行 EXEC 指令。
結語
Console 連線是思科設備管理的基石。熟練 CLI 模式切換、掌握基礎安全配置(主機名、密碼、SSH、Banner、加密)、善用說明系統與熱鍵,能讓後續進階配置(路由協議、ACL、VPN、QoS)事半功倍。建議新手在實體或模擬器(Packet Tracer、GNS3、EVE-NG)重複練習至流暢。
copyright ©
萬盛學電腦網 all rights reserved