当前位置:首页>微思动态 > >详情
全国热线电话 400-881-4699

在线留言

实验!!华为设备基础配置

发布作者:微思网络   发布时间:2022-05-24   浏览量:0


学习目标

  • 掌握设备系统参数的配置方法,包括设备名称、系统时间及系统时区

  • 掌握Console口空闲超时时长的配置方法

  • 掌握登录信息的配置方法

  • 掌握登录密码的配置方法

  • 掌握保存配置文件的方法

  • 掌握配置路由器接口IP地址的方法

  • 掌握测试两台直连路由器连通性的方法

  • 掌握重启设备的方法



拓扑图

图片
图1.1 设备基础配置拓扑图



场景

您是公司的网络管理员,现在公司购买了两台华为AR G3系列路由器。路由器在使用之前,需要先配置路由器的设备名称、系统时间及登录密码等管理信息。



操作步骤

步骤一    查看系统信息
       执行display version命令,查看路由器的软件版本与硬件信息。
<Huawei>display version 
Huawei Versatile Routing Platform Software
VRP (R) software, Version 5.160 (AR2200 V200R007C00SPC600)
Copyright (C) 2011-2016 HUAWEI TECH CO., LTD
Huawei AR2220E Router uptime is 0 week, 3 days, 21 hours, 43 minutes
BKP 0 version information: 
......output omit......
   命令回显信息中包含了VRP版本,设备型号和启动时间等信息。

步骤二    修改系统时间
       VRP系统会自动保存时间,但如果时间不正确,可以在用户视图下执行clock timezone命令和clock datetime命令修改系统时间。
<Huawei>clock timezone Local add 08:00:00
<Huawei>clock datetime 12:00:00 2016-03-11

   您可以修改Local字段为当前地区的时区名称。如果当前时区位于UTC+0时区的西部,需要把add字段修改为minus。

   执行display clock命令查看生效的新系统时间。

<Huawei>display clock
2016-03-11 12:00:10
Friday
Time Zone(Local) : UTC+08:00

步骤三    帮助功能和命令自动补全功能
       在系统中输入命令时,问号是通配符,Tab键是自动补全命令的快捷键。
<Huawei>display ?
  Cellular                 Cellular interface
  aaa                      AAA
  access-user              User access
  accounting-scheme        Accounting scheme
  acl                      <Group> acl command group
  actived-alarm            Actived alarm
  actual                   Current actual
  alarm                    Alarm
  als                      Als
  antenna                  Current antenna that outputting radio
  anti-attack              Specify anti-attack configurations
  ap                       <Group> ap command group
  ap-auth-mode             Display AP authentication mode

......output omit......

   在输入信息后输入“?”可查看以输入字母开头的命令。如输入“dis?”,设备将输出所有以dis开头的命令。

   在输入的信息后增加空格,再输入“?”,这时设备将尝试识别输入的信息所对应的命令,然后输出该命令的其他参数。例如输入“dis ?”,如果只有display命令是以dis开头的,那么设备将输出display命令的参数;如果以dis开头的命令还有其他的,设备将报错。

   另外可以使用键盘上Tab键补全命令,比如键入“dis”后,按键盘“Tab”键可以将命令补全为“display”。如有多个以“dis”开头的命令存在,则在多个命令之间循环切换。

  命令在不发生歧义的情况下可以使用简写,如“display”可以简写为“dis”或“disp”等,“interface”可以简写为“int”或“inter”等。


步骤四   进入系统视图

       使用system-view命令可以进入系统视图,这样才可以配置接口、协议等内容。

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.


步骤五   修改设备名称

       配置设备时,为了便于区分,往往给设备定义不同的名称。如下我们依照实验拓扑图,修改设备名称。

修改R1路由器的设备名称为R1。

[Huawei]sysname R1 
[R1]

修改R3路由器的设备名称为R3。

[Huawei]sysname R2 
[R2]


