第一步:配置域名
ra(config)#ip domain-name ctocio.com.cn
第二步:生成密鑰
ra(config)#crypto key generate rsa general-keys modulus 1024
//生成一個rsa算法的密鑰,密鑰為1024位
在Cisoc中rsa支持360-2048位,該算法的原理是:主機將自己的公用密鑰分發(fā)給相關(guān)的客戶機,客戶機在訪問主機時則使用該主機的公開密鑰來加密數(shù)據(jù),主機則使用自己的私有的密鑰來解密數(shù)據(jù),從而實現(xiàn)主機密鑰認(rèn)證,確定客戶機的可靠身份。
第三步:SSH的相關(guān)配置
ra(config)#ip ssh time 120 //設(shè)置ssh時間為120秒
ra(config)#ip ssh authentication 4 //設(shè)置ssh認(rèn)證重復(fù)次數(shù)為4,可以在0-5之間選擇
rabbit(config)#ip ssh version 2
第四步:接口調(diào)用
rabbit(config)#line vty 0
VTY是路由器的遠程登陸的虛擬端口,0 4表示可以同時打開5個會話。
rabbit(config-line)#transport input ssh
第五步:SSH查看
rabbit(config)#do show ip ssh
SSH Enabled - version 2.0
Authentication timeout: 120 secs; Authentication retries: 5
第六步:創(chuàng)建用戶
ra(config)#aaa new-model
ra(config)#aaa authentication login default local //啟用aaa認(rèn)證,設(shè)置在本地服務(wù)器上進行認(rèn)證
ra(config-line)#username ctocio password ctocio
service password-encryption //將上述所配置密碼加密保存;
crypto key zeroize rsa //停止Ssh服務(wù),清楚密鑰