日期:2015-11-10 點擊: 關(guān)鍵詞:Cisco路由器SSH配置方法
Cisco路由器SSH配置方法一:
cisco路由器配置ssh在Cisco路由器產(chǎn)品系列中只有7200系列、7500系列和12000系列(GSR)等高端產(chǎn)品的IOS支持SSH。一般支持SSH的IOS版本文件名中都帶有K8或者K8字樣,K8 代表56bit SSH 加密,k9代表168bit SSH加密。如我省省網(wǎng)GSR 12016和12008上用的IOS 就是一個支持56bit SSH 加密的版本。
目前Cisco的產(chǎn)品只支持SSH-1,還不支持SSH-2。下面以GSR 12008為例詳細(xì)介紹SSH-1的配置方法(斜體字為配置輸入的命令):
?、?配置hostname和ip domain-name:
Router#configure terminal
Router(config)#hostname TEST-GSR12008
TEST-GSR12008(config)#ip domain-name jx.cn.net
② 配置登錄用戶名和密碼(以本地認(rèn)證為例):
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服務(wù):
TEST-GSR12008(config)#crypto key generate rsa
The name for the keys will be: TEST-GSR12008.jx.cn.net
注:SSH的關(guān)鍵字名就是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]: 注:選擇加密位數(shù),用默認(rèn)就行了
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
現(xiàn)在SSH服務(wù)已經(jīng)啟動,如果需要停止SSH服務(wù),用以下命令:
TEST-GSR12008(config)#crypto key zeroize rsa
④設(shè)置SSH參數(shù)
配置好了SSH之后,通過show run命令我們看到SSH默認(rèn)的參數(shù):超時限定為120秒,認(rèn)證重試次數(shù)為3次,可以通過下面命令進(jìn)行修改:
TEST-GSR12008(config)#ip ssh {[time-out seconds]} | [authentication-retries interger]}
如果要把超時限定改為180秒,則應(yīng)該用:
TEST-GSR12008(config)# ip ssh time-out 180
如果要把重試次數(shù)改成5次,則應(yīng)該用:
TEST-GSR12008(config)# ip ssh authentication-retries 5
這樣,SSH已經(jīng)在路由器上配置成功了,就能夠通過SSH進(jìn)行安全登錄了
Cisco路由器SSH配置方法二:
1、 給路由器配置一個IP地址
interface GigabitEthernet 0/0
ip address x.x.x.x 255.255.255.0
2、 配置路由器的名字(默認(rèn)名字一定要改變)
hostname R1
3、 配置路由器的域名。路由器的域名一定要配置,隨便配置一個就可以了
Ip domain-name test.com
4、 產(chǎn)生非對稱密鑰,密鑰的名字是:R1.test.com。然后詢問密鑰的長度,這里輸入1024。
稍后路由器提示“SSH 1.99 has been enabled”,表示路由器可以支持SSH了。
crypto key generate rsa
5、 配置VTY用戶使用本地驗證,驗證的方法是SSH
username cisco,123 password cisco,123
line vty 0 4
login local
transport input ssh
6、 優(yōu)化調(diào)整SSH
ip ssh timeout 15 SSH窗口的超時時間,此時提示輸入密碼,如果用戶遲疑15秒鐘,然后再輸入,則認(rèn)為已經(jīng)超時,需刷新后重新輸入
ip ssh authentication-retries 3 每次SSH連接允許嘗試的次數(shù),三次登錄失敗后,需再次連接SSH
來源:互聯(lián)網(wǎng)