admin管理员组文章数量:1321323
某公司有一台核心设备R1,为了方便进行管理,配置SSH远程登录,使用路由器R2模拟客户端,配置SSH协议登录R1。
实验拓扑如下:
R1配置:
Router>en
Router#conf
Router(config)#hostname R1
R1(config)#int f0/0
R1(config-if)#ip add
R1(config-if)#hostname R1
R1(config-if)#ip add
R1(config-if)#ip add
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#no shutdown
R1(config-if)#ex
R1(config-if)#exit
R1(config)#username ccna pa
R1(config)#username ccna password ccna //设置登录使用的用户名密码和信息
R1(config)#ip domain-na
R1(config)#ip domain-name 123 //设置ip域名
R1(config)#
R1(config)#cry
R1(config)#crypto ke
R1(config)#crypto key ge
R1(config)#crypto key generate rsa //生成RSA密钥对
The name for the keys will be: R1.123
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]: 1024 //设置密钥对长度为1024
% Generating 1024 bit RSA keys, keys will be non-exportable…[OK]
R1(config)#
*3? 1 0:5:49.938: %SSH-5-ENABLED: SSH 1.99 has been enabled
配置vty
R1(config)#lin
R1(config)#line v
R1(config)#line vty 0 4
R1(config-line)#tr
R1(config-line)#transport in
R1(config-line)#transport input ssh //打开SSH登录服务
R1(config-line)#log
R1(config-line)#login lo
R1(config-line)#login local
R1(config-line)#
ssh的其它配置:
R1(config)#ip ssh time-out 30 //设置ssh超时时间为30s
R1(config)#ip ssh au
R1(config)#ip ssh authentication-retries 5 //设置ssh认证失败的次数为5次
R1(config)#ip ssh ver
R1(config)#ip ssh version 2 //设置ssh的版本
R2配置:
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho
Router(config)#hostname R2
R2(config)#
R2(config)#
R2(config)#int f0/0
R2(config-if)#ip add
R2(config-if)#ip address 192.168.2.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#no shutdown
验证:客户端R2登录R1
版权声明:本文标题:思科设备SSH登录配置 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/biancheng/1740412206a2273025.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论