步骤六   配置登录信息

       配置登陆标语信息来进行提示或进行登陆警告。执行header shell information命令配置登录信息。

[R1]header shell information "Welcome to the Huawei certification lab."

退出路由器命令行界面,再重新登录命令行界面,查看登录信息是否已经修改。

[R1]quit
<R1>quit 
  Configuration console exit, please press any key to log on
Welcome to the Huawei certification lab.
<R1>



步骤七   配置Console口参数
       默认情况下,通过Console口登陆无密码,任何人都可以直接连接到设备,进行配置。

   为避免由此带来的风险,可以将Console接口登录方式配置为密码认证方式,密码为密文形式的“Huawei@123”。

   空闲时间指的是经过没有任何操作的一定时间后,会自动退出该配置界面,再次登陆会根据系统要求,提示输入密码进行验证。

   设置空闲超时时间为20分钟,默认为10分钟(eNSP模拟的路由器设备默认为5分钟 交换机为10分钟)

[R1]user-interface console 0
[R1-ui-console0]authentication-mode password
Please configure the login password (maximum length 16):Huawei@123
[R1-ui-console0] 
[R1-ui-console0] idle-timeout 20 0

执行display this命令查看配置结果。

[R1-ui-console0]display this 

user-interface con 0
 authentication-mode password
 set authentication password cipher %$%$bvjBRib;H@s;Dxf!@Cm4BO4bq3Y&zoRdM%wO,%$%$
 idle-timeout 20 0
user-interface vty 0 4
user-interface vty 16 20

退出系统,并使用新配置的密码登录系统。需要注意的是,在路由器第一次初始化启动时,也需要配置密码。

[R1-ui-console0]return
<R1>quit 

  Configuration console exit, please press any key to log on

Login authentication

Password:                   //你所输入的密码不会显示,输完按回车键
Welcome to Huawei certification lab
<R1>


步骤八    配置接口IP地址和描述信息

      配置R1上GigabitEthernet 0/0/0接口的IP地址。使用点分十进制格式(如255.255.255.0)或根据子网掩码前缀长度配置子网掩码。

[R1]interface GigabitEthernet 0/0/0 
[R1-GigabitEthernet0/0/0]ip address 10.1.12.1 255.255.255.0 
[R1-GigabitEthernet0/0/0]description This interface connects to R2-G0/0/0

在当前接口视图下,执行display this命令查看配置结果。

[R1-GigabitEthernet0/0/0]display this
interface GigabitEthernet0/0/0
 description This interface connects to R2-G0/0/0
 ip address 10.1.12.1 255.255.255.0 

执行display interface命令查看接口信息。

[R1]display interface GigabitEthernet0/0/0
GigabitEthernet0/0/0 current state : UP
Line protocol current state : UP
Last line protocol up time : 2020-03-13 17:05:26 UTC+08:00
Description:This interface connects to R2-G0/0/0
Route Port,The Maximum Transmit Unit is 1500
Internet Address is 10.1.12.1/24
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 00e0-fcd9-1de9
......output omit......

从命令回显信息中可以看到,接口的物理状态与协议状态均为Up,表示对应的物理层与数据链路层均可用。 

配置R3上GigabitEthernet 0/0/0接口的IP地址与描述信息。

