网络设备基本配置_必做项目
1.改设备名
<Huawei>sys
[Huawei]sysname office202 #改名,指定区域
[office202]
2.时钟(按需)
#按需求改或者时间不对的时候改
[office202]display clock #查看当前时间
<office202>clock timezone BJ add 8:00 #改时区
<office202>clock datetime 13:09:40 2025-05-20 #改时间
3.网络接口配地址
[office202]interface GigabitEthernet 0/0/0
[office202-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[office202-GigabitEthernet0/0/0]display this #查看是否配成功
#关于接口的其他一些命令
[office202-GigabitEthernet0/0/0]undo ip address 192.168.1.1 24 #删除接口IP
[office202-GigabitEthernet0/0/0]shutdown #关闭接口
[office202-GigabitEthernet0/0/0]undo shutdown #启用
[office202-GigabitEthernet0/0/0]ip address 192.168.10.2 24 sub #同一个网卡添加另外一个地址,但不能有相同的网段
[office202-GigabitEthernet0/0/0]undo ip address 192.168.10.2 24 sub #删除副地址
[office202-GigabitEthernet0/0/0]display ip interface brief #查看接口配置
4.保存配置文件
<office202>save #保存配置
<office202>save backup.zip #保存配置,指定文件名
#自动保存
<Huawei>autosave interval on #开启自动保存
<Huawei>autosave interval off #关闭自动保存
<Huawei>autosave interval 10 #10分钟后自动保存
#定时保存(不能与自动保存同时开启)
<Huawei>autosave time on #定时保存
<Huawei>autosave time 12:00:00 #指定时间
#其他的一些命令
<office202>reset saved-configuration #清空配置文件,需要重启才能生效,清空的是vrpcfg.zip文件
<Huawei>startup saved-configuration backup.zip #下一次启动指定,引用的配置文件
<Huawei>display startup #显示下一次启动所引用的配置文件
5.配置console口
5.1实战配置console口password和aaa身份验证
创建实验环境

5.1.1.启动设备,配置console口
display version #查看VRP的版本(即通用路由平台),Huawei Versatile Routing Platform Software 华为所有基于IP/ATM构架的数据通信产品操作系统平台
system-view #进入系统视图
sysname AR1 #更改设备名称 全局参数 #进入系统视图[]才能改名
[R1]user-interface console ? #查看目前有多少个接口的console口,找到需要配置的
[R1]user-interface console 0 #切换到所需的接口
5.1.2.两种认证模式
目前console口的认证模式有两种,一种是密码认证,一种是账号密码认证
#有两种用户模式
[R1-ui-console0]authentication-mode ?
aaa AAA authentication #实名认证模式aaa
password Authentication through the password of a user terminal interface #纯密码认证
查看console口的状态
#查看console口的状态
[R1]display current-configuration
#差不多翻到最下面
user-interface con 0
authentication-mode password
set authentication password cipher %$%$'b(D:"^>ET+Y-&/,f}xA,$HCT*BO8ao!7)2dEuKQ
=h};$HF,%$%$
使用密码认证模式
[R1-ui-console0]authentication-mode password #使用密码认证模式
[R1-ui-console0]set authentication password cipher huawei.com #更改密码,仅限于密码认证模式时使用
使用账号密码认证模式
[R1-ui-console0]authentication-mode aaa #使用实名认证模式aaa
[R1-ui-console0]aaa
[R1-aaa]local-user han password cipher huawei.com #这个命令管理员改其他用户的密码,需要在aaa模式下,这个命令既可以创建用户,也可以用来修改密码
初次登录最好给admin也改一个密码
[R1-aaa]local-user admin password cipher huawei.com #使用实名认证模式aaa
5.1.3.用户权限配置(第一时间创建一个管理员用户)
#新创建的用户默认的权限级别时3
#密码认证登录的所有用户,通常级别就是3
[R1-ui-console0]user privilege level ?
[R1-ui-console0]user privilege level 3 #给当前用户添加一个3的权限
[R1-aaa]local-user han privilege level 0 #管理员设置一个0的级别给用户
#aaa认证模式下,更改admin用户的密码和权限
[R1-aaa]local-user admin password cipher huawei.com
[R1-aaa]local-user admin service-type terminal #使用telnet登录设备
[R1-aaa]local-user admin privilege level 3
#查看用户级别
[R1-aaa]local-user han ?
access-limit Set access limit of user(s)
ftp-directory Set user(s) FTP directory permitted
idle-timeout Set the timeout period for terminal user(s)
password Set password
privilege Set admin user(s) level
service-type Service types for authorized user(s)
state Activate/Block the user(s)
user-group User group
#查看用户可以配置的服务
[R1-aaa]local-user han service-type ?
8021x 802.1x user
bind Bind authentication user
ftp FTP user
http Http user
ppp PPP user
ssh SSH user
sslvpn Sslvpn user
telnet Telnet user
terminal Terminal user
web Web authentication user
x25-pad X25-pad user
5.1.4.实例测试权限0的用户能使用的命令
创建用户
<R1>system-view
[R1]user-interface console 0
[R1-ui-console0]authentication-mode aaa
[R1-aaa]local-user han password cipher huawei.com
[R1-aaa]local-user admin privilege level 0
登录用户han用户
#退出再登录han用户,0级别的用户
<R1>?
User view commands:
display Display information
hwtacacs-user HWTACACS user
local-user Add/Delete/Set user(s)
ping Ping function
quit Exit from current mode and enter prior mode
save Save file
super Modify super password parameters
telnet Open a telnet connection
tracert <Group> tracert command group
登录admin用户
#退出登录admin用户,3级别的用户
<R1>?
User view commands:
arp-ping ARP-ping
autosave <Group> autosave command group
backup Backup information
cd Change current directory
clear <Group> clear command group
clock Specify the system clock
cls Clear screen
compare Compare configuration file
copy Copy from one file to another
debugging <Group> debugging command group
delete Delete a file
dialer Dialer
dir List files on a filesystem
display Display information
factory-configuration Factory configuration
fixdisk Try to restory disk
format Format file system
free Release a user terminal interface
ftp Establish an FTP connection
help Description of the interactive help system
hwtacacs-user HWTACACS user
license <Group> license command group
lldp Link Layer Discovery Protocol
---- More ----
6.使用telnet登录设备
6.1.配置AR1

