当前位置:网站首页>华为设备远程登录(Telnet、SSH)配置
华为设备远程登录(Telnet、SSH)配置
2022-07-25 08:10:00 【wespten】
一、Telnet登录配置
一台交换机能够通过Telnet登录的条件是:
交换机已经配置了IP地址;
交换机已经配置了远程登录密码;
交换机已经配置了特权密码;
交换机已经接入网络并开始工作;
这时,我们可以通过网络中的一台计算机,在命令行下输入“telnet 交换机IP地址”登录到交换机上对交换机进行配置。
如果登录的交换机没有配置远程登录密码,会显示“Password required, but none set”的错误提示信息;如果没有设置特权密码,在进入特权模式时会显示“%No password set”的错误提示信息。
所以,对于一台新购置的交换机,必须先用控制台为交换机配置IP地址和远程登录密码,以后就可以用远程登录管理这台交换机了。
1. 配置举例:
用控制台为交换机配置IP地址、远程登录密码和特权密码。
Switch>enable
Switch#configure terminal
Switch(config)#interface vlan 1
Switch(config-if)#ip address 192.168.1.5 255.255.255.0
Switch(config-if)#exit
Switch(config)#line vty 0 4
Switch(config-line)#login
Switch(config-line)#password 123
Switch(config-line)#exit
Switch(config)#enable secret 456
Switch(config)#end
Switch#完成以上配置后,我们可以通过网络中的一台计算机,用 telnet 192.168.1.5 登录交换机,登录密码为123。登录后,进入特权模式的密码为456。
默认情况下,Telnet Server是打开的,任何人都可以用Telnet访问交换机,我们可以用命令禁止使用Telnet访问交换机。
模式:在全局配置模式中配置。
关闭Telnet Server:
Switch(config)#no enable service telnet-server开启Telnet Server:
Switch(config)#enable service telnet-server说明:关闭Telnet访问不影响使用控制台、Web和SNMP访问交换机。
2. 配置举例:
关闭交换机的远程登录访问。
Switch>enable
Switch#configure terminal
Switch(config)#no enable service telnet-server当Telnet Server开启时,我们可以配置允许远程登录的IP地址,这样,可以限制用户只能从指定计算机远程登录交换机。
模式:在全局配置模式中配置。
配置命令:
Switch(config)#service telnet host host-ip参数 host-ip 为允许远程登录的用户的IP地址。
说明:你可以多次使用此命令设置多个允许远程登录的合法用户IP。如果不配置此项,默认是不限制使用者的IP地址。
删除配置的Telnet限制:
Switch(config)#no service telnet host host-ip此命令只删除指定的IP。
Switch(config)#no service telnet host此命令删除所有的IP。
3. 配置举例:
只允许IP地址为192.168.1.10和192.168.1.30的用户用Telnet登录交换机。
Switch>enable
Switch#configure terminal
Switch(config)#service telnet host 192.168.1.10
Switch(config)#service telnet host 192.168.1.30当你用Telnet登录交换机后,如果在设定的超时时间内没有任何输入,交换机会自动断开该连接,所以设置超时时间有一定的保护作用。
Telnet的超时时间默认为5分钟,你可以用命令修改它。
模式:线路配置模式
配置命令:
Switch(config-line)#exec-timeout time参数 time 为设置的超时时间,单位为秒,取值为0~3600,如果设置为0,表示不限定超时时间。
说明:你必须先用 line vty 命令进入远程登录的线路模式再配置超时时间。
删除配置的Telnet超时时间:
Switch(config-line)#no exec-timeout删除后,超时时间恢复为默认的5分钟。
4. 配置举例:
设置远程登录的超时时间为10分钟(600秒)。
Switch>enable
Switch#configure terminal
Switch(config)#line vty
Switch(config-line)#exec-timeout 600在特权模式下,用 show service 命令可以查看Telnet Server是否已被禁用。
5. 配置举例:
查看交换机Telnet Server的状态。
Switch>enable
Switch#show service
SSH-server : Enabled
Snmp-agent : Disabled
Telnet-server : Enabled
Web-server : Enabledshow service命令显示了SSH Server、SNMP Agent、Telnet Server和Web Server四种管理方式的使能状态,“Enabled”为开启,“Disabled”为关闭。
二、SSH登录配置
1. 开启telnet服务:
stelnet server enable2. aaa下创建用户:
aaa
local-user test001 password irreversible-cipher [email protected]
local-user test001 service-type terminal ssh
local-user test001 level 153. 开启用户首次登录设备不检查公钥。
ssh client first-time enable 当STelnet/SFTP客户端第一次登录SSH服务器时,因为此时STelnet/SFTP客户端还没有保存SSH服务器的公钥。那么在STelnet/SFTP客户端第一次登录SSH服务器时,不对SSH服务器的公钥进行有效性检查。登录后,系统将自动分配并保存公钥,为下次登录时认证。
4. vty下配置认证模式为aaa,支持通过SSH协议登录设备
user-interface vty 0 9
authentication-mode aaa
protocol inbound ssh
user privilege level 32步骤的 local-user test001 level 15优先于4步骤的user privilege level 3,当2步骤未配置local-user test001 level 15时,则使用4步骤的user privilege level 3
5. 新版本增加的功能。
ssh ipv6 server-source all-interfacessh server-source all-interface 指定SSH服务器的源接口为设备上所有配置ip的接口 或 ssh server-source -i interface xxxx,指定SSH服务器的源接口为某一个接口。如果同时配置,则会优先选择ssh server-source -i命令指定的接口作为ssh服务器的源接口,如果指定的源接口无法登录成功,则会从其他有效接口中选择接口登录。
配完以上步骤即可使用ssh登录。
6. 创建ssh user
是否创建ssh user用户取决于ssh authentication-type default password命令。如果配置了undo ssh authentication-type default password,则需要创建ssh用户。
如果配置了ssh authentication-type default password 则无需创建ssh user即可登录。
如果配置了undo ssh authentication-type default password 则需要创建ssh user 才能登录。
ssh user test001
ssh user test001 authentication-type password
ssh user test001 service-type stelnet如果即配置了ssh authentication-type default password又创建了ssh user,则使用ssh user登录,如果此时未配置ssh user test002 authentication-type或ssh user test002 service-type stelnet则无法登录。
7. 配置acl
acl ipv6 number 2001
description For SSH v6
rule 5 permit source 2409::/128
acl number 2000
description For STelnet
rule 5 permit source 1.1.1.0 0.0.0.255
ssh server acl 2000
ssh ipv6 server acl 2001
user-interface vty 0 9
acl ipv6 2001 inbound
acl 2000 inbound注释:ssh server acl 2000和acl 2000 inbound有一个拒绝,动作就是拒绝。
各业务模块的ACL默认动作及ACL处理机制:

