cisco SSH配置
SW#configure terminal
SW(config)#hostname R2 //配置ssh的时候路由器的名字不能为router
SW(config)#ip domain-name cisco.com //配置SSH必需
SW(config)aaa new-model 这个默认是开启的不用打也行,但要看是否有 no aaa new-model 如果no掉了ssh就无法认证了
SW(config)#username admin privilege 15 secret cisco 建议一个登陆用户
SW(config)#line vty 0 15
SW(config-line)#transport input ssh //只允许用SSH登录(注意:禁止telnet和从交换引擎session!)
SW(config-line)#transport input ssh telnet //这样就又允许ssh又允许telet 如果这样是很危险的,可以用Access进行一下限制,某些IP段可以Telnet某具必须ssh
SW(config)#crypto key generate rsa general-keys modulus 1024 //选择加密位数,cisco推荐使用1024
The name for the keys will be: R2.cisco.com
//注: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 minuts
How many bits in the modulus [512]: 注:选择加密位数,cisco推荐使用1024
Generating RSA keys ...
SW(config)# ip ssh time-out 60 //超时时间
SW(config)#ip ssh authentication-retries 2 //最大失败次数 ,测试时没感觉有效果
3.指定到某VTY的接口上
SW(config)# line vty 0 15
SW(config-line)#transport input ssh telnet
access-list 90 remark Hosts allowed to SSH in //低版本可能不支持remark关键字
access-list 90 permit 10.10.1.100
access-list 90 permit 10.10.1.101
line con 0
login local
line vty 0 4 login local //使用本地定义的用户名和密码登录
transport input SSH //只允许用SSH登录(注意:禁止telnet和从交换引擎session!)
access-class 90 in //只允许指定源主机登录