<R1>system-view
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[R1-GigabitEthernet0/0/0]display this
6.2.改实体机IP
本地实体机,VMNET1改IP 192.168.1.100


禁用再启用,确保IP地址如下

6.3.添加cloud,实现与实体机通讯
ENSP添加CLOUD,配置如下


连接上

物理机PING一下,看是否能PING通

也可以通过停止接口shutdown来测试
[R1-GigabitEthernet0/0/0]shutdown

打开后就能恢复
[R1-GigabitEthernet0/0/0]undo shutdown

6.4.配置VTY(远程登录)


[R1]user-interface maximum-vty 15 #telnet最大15个人
[R1]user-interface vty 0 14 #配置这个15人的权限
[R1-ui-vty0-14]user privilege level 2 #默认过来的级别是2
[R1-ui-vty0-14]authentication-mode aaa #实名认证模式AAA
[R1-aaa]local-user admin service-type telnet #添加telnet
测试
C:\Users\Administrator>telnet 192.168.1.1

PS.用户有级别的话,默认以用户级别为准。如果用户没有配置级别,则是以telnet配置的级别为准
测试
#不指定权限
[R1-aaa]local-user zhao password cipher huawei.com
[R1-aaa]local-user zhao service-type terminal
[R1-aaa]local-user zhao service-type telnet
给telnet配置的level 2权限也不少

查看目前有多少用户在使用telnet
[R1]dispaly user-interface
A表示账号密码认证,P表示密码认证

6.5.华为的VRP既支持telnet服务端也支持服务端

进入AR2路由器
[Huawei]interface Serial 1/0/1
[Huawei-Serial1/0/1]ip address 10.0.0.2 24
[Huawei]user-interface vty 0 4
[Huawei-ui-vty0-4]auth
[Huawei-ui-vty0-4]authentication-mode password #密码认证模式
Please configure the login password (maximum length 16):123456
进入AR1路由器
[R1]interface Serial 1/0/0
[R1-Serial1/0/0]ip address 10.0.0.1 24
[R1-Serial1/0/0]quit
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode password #密码认证模式
Please configure the login password (maximum length 16):123456
在物理机上
C:\Users\Administrator>telnet 192.168.1.1

没权限

给权限之后就可以登录修改

7.实战:通过SSH配置路由器
7.1.为什么需要用SSH
直接采用telnet很容易被截获密码,SSH则不会


7.2.配置用户权限
#更改登录模式
[R1-aaa]local-user admin service-type ssh
[R1-aaa]quit
#用密码来认证
[R1]ssh user admin authentication-type password
#启用SSH服务
[R1]stelnet server enable
#改远程登录模式(改VTY)
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa
[R1-ui-vty0-4]protocol inbound ssh #更改了成为SSH模式,就不能用telnet
7.3.打开SSH软件(CRT,XSHELL),登录测试



8.补充
命令:display display current-configuration
[AR1-ui-console0]display current-configuration
[V200R003C00]
#
sysname AR1 #设备名
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00 #时间、时区
#
portal local-server load portalpage.zip
#
drop illegal-mac alarm
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin #默认用户
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ #密码
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface Ethernet0/0/0 #接口
#
interface Ethernet0/0/1
#
interface Ethernet0/0/2
#
interface Ethernet0/0/3
#
interface Ethernet0/0/4
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface GigabitEthernet0/0/0
ip address 192.168.1.1 255.255.255.0 #已配的IP地址
#
interface GigabitEthernet0/0/1
ip address 192.168.2.1 255.255.255.0
#
interface NULL0
#
ip route-static 192.168.3.0 255.255.255.0 192.168.2.2 #已配的路由表
ip route-static 192.168.4.0 255.255.255.0 192.168.2.2
#
user-interface con 0 #console口配置
authentication-mode aaa #认真模式aaa
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
华为路由的AAA是Authentication(认证)、Authorization(授权)和Accounting(计费)的简称,是一种提供认证、授权和计费的安全管理机制。
AAA作为一种网络安全管理机制,主要提供以下功能和服务:
认证:验证用户是否可以获得网络访问权,确定哪些用户可以访问网络。
授权:授权用户可以使用哪些服务,即对用户赋予不同的权限,限制用户可以使用的服务。
计费:记录用户使用网络资源的情况,包括使用的服务类型、起始时间、数据流量等,用于收集和记录用户对网络资源的使用情况,并可以实现针对时间、流量的计费需求。