思科设备SSH登录配置

某公司有一台核心设备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.com //设置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.com
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
在这里插入图片描述

  • 7
    点赞
  • 104
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值