Telnet 以明文傳輸所有資料(含帳號、密碼、指令),攻擊者僅需在鏈路上部署嗅探工具(如 Wireshark、Sniffer),即可輕易竊取登入憑證與完整操作紀錄。實測中,密碼甚至被拆分於多個 TCP 封包中,經驗豐富的攻擊者極易重組。任何透過 Telnet 的管理操作都處於「裸奔」狀態。
SSH 分為 1.x 與 2.x 兩個不相容版本,現代部署建議強制使用 SSHv2。
k9)。R2> enable
R2# configure terminal
R2(config)# hostname R2
R2(config)# ip domain-name cisco.com
R2(config)# crypto key generate rsa general-keys modulus 1024
% The key modulus size is 1024 bits
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]
*Mar 1 00:09:46.607: %SSH-5-ENABLED: SSH 1.99 has been enabled
R2(config)# ip ssh time-out 120
R2(config)# ip ssh authentication-retries 4
R2(config)# line vty 0 4
R2(config-line)# transport input ssh
R2(config-line)# login local
R2(config-line)# exit
R2(config)# aaa new-model
R2(config)# aaa authentication login default local
R2(config)# username admin privilege 15 secret StrongP@ssw0rd
R2(config)# line vty 0 4
R2(config-line)# login authentication default
R2(config-line)# end
R2# write memory
| 指令 | 用途 |
|---|---|
crypto key generate rsa modulus 1024 | 產生 1024-bit RSA 金鑰對,支援 SSHv1/v2。建議 2048-bit 強度。 |
ip ssh time-out 120 | SSH 連線逾時 120 秒,預設 120 秒。 |
ip ssh authentication-retries 4 | 登入重試次數 4 次(0-5),防暴力破解。 |
transport input ssh | 限制 VTY 僅接受 SSH,拒絕 Telnet。 |
aaa new-model + login authentication default | 啟用 AAA 本地認證,支援特權 15 直接進入特權模式。 |
ssh admin@172.16.1.1。admin 與密碼 StrongP@ssw0rd 登入成功。crypto key generate rsa modulus 2048。ip ssh version 2。access-class 10 in)。crypto key zeroize rsa 後重新產生。SSH 不僅是路由器安全管理的標準,更適用於伺服器、防火牆、交換器等所有網路設備的遠端維運。部署 SSH、停用 Telnet、啟用 AAA、限制來源 IP、集中認證、審計日誌——構建纵深防禦,守護網路管理平面安全。