华为交换机、路由器配置查询、用户界面常见配置及安全加固

华为交换机、路由器配置查询、用户界面常见配置及安全加固。

一、查询命令

bash 复制代码
1.常用的查询命令
查看当前生效的配置信息:
display current-configuration
//正在生效的配置,默认参数不显示。

查看当前视图下生效的配置信息:
display this
//常用于接口视图,正在生效的配置,默认参数不显示。

2.常用的正则表达式管道符"|"的使用(begin、exclude、include)
| begin    直到过滤出匹配的项目,剩下内容全部显示出来。

| exclude  输出不匹配所有行。`

| include  只输出匹配所有行。

3.诊断信息查询
display diagnostic-information
//该命令集合了多条常用display命令的输出信息。

二、用户界面(User-interface)

bash 复制代码
常用的用户界面
1.Console(CON)用户界面
设备上一个物理接口(Console口),计算机的串口或者USB口------使用Console线连接到------通信设备的Console口------实现本地访问。
2.VTY用户界面。
虚拟类型终端(Virtual Type Terminal)是一种虚拟线路端口,使用远程登录(telnet、ssh)方式进行访问,最多支持21个用户同时访问。

用户界面的用户级别(level)管理
1.Password验证,需要在用户界面配置Level。

[MYWS-ui-console0]dis th
#
user-interface con 0 
 authentication-mode password  //配置password验证
 user privilege level 15     //配置用户权限级别
 set authentication password cipher PASSWORD  //设置登录密码

之前写个关于ssh配置-传送门

bash 复制代码
2.AAA验证,需要在AAA视图下配置Level。

[MYWS-ui-console0]dis th
#
user-interface vty 0 4
authentication-mode aaa    
//配置VTY用户认证方式为AAA认证
protocol inbound ssh    
//配置VTY用户界面支持的协议为SSH协议
quit

aaa
local-user NAME password irreversible-cipher PASSWORD
//创建与SSH用户同名的本地用户和对应的登录密码
local-user NAME service-type ssh   
//配置本地用户的服务方式为SSH
local-user NAME privilege level (1-15)   
//配置本地用户级别 
quit
-------------设备命令操作-------------
[MYWS]dis user-interface    //可查看到设备当前支持的用户界面以及它们的绝对编号
  Idx  Type     Tx/Rx      Modem Privi ActualPrivi Auth  Int     
+ 0    CON 0    9600       -     3     3           N     -       
  34   VTY 0               -     0     -           P     -       
  35   VTY 1               -     0     -           P     -       
  36   VTY 2               -     0     -           P     -       
  37   VTY 3               -     0     -           P     -       
  38   VTY 4               -     0     -           P     -       
  50   VTY 16              -     0     -           P     -       
  51   VTY 17              -     0     -           P     -       
  52   VTY 18              -     0     -           P     -       
  53   VTY 19              -     0     -           P     -       
  54   VTY 20              -     0     -           P     -       
  67   LTT 0    9600       -     0     -           N     -       
  68   LTT 1    9600       -     0     -           N     -       
  69   LTT 2    9600       -     0     -           N     -       
  70   LTT 3    9600       -     0     -           N     -       
  71   LTT 4    9600       -     0     -           N     -       
  72   LTT 5    9600       -     0     -           N     -       
  73   LTT 6    9600       -     0     -           N     -       
  74   LTT 7    9600       -     0     -           N     -       
  75   LTT 8    9600       -     0     -           N     -       
  76   LTT 9    9600       -     0     -           N     -       
  77   LTT 10   9600       -     0     -           N     -       
  78   LTT 11   9600       -     0     -           N     -       
  79   LTT 12   9600       -     0     -           N     -       
  80   LTT 13   9600       -     0     -           N     -       
  81   LTT 14   9600       -     0     -           N     -       
  82   LTT 15   9600       -     0     -           N     -       
  83   LTT 16   9600       -     0     -           N     -       
UI(s) not in async mode -or- with no hardware support: 
1-32  
  +    : Current UI is active.    
  //当前用户界面处于活动状态。
  F    : Current UI is active and work in async mode. 
  //当前用户界面是活动的,在异步模式下工作。
  Idx  : Absolute index of UIs.
  //用户界面的绝对索引。
  Type : Type and relative index of UIs.
  //UI 的类型和相对索引。
  Privi: The privilege of UIs.
  //UI 的特权。
  ActualPrivi: The actual privilege of user-interface.
  //用户界面的实际特权。
  Auth : The authentication mode of UIs.
  //UI 的身份验证模式。
      A: Authenticate use AAA. //使用 AAA 进行身份验证。
      N: Current UI need not authentication. //当前用户界面不需要身份验证。
      P: Authenticate use current UI's password. //使用当前用户界面的密码进行身份验证。
  Int  : The physical location of UIs.
   //UI 的物理位置。

三、用户界面一些小细节参数调整

bash 复制代码
1.可以根据实际使用需求设置最大数
[MYWS]user-interface ?
  INTEGER<0,34-48,50-54>   The first user terminal interface to be configured
  console                  Primary user terminal interface
  current                  The current user terminal interface
  maximum-vty              The maximum number of VTY users, the default value
                           is 5
  vty                      The virtual user terminal interface 

[MYWS]user-interface maximum-vty ?
  INTEGER<0-15>  The maximum number of VTY users, the default value is 5
  //VTY 用户的最大数量,默认值为5

[MYWS]user-interface maximum-vty 15  //可以根据实际使用需求设置最大数

2. 配置Console用户界面的物理属性(默认一般不调整:传输速率-9600 bit/s,不进行流控、不进行校验、停止位-1、数据位-8)
  user-interface con 0 
(speed、flow-control、parity、stopbits、databits)

3. 设置用户超时断连功能
user-interface con 0 或者 vty界面
[MYWS-ui-console0]idle-timeout ?
  INTEGER<0-35791>  Set the number of minutes before a terminal user timesout(default: 10minutes)
  //设置终端用户超时前的分钟数(默认为10分钟)

4.清除在线用户
当用户需要将某个登录用户与设备的连接断开时,可以清除指定的在线用户。
kill user-interface 参数
//清除在线用户

5.用户界面通信
执行命令send 参数
//指定发送消息的用户界面,根据系统提示,输入消息并发送。
<MYWS>send ?
  INTEGER<0-54>  Specify a user terminal interface and configure it 
  all            All user terminal interfaces
  console        Primary user terminal interface
  vty            The virtual user terminal interface 

<MYWS>send all ?
  <cr>  

<MYWS>send all 

Enter message, end with CTRL+Z or Enter; abort with CTRL+C:
MYWS!!!
Warning: Send the message? [Y/N]:y

6. 安全加固(限制那些用户能否登陆成功)比较实用
用户界面支持ACL(基本ACL(2000~2999)和高级ACL(3000~3999))。
[MYWS]user-interface vty 0 4
[MYWS-ui-vty0-4]acl ?
  INTEGER<2000-3999>  Apply basic or advanced ACL
  ipv6                Filter IPv6 addresses

[MYWS-ui-vty0-4]acl ?
[MYWS-ui-vty0-4]acl 2000 ?
  inbound   Filter login connections from the current user interface
  outbound  Filter logout connections from the current user interface

[MYWS-ui-vty0-4]acl 2000 
这个ACL的inbound、outbound比较关键。请看图


四、检查配置结果

bash 复制代码
也是运维过程中常见的手段方法。
display users all
//查看用户界面的使用信息。
display user-interface console 0
//查看Console用户界面信息。
display user-interface maximum-vty
//查看VTY类型用户界面的最大个数。
display user-interface vty 0
//查看VTY用户界面信息。
display ssh server ip-block all
//查看所有认证失败的客户端IP地址。
display ssh server ip-block list
//查看因认证失败而被锁定的客户端IP地址。
display vty ip-block list
//查看因为认证失败而被阻止的IP地址列表。
display vty ip-block all
//查看所有认证失败的IP地址。
display vty mode
//查看VTY的工作模式。
相关推荐
Geeker554 小时前
如何在忘记密码的情况下解锁Android手机?
android·网络·macos·华为·智能手机·电脑·手机
君哥聊技术7 小时前
华为仓颉可以取代 Java 吗?
华为·仓颉
等风来随风飘7 小时前
华为机试HJ37统计每个月兔子的总数
华为
XuZhenhao060911 小时前
HarmonyOS - 通过.p7b文件获取fingerprint
华为·harmonyos
Geeker5513 小时前
如何在忘记密码的情况下删除华为ID激活锁
android·运维·服务器·网络·macos·华为·智能手机
tonyhi613 小时前
华为 eNSP 模拟器 配置RIP实例 动态路由协议
网络·华为·智能路由器·rip
等风来随风飘13 小时前
华为机试HJ21简单密码
python·华为
只要学不死,就往死里学!13 小时前
防火墙基础及登录(华为)
网络·网络安全·华为
谢宁华为战略管理研发管理17 小时前
《华为战略管理法:DSTE实战体系》累计印量已达4万册(截至2024年7月)
华为