R1(config)#hostname R1 //配置ssh的时候路由器的名字不能为router
R1(config)#aaa new-model //默认是no aaa new-model, 如果配置为aaa new-model,line vty就不需要配置login local
R1(config)#ip domain-name cisco //SSH的关键字名就是hostname + ip domain-name,用来计算密钥
R1(config)#username cisco secret 123456//配置SSH登录的用户名和密码
R1(config)#enable secret 123456//配置进入enable 的密码
R1(config)#crypto key generate rsa general-keys modulus 1024 //生成密钥
R2(config)# ip ssh authentication-retries 5 //重试次数改成5次(默认3次)
R2(config)# ip ssh time-out 30 //配置超时时间为30秒(默认120秒)
R1(config)#line vty 0 4
R1(config-line)transport input ssh// 0到4线路,允许SSH登录
R1(config-line)login local //使用本地定义的用户名和密码登录,如果配置了aaa new-model这条命令就忽略,视情况使用
R1#show ip ssh//查看SSH信息
SSH Enabled - version 1.99 //SSH已启用 - 版本1.99(默认就是,CRT用版本2可登录)
Authentication timeout: 120 secs; Authentication retries: 3 //认证超时:120秒; 身份验证重试:3
R2#ssh -l cisco 10.1.1.1//在另外一台思科设备上登录