1.0.0 华为设备 telnet与ssh的配置

一、telnet实验环境与要求
server服务器地址:192.168.1.1/24client客户端地址:192.168.1.2/24

二、配置telnet服务
华为设备,配置telnet服务的流程为:
- 开启telnet服务(华为设备默认开启)
- 创建用于telnet服务的用户
- 配置vty终端实现使用telnet登录
Server 设备配置
1.解决网络连通性
<Huawei>system-viewEnter system view, return user view with Ctrl+Z.[Huawei]sysname Server[Server]int g0/0/0[Server-GigabitEthernet0/0/0]ip add 192.168.1.1 24[Server-GigabitEthernet0/0/0]Nov 27 2022 19:53:46-08:00 Server %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. [Server-GigabitEthernet0/0/0]q#可以发现每对设备进行操作都会回显一些信息出来,为了美观的同时防止误认为是报错,可以将提示信息取消显示[Server]undo info-center enable Info: Information center is disabled.#关闭之后,后继操作将不会有过多的内容显示
2.根据要求创建telnet用户
[Server]aaa[Server-aaa]local-user telneter password cipher telneter privilege level 15 Info: Add a new user.命令解释:local-user telneter password cipher telneter privilege level 15 用户名 用户密码 权限等级[Server-aaa]local-user telneter service-type telnet 命令解释:仅允许telneter用户登录telnet服务
3.开启telnet服务与配置vty终端
[Server]telnet server enable Error: TELNET server has been enabled #因为telnet默认已经开启[Server]user-interface vty 0 4[Server-ui-vty0-4]authentication-mode aaa #配置认证模式为aaa,也就是使用 用户密码来登录[Server-ui-vty0-4]protocol inbound telnet #配置仅允许使用telnet 的方式进行登录到vty 0~4中如果你是想配置密码的方式来登录:[Server-ui-vty0-4]authentication-mode password Please configure the login password (maximum length 16):123456 #输入密码即可
Client 设备配置
4.配置客户端与服务器之间连通性
<Huawei>sysEnter system view, return user view with Ctrl+Z.[Huawei]sysname Client[Client]un in enInfo: Information center is disabled.[Client]int g0/0/0[Client-GigabitEthernet0/0/0]ip add 192.168.1.2 24[Client-GigabitEthernet0/0/0]q[Client]q
5.客户端测试telnet服务
<Client> telnet 192.168.1.1 #telnet连接server服务器 Press CTRL_] to quit telnet mode Trying 192.168.1.1 ... Connected to 192.168.1.1 ...Login authenticationUsername:telneter #输入账号Password: #输入密码<Server>sys #成功连接Enter system view, return user view with Ctrl+Z.[Server] #能够进入系统模式,表示拥有15的权限(管理权限)
小技巧:ENSP软件环境中可通过右键ENSP设备,查看设备串中号,从而在CRT中进行telnet连接:127.0.0.1:串口号,进行连接该设备


三、ssh实验环境与要求
server服务器地址:192.168.1.1/24client客户端地址:192.168.1.2/24建议基于上一个telnet环境进行ssh的操作,这样方便测试telneter用户只能用于telnet,ssher用户只能用于ssh。

四、配置ssh服务
华为设备,配置ssh服务的流程为:
- 开启ssh服务
- 创建用于ssh服务的用户,在ssh上进行绑定ssh用户
- 配置vty终端实现ssh服务
Server 设备配置
1.解决网络连通性
2.根据题目要求创建ssh用户,绑定ssh用户
[Server]aaa[Server-aaa]local-user ssher password cipher ssher privilege level 15[Server-aaa]local-user ssher service-type ssh[Server-aaa]q#将ssher用户添加到ssh用户列表中[Server]ssh user ssher authentication-type password Authentication type setted, and will be in effect next time#查看ssh用户列表[Server]display ssh user-information ------------------------------------------------------------------------------- Username Auth-type User-public-key-name ------------------------------------------------------------------------------- ssher password null -------------------------------------------------------------------------------
3.开启ssh服务,配置vty终端
#开启ssh服务[Server]stelnet server enable Info: Succeeded in starting the STELNET server.#配置vty终端[Server]user-interface vty 0 4[Server-ui-vty0-4]authentication-mode aaa[Server-ui-vty0-4]protocol inbound all #因需要测试telnet与ssh,所以开启all
Client 设备配置
4.解决客户端与服务器之间连通性
5.客户端测试ssh服务
<Client>system-viewEnter system view, return user view with Ctrl+Z.#注意,ssh连接需要在系统视图下进行,通过命令stelnet进行ssh连接[Client]stelnet 192.168.1.1Please input the username:ssherTrying 192.168.1.1 ...Press CTRL+K to abortConnected to 192.168.1.1 ...Error: Failed to verify the server's public key.Please run the command "ssh client first-time enable"to enable the first-time access function and try again.#第一次进行连接的时候,提示你需要进行输入命令:ssh client first-time enable[Client]ssh client first-time enable#再次ssh连接[Client]stelnet 192.168.1.1Please input the username:ssherTrying 192.168.1.1 ...Press CTRL+K to abortConnected to 192.168.1.1 ...#服务器未通过身份验证。是否继续访问?The server is not authenticated. Continue to access it? (y/n)[n]:y#是否保存服务器的公钥?Save the server's public key? (y/n)[n]:yThe server's public key will be saved with the name 192.168.1.1. Please wait...#最后输入ssher用户的密码,即可连接成功Enter password:<Server>sysEnter system view, return user view with Ctrl+Z.
6.测试telneter与ssher用户
- 为了验证telneter用户只能用于telnet,使用telner用户登录ssh
[Client]stelnet 192.168.1.1Please input the username:telnterTrying 192.168.1.1 ...Press CTRL+K to abortConnected to 192.168.1.1 ...Enter password:Enter password:Enter password:Info: The connection was closed by the remote host.
- 为了验证ssher用户只能用于ssh,使用ssher用户登录telnet
<Client>telnet 192.168.1.1 Press CTRL_] to quit telnet mode Trying 192.168.1.1 ... Connected to 192.168.1.1 ...Login authenticationUsername:ssherPassword:Error: Local authentication is rejected. Logged Fail!
- 结论就是通过service-type指定后的用户,仅能用于登录所指定的服务:local-user ssher service-type 服务类型
相关新闻
有人靠商品卡销售上亿!你却还不知道商品卡是什么?
使用三个月体验总结,告诉你vivo X90 Pro+究竟值不值得买
买2000价位的手机,强烈建议这三款,性价比真的太高了
东方雨虹:跑出绿色低碳高质量发展“加速度”
奋达科技:控股股东拟向格力金投转让公司5%股份
e公司讯,奋达科技(002681)3月27日晚间公告,公司控股股东肖奋拟将公司5%的股份,以4.38元/股协议转让给格力金投,转让价格约4亿元。转让后,肖奋持有公司22.47%股份,仍为控股股东;格力...
越南车企VinFast计划4月初向北美运送第二批电动汽车,美加共1800辆
彭博3月26日消息,越南电动汽车制造商VinFast计划于当地时间4月4日向北美运送第二批电动汽车。VinFast首席执行官黎氏秋水在给彭博的一份声明中表示,该公司将向美国加州和加拿大各运送900辆标...
友道智途获颁“无人驾驶智能网联汽车创新应用通知书”
中证网讯(记者王辉)友道智途3月23日发布消息表示,在3月22日举行的上海市浦东新区举行“促进无驾驶人智能网联汽车创新应用启动仪式”上,《上海市浦东新区促进无驾驶人智能网联汽车创新应用规定实施细则》...
- 精彩新闻