第一步:配置域名
ra(config)#ip domain-name ctocio.com.cn
第二步:生成密鑰
ra(config)#crypto key generate rsa general-keys modulus 1024
//生成一個(gè)rsa算法的密鑰,密鑰為1024位
在Cisoc中rsa支持360-2048位,該算法的原理是:主機(jī)將自己的公用密鑰分發(fā)給相關(guān)的客戶機(jī)做葵,客戶機(jī)在訪問(wèn)主機(jī)時(shí)則使用該主機(jī)的公開(kāi)密鑰來(lái)加密數(shù)據(jù),主機(jī)則使用自己的私有的密鑰來(lái)解密數(shù)據(jù)牺堰,從而實(shí)現(xiàn)主機(jī)密鑰認(rèn)證九秀,確定客戶機(jī)的可靠身份嘁锯。
第三步:SSH的相關(guān)配置
ra(config)#ip ssh time 120 //設(shè)置ssh時(shí)間為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是路由器的遠(yuǎn)程登陸的虛擬端口志鞍,0 4表示可以同時(shí)打開(kāi)5個(gè)會(huì)話。
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ù)器上進(jìn)行認(rèn)證
ra(config-line)#username ctocio password ctocio
service password-encryption //將上述所配置密碼加密保存固棚;
crypto key zeroize rsa //停止Ssh服務(wù),清楚密鑰