萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 電腦故障排除 >  >> 電腦常見故障 >> 無法連上網路

Cisco 路由器配置入門:五種管理方式、六大命令模式與基礎操作全圖解

Cisco 路由器是企業網路核心設備,掌握其配置方式與命令模式是網管必修課。本文系統整理五種管理存取管道、六種命令提示字模式與首次設定關鍵參數,建立扎實 CLI 基礎。

五種管理存取方式

方式連接介面適用場景備註
1. ConsoleConsole 埠 + 終端機/終端模擬軟體首次設定、故障救援、頻外管理必經之路,預設 9600/8/N/1
2. AUX + ModemAUX 埠 + 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 terminalenable 進入 / 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 路由器日常配置、故障排除與自動化部署。

copyright © 萬盛學電腦網 all rights reserved