当前位置:网站首页>华为设备远程登录(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允许。
边栏推荐
- Common commands of raspberry pie
- ArcGIS Pro脚本工具(10)——从图层生成.stylx样式符号
- Network file storage system (III) practice of fastdfs distributed file system
- In depth analysis of yolov7 network architecture
- Uiautomator2 common commands
- CM4 development cross compilation tool chain production
- Problems easily ignored by POM
- A simple hotel background management system based on jsp+servlet+mysql
- Codeforces Round #809 Editorial(A,B,C)
- ArcGIS Pro scripting tool (10) -- generate.Stylx style symbols from layers
猜你喜欢

Competition path design of beacon group

Node+js build time server

Advanced C language (11) - user defined data types

Redis分片集群

Chapter 3 business function development (realize the real-time response of the select all button)

Advanced C language (XIII) - Example Analysis of dynamic memory management

Ensembles in RNA counts data in TCGA_ ID to gene_ Method of ID

The two Nobel Prize winners became the chief scientist of the sky high price Baijiu of "taishanglaojun holding a dream"

Redis best practices

CentOS 8.2 MySQL installation (xshell6)
随机推荐
滴滴 - dispatching
Network packet loss, network delay? This artifact helps you solve all problems
第3章业务功能开发(实现全选按钮实时的响应)
How to create a simple electron desktop program
[5g NR] 3GPP common protocol sorting
TCGA simple download tool V16 installation error
Competition path design of beacon group
Rstudio shows that it can't connect to the web page, or it has a new website.
How to obtain the intersection / subtraction / Union of two sets by MySQL
Hotel room management system based on jsp+servlet+mysql
Changes were made to tables that cannot be recreated or the prevent saving changes that require the table to be recreated option was enabled
Learn when playing No 4 | can you take an online exam in programming? Right here →
RK3399开发板I2C4挂载EEPROM实例
[5g NR] UE registration rejection reason
If there is complex select nesting in the SQL of the flick CDC, when it encounters the binlog of delete, it will
[audio and video] picture YUV data format
Problems easily ignored by POM
Raspberry connects EC20 for PPP dialing
Introduction and principle explanation of 30 common sensor modules in IOT embedded devices
batchnorm 和layernorm的区别