SSH实验(ENSP模拟器实现)
创作时间:
作者:
@小白创作中心
SSH实验(ENSP模拟器实现)
引用
CSDN
1.
https://blog.csdn.net/weixin_46008548/article/details/140476195
SSH(Secure Shell)是一种加密的网络协议,用于安全地远程登录和管理网络设备。本文将通过ENSP模拟器,详细介绍如何在路由器上配置SSH服务,包括创建密钥对、启用SSH服务器进程、设置AAA参数以及客户端访问等步骤。
概念
SSH全称安全外壳(Secure Shell)协议,这个协议的目的就是为了取代缺乏机密性保障的远程管理协议,SSH基于TCP协议的加密通道,让客户端使用服务器的RSA公钥来验证SSHv2服务器的身份。
创建密钥对
在充当SSH服务器的路由器上创建本地密钥对;本例中是AR1充当服务器,AR4充当客户端。
密钥对是一个公钥一个密钥,信息用公钥加密就用私钥解密,服务器会将公钥给客户端,客户端使用私钥加密数据之后,数据只能服务器的私钥才能解开,确保了数据安全性。
[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]:512
Generating keys...
.............++++++++++++
.++++++++++++
................................................................................
.................++++++++
.........++++++++
启用SSH服务器进程
路由器默认 SSH服务是没开启的,需要手动开启。
[AR1]stelnet server enable
Info: Succeeded in starting the STELNET server.
修改VTY虚拟接口的入站协议
SSH协议支持的认证模式只有aaa
[AR1]user-interface vty 0 4
[AR1-ui-vty0-4]authentication-mode aaa
# VTY接口允许接受的入站协议修改为SSH
[AR1-ui-vty0-4]protocol inbound ssh
设置aaa参数
创建的用户名为user1,密码为huawei
[AR1]aaa
[AR1-aaa]local-user user1 password cipher huawei
Info: Add a new user.
# 指定这个用户使用的协议,只能是ssh
[AR1-aaa]local-user user1 service-type ssh
设置SSH的认证类型
[AR1]ssh user user1 authentication-type ?
all All authentication, password or RSA
password Password authentication
password-rsa Both password and RSA
rsa RSA authentication
[AR1]ssh user user1 authentication-type password
Authentication type setted, and will be in effect next time
AR4(client)访问AR1(Server)
尝试连接时系统提示错误同时要求管理员运行, "ssh client first-time enable" 才能开启首次访问功能,没有这条命令那么服务器发给客户端的公钥,客户端无法保存,所以这才命令在SSH客户端上必不可少。
[AR4]stelnet 192.168.28.1
Please input the username:user1
Trying 192.168.28.1 ...
Press CTRL+K to abort
Connected to 192.168.28.1 ...
Error: Failed to verify the server's public key.
Please run the command "ssh client first-time enable"to enable the first-time ac
cess function and try again.
# 会报错
启用SSH首次访问功能并连接SSH服务器
[AR4]ssh client first-time enable
[AR4]stelnet 192.168.28.1
Please input the username:user1
Trying 192.168.28.1 ...
Press CTRL+K to abort
Connected to 192.168.28.1 ...
The server is not authenticated. Continue to access it? (y/n)[n]:y
Mar 28 2023 17:25:32-08:00 AR4 %%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.
[AR4]
Save the server's public key? (y/n)[n]:y
The server's public key will be saved with the name 192.168.28.1. Please wait...
Mar 28 2023 17:25:34-08:00 AR4 %%01SSH/4/SAVE_PUBLICKEY(l)[1]:When deciding whet
her to save the server's public key 192.168.28.1, the user chose Y.
[AR4]
Enter password:
<AR1>
查看SSH状态、SSH访问情况
在服务器上查看SSH状态,显示SSH的版本,显示SSH的功能是否启用
[AR1] display ssh server status
SSH version :1.99
SSH connection timeout :60 seconds
SSH server key generating interval :0 hours
SSH Authentication retries :3 times
SFTP Server :Disable
Stelnet server :Enable
查看会话
[AR1] display ssh server session
--------------------------------------------------------------------
Conn Ver Encry State Auth-type Username
--------------------------------------------------------------------
VTY 1 2.0 AES run password user1
--------------------------------------------------------------------
[AR1]
热门推荐
健康元创新药物JKN2403获批临床试验,慢阻肺治疗迎来新突破
佛教白玉菩提:历史、象征意义、制作工艺与鉴别方法全面解析
18家公司已退市或锁定退市,2024年将创历史新高
虞书欣《云为衫》雪中打戏爆火,从甜美少女到打戏女神的华丽转身
嵇康:以“越名教而任自然”引领魏晋风度
《功夫》:周星驰电影风格转变的关键一役
双色球最新开奖:谁是下一个幸运儿?
ETC新规下,你的钱包还好吗?
2024年C2驾照科目二:5大项目详解与备考全攻略
广东第八高峰金子山:71天冰雪世界,岭南赏雪胜地
“预料”完全指南:定义、近义词及13个实用例句
“人造太阳”可控核聚变的商业化前景
西湖花港观鱼,四季美如画
维多利亚港:东方之珠的璀璨地标,全球最大灯光秀点亮夜空
产教融合赋能,河北工程大学构建复合型人才培养体系
人均年入过万,河北这个人民公社为何能延续68年?
平安夜:从耶稣诞生纪念到全球爱与和平节日
乡愁剧场,一部透视农村生活的全面指南——走进农村电视剧大全
存单安全保存指南:物理存放、电子备份与挂失补办全流程
揭秘泰山郡:从山贼到朝廷命官的逆袭之路
中美日三国最早他汀药对比:从降脂强度到用药安全
阿房宫遗址考古:项羽焚宫说法系历史误会
家庭照明方案设计指南
洗衣机不排水?教你轻松检查和维修排水系统
从法定婚龄到彩礼退还:婚姻家事十大法律问题解析
利福平滴眼液:护眼神器的秘密武器
秋冬羊毛衫搭配指南:打造既温柔又时尚的造型
4万步到底有多远?揭秘步数换算的秘密
选购水族箱氧气泵必看:流量、压力等四大指标详解
简单四步,教你做出餐厅级美味红烧鲫鱼