萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 網路安全 >  >> 路由器知識 >> 路由器設定 >> Cisco 思科路由器

思科路由器基礎配置完整教學:從 IOS 架構到密碼安全與模式導航

思科路由器與 IOS 基礎認知

路由器 = 多介面專用電腦

CPU、RAM、ROM、Flash、NVRAM、系統匯流排、介面控制器——與 PC 架構同源,差異在於專用軟體(IOS)與網路介面優化。

Cisco IOS:嵌入式網路作業系統

  • 單一映像檔(.bin)含核心、驅動、協議、管理功能。
  • 特性集:IP Base、IP Services、Advanced IP Services、Advanced Enterprise Services 等,授權決定功能範圍。
  • 版本號範例:15.7(3)M4 → 主版本.次版本(維護版本)修訂版本。

IOS 核心網路服務

  • 路由與交換(RIP、EIGRP、OSPF、IS-IS、BGP、STP、VLAN、EtherChannel)。
  • 安全存取(AAA、ACL、ZBFW、VPN、IPS、802.1X、TrustSec)。
  • 可擴展架構(VRF、MPLS、LDP、RSVP-TE、Segment Routing、EVPN)。

CLI 階層模式完整導航

模式提示符進入指令退出指令權限範圍
用戶 EXECRouter>登入預設exit/logout唯讀監控、基礎測試
特權 EXECRouter#enabledisable/exit完整監控、檔案操作、除錯、進入配置
全域配置Router(config)#configure terminalend/Ctrl+Z全域參數、功能啟用、進入子模式
介面配置Router(config-if)#interface type numexit單一介面屬性
子介面配置Router(config-subif)#interface type num.subexitVLAN/Frame Relay/Dialer 子介面
路由協議配置Router(config-router)#router protocol [as]exit動態路由參數
線路配置Router(config-line)#line con/vty/aux numexit管理存取控制
VLAN 資料庫Router(vlan)#vlan database (舊) / vlan config (新)exitVLAN 建立/刪除(舊式)

導航鍵:Ctrl+Z/end 直達特權;exit 逐層返回;do show ... 在配置模式執行 EXEC 指令。

首次配置:Console 連線實作

硬體連線

  • Rollover 線(藍色扁平)接 Console 埠(RJ-45)。
  • RJ-45 轉 DB-9/DB-25 接 PC 序列埠(或 USB 轉序列)。

終端機參數

9600 bps, 8 data bits, 1 stop bit, no parity, no flow control, VT100 emulation

軟體推薦

  • Windows:PuTTY、Tera Term、SecureCRT、MobaXterm。
  • Mac/Linux:screen /dev/ttyUSB0 9600、minicom、picocom。

基礎配置實作範例

Router> enable
Router# configure terminal
Router(config)# hostname R1-TPE
R1-TPE(config)# enable secret C1$coEn@ble!
R1-TPE(config)# service password-encryption
R1-TPE(config)# no ip domain-lookup
R1-TPE(config)# ip domain-name corp.local
R1-TPE(config)# ip name-server 192.168.1.10 8.8.8.8
R1-TPE(config)# line console 0
R1-TPE(config-line)# password Con$olePwd!
R1-TPE(config-line)# login
R1-TPE(config-line)# logging synchronous
R1-TPE(config-line)# exec-timeout 10 0
R1-TPE(config-line)# exit
R1-TPE(config)# line vty 0 4
R1-TPE(config-line)# password VtyP@ss!
R1-TPE(config-line)# login local
R1-TPE(config-line)# transport input ssh
R1-TPE(config-line)# exec-timeout 15 0
R1-TPE(config-line)# exit
R1-TPE(config)# username admin privilege 15 secret Adm1n$tr0ng!
R1-TPE(config)# aaa new-model
R1-TPE(config)# aaa authentication login default local
R1-TPE(config)# banner motd # Unauthorized Access Prohibited! #
R1-TPE(config)# end
R1-TPE# write memory

密碼安全機制深度解析

密碼類型指令加密演算法安全性用途
Enable Passwordenable passwordType 7 (可逆弱加密)低舊版相容,不建議使用
Enable Secretenable secretMD5 (Type 5) / SHA-256 (Type 8) / PBKDF2 (Type 9)高特權模式主要密碼,必設
Line Passwordline ... passwordType 7 / Type 8/9 (IOS 15.3+)中Console/AUX/VTY 登入密碼
Username Secretusername ... secretType 5/8/9高AAA 本地認證、SSH 公開金鑰
最佳實務:全面使用 secret(Type 8/9),啟用 service password-encryption,停用 enable password,部署 AAA+TACACS+/RADIUS 集中認證。

配置管理與備份

  • show running-config:當前運行配置(RAM)。
  • show startup-config:NVRAM 啟動配置。
  • copy running-config startup-config / write memory:存檔。
  • copy running-config tftp://server/file:遠端備份。
  • erase startup-config + reload:恢復出廠預設(慎用)。

結語

掌握 IOS 架構、CLI 模式導航、Console 連線、基礎安全配置(主機名、密碼分級、SSH、AAA、Banner、時間、日誌)、配置備份,是思科網管的入門必修課。建議在模擬器(Packet Tracer、GNS3、EVE-NG、CML)建立個人實驗拓撲,反覆練習至指令行雲流水,再進入生產環境操作。

copyright © 萬盛學電腦網 all rights reserved