[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 10.1.12.2 255.255.255.0 
[R2-GigabitEthernet0/0/0]description This interface connects to R1-G0/0/0

配置完成后,通过执行ping命令测试R1和R3间的连通性。

 [R1]ping 10.1.12.2
  PING 10.1.12.2: 56  data bytes, press CTRL_C to break
    Reply from 10.1.12.2: bytes=56 Sequence=1 ttl=255 time=30 ms
    Reply from 10.1.12.2: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 10.1.12.2: bytes=56 Sequence=3 ttl=255 time=10 ms
    Reply from 10.1.12.2: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 10.1.12.2: bytes=56 Sequence=5 ttl=255 time=20 ms

  --- 10.1.12.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 10/20/30 ms


步骤九   查看当前设备上存储的文件列表
       在用户视图下执行dir命令,查看当前目录下的文件列表。
<R1>dir
Directory of flash:/
  Idx  Attr Size(Byte) Date  Time(LMT) FileName 
    0  -rw-  1,738,816 Mar 10 2016 11:50:24      web.zip
1  -rw- 68,288,896 Mar 10 2016 14:17:5      ar2220E-v200r007c00spc600.cc
2  -rw-             739 Mar 10 2016 16:01:17     vrpcfg.zip
1,927,476 KB total (1,856,548 KB free)

<R2>dir
Directory of flash:/
  Idx  Attr Size(Byte) Date         Time(LMT) FileName 
    0  -rw- 1,738,816  Mar 10 2016 11:50:58 web.zip
1  -rw-   68,288,896 Mar 10 2016 14:19:0      ar2220E-v200r007c00spc600.cc
2  -rw-         739 Mar 10 2016 16:03:04     vrpcfg.zip
1,927,476 KB total (1,855,076 KB free)



步骤十   管理设备配置文件
       执行display saved-configuration命令查看保存的配置文件。

<R1>display saved-configuration 
 There is no correct configuration file in FLASH 

系统中没有已保存的配置文件。执行save命令保存当前配置文件。

<R1>save 
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait............
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated

重新执行display saved-configuration命令查看已保存的配置信息。

<R1>display saved-configuration  
[V200R007C00SPC600]
#
 sysname R1
 header shell information "Welcome to Huawei certification lab"
#
 board add 0/1 1SA 
 board add 0/2 1SA 
……output omit……    输出省略

执行display current-configuration命令查看当前配置信息。
<R1>display current-configuration 
[V200R007C00SPC600]
#
 sysname R1
 header shell information "Welcome to Huawei certification lab"
#
 board add 0/1 1SA 
 board add 0/2 1SA 
 board add 0/3 2FE
……output omit……    输出省略

一台路由器可以存储多个配置文件。执行display startup命令查看下次启动时使用的配置文

 <R2>display startup 
MainBoard: 
  Startup system software:                flash:/AR2220E-v200R007C00SPC600.cc
  Next startup system software:           flash:/AR2220E-V200R007C00SPC600.cc
  Backup system software for next startup: null
  Startup saved-configuration file:   null
  Next startup saved-configuration file:      flash:/vrpcfg.zip
  Startup license file:            null
  Next startup license file:       null
  Startup patch package:           null
  Next startup patch package:      null
  Startup voice-files:             null
  Next startup voice-files:        null

删除闪存中的配置文件。

<R1>reset saved-configuration 
This will delete the configuration in the flash memory.
The device configurations will be erased to reconfigure.
Are you sure? (y/n)[n]:y
 Clear the configuration in the device successfully.

<R2>reset saved-configuration 
This will delete the configuration in the flash memory.
The device configurations will be erased to reconfigure.
Are you sure? (y/n)[n]:y
 Clear the configuration in the device successfully.


步骤十一    重启设备

       执行reboot命令重启路由器。

<R1>reboot
Info: The system is now comparing the configuration, please wait.
Warning: All the configuration will be saved to the next startup configuration. Continue ? [y/n]:n
System will reboot! Continue ? [y/n]:y
Info: system is rebooting ,please wait...

<R2>reboot
Info: The system is now comparing the configuration, please wait.
Warning: All the configuration will be saved to the next startup configuration. Continue ? [y/n]:n
System will reboot! Continue ? [y/n]:y

系统提示是否保存当前置,可根据实验要求决定是否保存当前配置。如果无法确定是否保存,则不保存当前配置。


配置文件

查看当前配置的文件

[R1]display current-configuration 
#
 sysname R1
 header shell information "Welcome to the Huawei certification lab."
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent 
#
 clock timezone BJ add 08:00:00

……output omit……    输出省略

[R2]dispay current-configuration 
……output omit……    输出省略




返回顶部