1242ap開啓SSH

① 配置hostname和ip domain-name:
Router#configure terminal
Router(config)#hostname TEST-GSR12008
TEST-GSR12008(config)#ip domain-name jx.cn.net
② 配置登錄用戶名和密碼(以本地認證爲例):
TEST-GSR12008(config)#username test password 0 test
注:添加一個用戶:test,口令:test
TEST-GSR12008(config)#line vty 0 4
TEST-GSR12008(config-line)#login local
在這兩部分做完以後,用show run命令就能夠看到:
hostname TEST-GSR12008
!
boot system flash gsr-k3p-mz.120-14.S.bin
enable secret 5 $1$DMyW$gdSIOkCr7p8ytwcRwtnJG.
enable password 7 094F47C31A0A
!
username test password 7 0835495D1D
clock timezone PRC 16
redundancy
main-cpu
auto-sync startup-config
!
!
!
!
ip subnet-zero
no ip finger
ip domain-name jx.cn.net
ip name-server 202.101.224.68
ip name-server 202.101.226.68
!
③ 配置SSH服務:
TEST-GSR12008(config)#crypto key generate rsa
The name for the keys will be: TEST-GSR12008.jx.cn.net
注:SSH的關鍵字名就是hostname + . +ip domain-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 minutes.

How many bits in the modulus [512]: 注:選擇加密位數,用默認就行了
Generating RSA keys ...
[OK]

TEST-GSR12008(config)#end
TEST-GSR12008#write
Building configuration...
這時候用show run命令可以看到:
ip subnet-zero
no ip finger
ip domain-name jx.cn.net
ip name-server 202.101.224.68
ip name-server 202.101.226.68
ip ssh time-out 120
ip ssh authentication-retries 3
!
用命令show ip ssh也能看到:
SSH Enabled - version 1.5
Authentication timeout: 120 secs; Authentication retries: 3
現在SSH服務已經啓動,如果需要停止SSH服務,用以下命令:
TEST-GSR12008(config)#crypto key zeroize rsa
④設置SSH參數
配置好了SSH之後,通過show run命令我們看到SSH默認的參數:超時限定爲120秒,認證重試次數爲3次,可以通過下面命令進行修改:
TEST-GSR12008(config)#ip ssh {[time-out seconds]} | [authentication-retries interger]}
如果要把超時限定改爲180秒,則應該用:
TEST-GSR12008(config)# ip ssh time-out 180
如果要把重試次數改成5次,則應該用:
TEST-GSR12008(config)# ip ssh authentication-retries 5
這樣,SSH已經在路由器上配置成功了,就能夠通過SSH進行安全登錄了。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章