头部右侧文字
头部左侧文字
当前位置:网站首页 > 科技 > 正文

1.0.0 华为设备 telnet与ssh的配置

cndao cndao ⋅ 2023-01-27 03:30:40

一、telnet实验环境与要求

server服务器地址:192.168.1.1/24client客户端地址:192.168.1.2/24
1.0.0 华为设备 telnet与ssh的配置

二、配置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:串口号,进行连接该设备

1.0.0 华为设备 telnet与ssh的配置

1.0.0 华为设备 telnet与ssh的配置

1.0.0 华为设备 telnet与ssh的配置

三、ssh实验环境与要求

server服务器地址:192.168.1.1/24client客户端地址:192.168.1.2/24建议基于上一个telnet环境进行ssh的操作,这样方便测试telneter用户只能用于telnet,ssher用户只能用于ssh。
1.0.0 华为设备 telnet与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 服务类型

相关新闻

cndao

cndao

TA太懒了...暂时没有任何简介

精彩新闻