-
实验拓扑
-
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]
- 服务端配置
[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]
- 客户端连接
[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>