思科设备SSH登录配置

编程知识 更新时间:2023-05-02 02:31:29

某公司有一台核心设备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登录配置

本文发布于:2023-04-25 07:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/636e98b99fb4f7ce4301dcab929cb58b.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:思科   设备   SSH

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 102370文章数
  • 26159阅读数
  • 0评论数