ssh登录

  1. 实验拓扑
    在这里插入图片描述

  2. ip配置

[AR2-GigabitEthernet0/0/0]
[AR2-GigabitEthernet0/0/0]dis th
[V200R003C00]
#
interface GigabitEthernet0/0/0
 ip address 10.1.12.2 255.255.255.0 
#
return
[AR2-GigabitEthernet0/0/0]ping 10.1.12.1
  PING 10.1.12.1: 56  data bytes, press CTRL_C to break
    Reply from 10.1.12.1: bytes=56 Sequence=1 ttl=255 time=40 ms
    Reply from 10.1.12.1: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 10.1.12.1: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 10.1.12.1: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 10.1.12.1: bytes=56 Sequence=5 ttl=255 time=20 ms

  --- 10.1.12.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/24/40 ms

[AR2-GigabitEthernet0/0/0]
  1. 服务端配置
[AR1]stelnet server enable 																#开启服务
Info: Succeeded in starting the STELNET server.
[AR1]
[AR1]user-interface vty 0 4												#进入vty 0 4 视图
[AR1-ui-vty0-4]protocol inbound ssh 									#只允许ssh进行并设立虚拟端口
[AR1-ui-vty0-4]authentication-mode aaa									#设置为aaa认证模式
[AR1-ui-vty0-4]
[AR1-ui-vty0-4]aaa														#进入aaa视图
[AR1-aaa]local-user lu password cipher 123456							#创建用户和密码
Info: Add a new user.												
[AR1-aaa]local-user lu privilege level 15								#用户的权限
[AR1-aaa]local-user lu service-type ssh								    #用户用于的服务类型
[AR1]
[AR1]
[AR1]rsa local-key-pair create 											#生成秘钥对
The key name will be: Host
% RSA keys defined for Host already exist.
Confirm to replace them? (y/n)[n]:y
The range of public key size is (512 ~ 2048).
NOTES: If the key modulus is greater than 512,
       It will take a few minutes.
Input the bits in the modulus[default = 512]:1024				#默认为512
Generating keys...
.................++++++
.......................++++++
....................++++++++
.......++++++++

[AR1]
  1. 客户端连接
[AR2]ssh client first-time enable 																								#开启ssh客户端
[AR2]stelnet 10.1.12.1																														#用ssh连接
Please input the username:lu																											#输入用户名
Trying 10.1.12.1 ...
Press CTRL+K to abort
Connected to 10.1.12.1 ...
The server is not authenticated. Continue to access it? (y/n)[n]:y			
Nov  9 2022 17:33:29-08:00 AR2 %%01SSH/4/CONTINUE_KEYEXCHANGE(l)[0]:The server h
ad not been authenticated in the process of exchanging keys. When deciding wheth
er to continue, the user chose Y. 
[AR2]
Save the server's public key? (y/n)[n]:y							#是否保存服务器的公钥
The server's public key will be saved with the name 10.1.12.1. Please wait...

Nov  9 2022 17:33:34-08:00 AR2 %%01SSH/4/SAVE_PUBLICKEY(l)[1]:When deciding whet
her to save the server's public key 10.1.12.1, the user chose Y. 
[AR2]
Enter password:							#输入密码(密码不显示)
<AR1>								#登录成功
<AR1>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值