一、实验目的
l理解命令行视图的含义以及进入离开命令行视图的方法
l掌握一些常见的命令
l掌握使用命令行在线帮助的方法
l掌握如何撤销命令
l掌握如何使用命令行快捷键
二、实验拓扑
VRP的基本操作实验拓扑如图所示。
VRP的基本操作
三、实验步骤
(1):熟悉VRP的视图
<Huawei> //用户视图
<Huawei>system-view //从用户视图进入到系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei] //[ ] 代表系统视图
[Huawei]interface GigabitEthernet 0/0/0 //从系统视图进入到接口视图
[Huawei-GigabitEthernet0/0/0]ip add //我们只输入“ip add”,然后按Tab键,就可以补全“address”
[Huawei-GigabitEthernet0/0/0]ip address 10.1.1.1 24 //配置接口IP地址为10.1.1.1 ,掩码长度为24位。
[Huawei-GigabitEthernet0/0/0]quit //quit命令是VRP系统中的退出当前层级命令。
[Huawei]ospf // 进入到ospf协议视图
[Huawei-ospf-1] // ospf是我们后面要学习的一个非常重要的动态路由协议,此处仅作为一个示例。
【技术要点1】
Tab键的使用:如果与之匹配的关键字唯一,按下<Tab>键,系统自动补全关键字,补全后,反复按<Tab>关键字不变。示例如下:
[Huawei] info- //按下Tab键
[Huawei] info-center
【技术要点2】
退出命令我们可以用quit、return、和快捷键“Ctrl+z”。
Quit命令仅可以返回上一个视图
Return命令直接返回到用户视图
扫描二维码关注公众号,回复: 14651276 查看本文章
快捷键“Ctrl+z”和return一样
(2):给设备命名
[Huawei]sysname joinlabs //更改系统名为joinlabs
[joinlabs] //读者可以看到系统名由Huwei变成了joinlabs
(3):查看当前运行的配置文件
<joinlabs>display current-configuration //查看当前运行的配置文件
#
sysname joinlabs //系统名为joinlabs
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher OOCM4m($F4ajUn1vMEIBNUw#
local-user admin service-type http
#
firewall zone Local
priority 16
#
interface Ethernet0/0/0
#
interface Ethernet0/0/1
#
interface Serial0/0/0
link-protocol ppp
#
interface Serial0/0/1
link-protocol ppp
#
interface Serial0/0/2
link-protocol ppp
#
interface Serial0/0/3
link-protocol ppp
#
interface GigabitEthernet0/0/0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface GigabitEthernet0/0/3
#
wlan
#
interface NULL0
#
ospf 1 //ospf进程1
#
user-interface con 0
user-interface vty 0 4
user-interface vty 16 20
#
return
(4):保存当前的配置
<joinlabs>save //保存
The current configuration will be written to the device //当前这些配置将会保存到设备
Are you sure to continue?[Y/N]Y //你是否继续,选择Y
Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]: //如果不改名,默认为vrpcfg.zip
May 16 2022 15:40:18-08:00 joinlabs %%01CFM/4/SAVE(l)[0]:The user chose Y when deciding whether to save the configuration to the device.
Now saving the current configuration to the slot 17.
Save the configuration successfully.
<joinlabs>
(5):查看保存的配置文件
<joinlabs>display saved-configuration //查看保存的配置文件
#
sysname joinlabs
#
undo info-center enable
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher OOCM4m($F4ajUn1vMEIBNUw#
local-user admin service-type http
#
firewall zone Local
priority 16
#
interface Ethernet0/0/0
#
interface Ethernet0/0/1
#
interface Serial0/0/0
link-protocol ppp
#
interface Serial0/0/1
link-protocol ppp
#
interface Serial0/0/2
link-protocol ppp
#
interface Serial0/0/3
link-protocol ppp
#
interface GigabitEthernet0/0/0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface GigabitEthernet0/0/3
#
wlan
#
interface NULL0
#
ospf 1
#
user-interface con 0
user-interface vty 0 4
user-interface vty 16 20
#
return
(6):配置文件重置
<joinlabs>reset saved-configuration //清空保存的配置文件
Warning: The action will delete the saved configuration in the device.
The configuration will be erased to reconfigure. Continue? [Y/N]:Y //“配置将会被删除用于重新配置”选择Y
Warning: Now clearing the configuration in the device.
Info: Succeeded in clearing the configuration in the device.
<joinlabs>reboot //重启,只有重新启动配置才能清空。
Info: The system is now comparing the configuration, please wait.
Warning: All the configuration will be saved to the configuration file for the next startup:, Continue?[Y/N]: N //”所有的配置会被保存到下次启动文件中,是否继续”?一定要选择N,即不保存当前的配置
Info: If want to reboot with saving diagnostic information, input 'N' and then execute 'reboot save diagnostic-information'.
System will reboot! Continue?[Y/N]:Y //选择Y
(7):指定系统启动配置文件
<joinlabs>save joinlabs.cfg //保存配置文件,配置文件名为joinlabs.cfg
Are you sure to save the configuration to flash:/joinlabs.cfg?[Y/N]:y //选择Y或者是回车
<joinlabs>dir flash: //查看flash中的文件
Directory of flash:/
Idx Attr Size(Byte) Date Time FileName
0 drw- - Aug 07 2015 13:51:14 src
1 drw- - May 16 2022 15:05:00 pmdata
2 drw- - May 16 2022 15:05:03 dhcp
3 -rw- 603 May 16 2022 15:58:22 private-data.txt
4 drw- - May 16 2022 15:20:09 mplstpoam
5 -rw- 424 May 16 2022 16:02:18 vrpcfg.zip
6 -rw- 794 May 16 2022 16:04:21 joinlabs.cfg //可以看到文件保存成功
32,004 KB total (31,991 KB free)
<joinlabs>startup saved-configuration joinlabs.cfg //指定启动配置文件名
Info: Succeeded in setting the configuration for booting system.
<joinlabs>save //保存
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y //选择Y
Save the configuration successfully.
<joinlabs>display startup //使用命令查看设备重启后调用的配置文件
MainBoard:
Configured startup system software: NULL
Startup system software: NULL
Next startup system software: NULL
Startup saved-configuration file: flash:/joinlabs.cfg
Next startup saved-configuration file: flash:/joinlabs.cfg //可以看到设备下次启动时调用的配置文件
Startup paf file: NULL
Next startup paf file: NULL
Startup license file: NULL
Next startup license file: NULL
Startup patch package: NULL
Next startup patch package: NULL