在telnet和stelnet使用时,如果所有rule未匹配到,即使不配deny,默认动作就为deny。如果acl中未配置任何rule,则默认为permit允许。
边栏推荐
- How to create a simple electron desktop program
- 文献学习(part101)--CONVEX BICLUSTERING
- Niuke dynamic planning training
- RTOS系列(13):汇编LDR指令、LDR伪指令、[Rn]寄存器间接引用 详细解析
- 一次简单的SQL注入靶场练习
- Redis best practices
- Changes were made to tables that cannot be recreated or the prevent saving changes that require the table to be recreated option was enabled
- Redis fragment cluster
- Vs2019 C MFC installation
- Teach you to understand the computer optometry sheet
猜你喜欢

刷题《剑指Offer》day02

Test the mock data method of knowing and knowing

Competition path design of beacon group

Introduction and principle explanation of 30 common sensor modules in IOT embedded devices
![RTOS series (13): assembly LDR instruction, LDR pseudo instruction, [rn] register indirect reference detailed analysis](/img/87/d116e729c771fcf3ce95958a45d85f.png)
RTOS series (13): assembly LDR instruction, LDR pseudo instruction, [rn] register indirect reference detailed analysis
![RTOS系列(13):汇编LDR指令、LDR伪指令、[Rn]寄存器间接引用 详细解析](/img/87/d116e729c771fcf3ce95958a45d85f.png)
RTOS系列(13):汇编LDR指令、LDR伪指令、[Rn]寄存器间接引用 详细解析

Raspberrypico analytic PWM

一款强大的端口扫描工具(nmap)

Network file storage system (II) practical operation of Minio distributed file system

enq: HW – contention等待引起的故障分析
随机推荐
uiautomator2 常用命令
Redis core principles
Can Flink's current capabilities support the synchronization of a table from source (MySQL) to sink (MySQL) to separate databases and tables
[dark horse programmer] redis learning notes 001: introduction to redis + five basic data types
A simple hotel background management system based on jsp+servlet+mysql
Oracle trigger creation
第3章业务功能开发(修改线索,数据回显并修改数据)
[dark horse programmer] redis learning notes 005: enterprise level solutions
Advanced C language (XII) - dynamic memory management
滴滴 - dispatching
Technical Analysis | Doris connector combined with Flink CDC to achieve accurate access to MySQL database and table exactly once
Check the computer restart times and reasons
"Unable to recognize" yarn "item as cmdlet, function, script file
016 fundamentals of machine learning mathematics: Introduction
Learn no when playing 8 | the enterprise saves hundreds of thousands in an instant, just because it uses it
Dirty data and memory leakage of ThreadLocal
Network packet loss, network delay? This artifact helps you solve all problems
7.24模拟赛总结
【黑马程序员】Redis学习笔记001:Redis简介+五种基本数据类型
一款强大的端口扫描工具(nmap)