- 相關推薦
思科路由器SSH配置案例
SSH 為建立在應用層基礎上的安全協議。SSH 是目前較可靠,專為遠程登錄會話和其他網絡服務提供安全性的協議。利用 SSH 協議可以有效防止遠程管理過程中的信息泄露問題。下面是思科路由器SSH配置案例,希望對你有幫助!
1. 配置hostname和ipdomain-name
Router#configure terminal
Router(config)#hostname R2 //配置ssh的時候路由器的名字不能為router
R2(config)#ip domain-name cisco.com //配置SSH必需
R2(config)#username best password best1
或 username best privilege 15 password 7 best1
注:添加一個用戶:best,口令:best1
R2(config)#line vty 0 4
R2(config-line)#transport input ssh //只允許用SSH登錄(注意:禁止telnet和從
交換引擎session!)
2. 配置SSH服務:
R2(config)#crypto key generate rsa
The name for the keys will be: R2.cisco.com
注:SSH的關鍵字名就是hostname + . +ipdomain-name
Choose the size of the key modulus in the range of 360 to 2048 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minuts
How many bits in the modulus [512]: 注:選擇加密位數,cisco推薦使用1024
Generating RSA keys ...
[OK]
用命令show ip ssh也能看到:
SSH Enabled - version 1.5
Authentication timeout: 120 secs; Authentication retries:
現在SSH服務已經啟動,如果需要停止SSH服務,用以下命令:
R2(config)#crypto key zeroize rsa
3.設置SSH參數
配置好了SSH之后,通過show run命令我們看到SSH默認的參數:超時限定為120秒,認證重試次數為3次,可以通過下面命令進行修改:
R2(config)#ip ssh {[time-out seconds]} │ [authentication-retries interger]}
如果要把超時限定改為180秒,則應該用:
R2(config)# ip ssh time-out 180
如果要把重試次數改成5次,則應該用:
R2(config)# ip ssh authentication-retries
這樣,SSH已經在路由器上配置成功了,就能夠通過SSH進行安全登錄了。
注意:最后如果從別的設備用ssh登錄這臺路由器會出現以下內容:
R1#ssh -l best 192.168.0.2
Password:
R2>en
% Error in authentication.
為什會出現以上內容?
因為在R2上沒有配置enablepassword/secret xxxx
R2配置上enable secret 5 $1$fJxo$suWiTzmfdj/vkvXfRHBcw/
那么在R1上:
R1#ssh -l best 192.168.0.2
Password:
R2>en
Password:
R2#confi g
【思科路由器SSH配置案例】相關文章:
Cisco路由器配置命令08-22
常見的路由器配置錯誤01-06
Cisco路由器ISDN配置教程07-16
思科交換機基本配置命令大全04-07
交換機DHCP Sever的配置「案例」07-16
配置顯示器顏色配置文件方法教程12-02
思科交換機產品介紹07-18
思科最實用的技術命令大全04-02
淺談路由器安全07-16
路由器的設置方法07-16