首页 > 其他分享 >关于VRP配置文件的操作

关于VRP配置文件的操作

时间:2023-05-30 18:44:54浏览次数:44  
标签:rw 配置文件 zip May 09 vrpcfg VRP 30 操作

关于VRP配置文件的操作

目录

前言:

关于华为网络设备操作系统VRP配置文件的操作是NA级别的内容,已经学过很久了,但到了真实环境使用时多多少少有一些不自然,原因无非是思考的深度不足且练习的次数也不足,虽然现在已经学到IE了,但发觉发现这些基础的操作在日常工作当中使用的次数还是挺频繁的, 单独用一小节来复习巩固一下;

场景一

客户只有一台设备,客户已经做了一些配置;我不想动客户当前的环境,但是又想要一个新的环境,这怎么搞?

思路:

  1. 将内存的当中内容全都刷到配置文件当中,比如名字是vrpcfg.zip
  2. 将此配置文件在VRP系统当中复制一份名为vrpcfg.zip.back,并且保存到自己本地电脑一份
  3. 将vrpcfg.zip文件删除掉或重置
  4. 重启设备这样就获得了一个干净的环境,并且会新生成一个vrpcfg.zip文件
  5. 自己做完测试之后,将vrpcfg.zip.back配置覆盖vrpcfg.zip文件
# 这是一个新的设备刚开始
<Huawei>dis version
Huawei Versatile Routing Platform Software
VRP (R) software, Version 5.130 (AR2200 V200R003C00)
<Huawei>dis startup
MainBoard: 
  Startup system software:                   null
  Next startup system software:              null
  Backup system software for next startup:   null
  Startup saved-configuration file:          flash:/vrpcfg.zip
  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
<Huawei>dir
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 
    0  drw-              -  May 30 2023 09:46:55   dhcp
    1  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip
    2  -rw-          2,263  May 30 2023 09:46:51   statemach.efs
    3  -rw-        828,482  May 26 2014 09:20:58   sslvpn.zip

1,090,732 KB total (784,464 KB free)
# 简单做一些配置,将配置刷到硬盘当中,会生成一个vrpcfg.zip的文件
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn AR1
[AR1]int vlan 1
[AR1-Vlanif1]ip add 192.168.0.1 24
[AR1-Vlanif1]
<AR1>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
<AR1>dir
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 
    0  drw-              -  May 30 2023 09:46:55   dhcp
    1  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip
    2  -rw-          2,263  May 30 2023 09:46:51   statemach.efs
    3  -rw-        828,482  May 26 2014 09:20:58   sslvpn.zip
    4  -rw-            265  May 30 2023 09:55:25   private-data.txt
    5  -rw-            567  May 30 2023 09:55:24   **vrpcfg.zip**

1,090,732 KB total (784,448 KB free)
# 拷贝配置文件
<AR1>copy vrpcfg.zip vrpcfg.zip.back
<AR1>reset saved-configuration  # reset相当于直接清空了vrpcfg.zip当中的内容
<AR1>dir  # 会发现大小变成了120
Directory of flash:/
  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 
    0  drw-              -  May 30 2023 09:46:55   dhcp
    1  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip
    2  -rw-          2,263  May 30 2023 09:57:30   statemach.efs
    3  -rw-        828,482  May 26 2014 09:20:58   sslvpn.zip
    4  -rw-            265  May 30 2023 09:55:25   private-data.txt
    5  -rw-            567  May 30 2023 09:56:48   vrpcfg.zip.back
    6  -rw-            120  May 30 2023 09:57:30   vrpcfg.zip

1,090,732 KB total (784,448 KB free)

# 当前的配置还在内存当中
<AR1>dis ip int bri
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              unassigned           down       down      
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Vlanif1                           192.168.0.1/24       down       down

# 重启时,问你内存当中的配置是否要保存到启动文件当中,选不保存
<AR1>reboot
Info: The system is 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...

# 重启完成之后就是一个干净的系统了,如下所示:
<Huawei>dir
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 
    0  drw-              -  May 30 2023 09:46:55   dhcp
    1  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip
    2  -rw-          2,263  May 30 2023 10:00:27   statemach.efs
    3  -rw-        828,482  May 26 2014 09:20:58   sslvpn.zip
    4  -rw-            265  May 30 2023 09:55:25   private-data.txt
    5  -rw-            567  May 30 2023 09:56:48   vrpcfg.zip.back
    6  -rw-            120  May 30 2023 09:57:30   vrpcfg.zip

1,090,732 KB total (784,452 KB free)

做完测试之后,我已经把设备的配置搞的面目全非了,这时候帮客户把配置还原,怎么搞?

# 模拟我测试时的操作
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn WWWDKFJD
[WWWDKFJD]int vlan 1
[WWWDKFJD-Vlanif1]ip add 192.168.0.5 24
<WWWDKFJD>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

# 再看
<WWWDKFJD>dir
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 
    0  drw-              -  May 30 2023 09:46:55   dhcp
    1  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip
    2  -rw-          2,263  May 30 2023 10:03:08   statemach.efs
    3  -rw-        828,482  May 26 2014 09:20:58   sslvpn.zip
    4  -rw-            265  May 30 2023 09:55:25   private-data.txt
    5  -rw-            567  May 30 2023 09:56:48   vrpcfg.zip.back  # 客户的旧的配置
    6  -rw-            570  May 30 2023 10:03:08   vrpcfg.zip       # 我做测试时的配置

# 把客户的配置,直接覆盖到下一次启动的配置文件
<WWWDKFJD>copy vrpcfg.zip.back vrpcfg.zip
Copy flash:/vrpcfg.zip.back to flash:/vrpcfg.zip? (y/n)[n]:y
The file flash:/vrpcfg.zip exists. Overwrite it? (y/n)[n]:y
Deleting file permanently from flash will take a long time if needed...Done.

100%  complete
Info: Copied file flash:/vrpcfg.zip.back to flash:/vrpcfg.zip...Done
<WWWDKFJD>dir
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 
    0  drw-              -  May 30 2023 09:46:55   dhcp
    1  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip
    2  -rw-          2,263  May 30 2023 10:03:08   statemach.efs
    3  -rw-        828,482  May 26 2014 09:20:58   sslvpn.zip
    4  -rw-            265  May 30 2023 09:55:25   private-data.txt
    5  -rw-            567  May 30 2023 09:56:48   vrpcfg.zip.back
    6  -rw-            567  May 30 2023 10:04:30   vrpcfg.zip

# 不保存当前的配置,直接重启
<WWWDKFJD>reboot
Info: The system is 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...

# 客户的配置又重新回来了
<AR1>dis ip int bri
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              unassigned           down       down      
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Vlanif1                           192.168.0.1/24       down       down

场景二

一线一工程师,从客户那里收集了配置文件交给我,我要在公司测试设备上重新跑一下,看是否能复现客户现场的故障。假如从客户收集的客户的配置文件是bresee.zip,测试设备本身就已经有配置了,这个配置还有很多同事要使用,不能丢;

  • 步骤,特别简单:
    • 将当前的配置刷到硬盘当中,并备份当前的配置文件
    • 将客户给的配置文件上传到设备当中
    • 更改设备下一次开机使用的配置文件为客户的配置文件
    • 测试完之后,把下一次开机启动的指向再改回来
# 当前设备的初始配置
<AR1>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
<AR1>dir
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 
    0  drw-              -  May 30 2023 09:46:55   dhcp
    1  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip
    2  -rw-          2,263  May 30 2023 10:05:33   statemach.efs
    3  -rw-        828,482  May 26 2014 09:20:58   sslvpn.zip
    4  -rw-            265  May 30 2023 09:55:25   private-data.txt
    6  -rw-            567  May 30 2023 10:04:30   **vrpcfg.zip**

1,090,732 KB total (784,452 KB free)

# 默认下一次启动还是从vrpcfg.zip当前启动
<AR1>dis startup 
MainBoard: 
  Startup system software:                   null
  Next startup system software:              null
  Backup system software for next startup:   null
  **Startup saved-configuration file:          flash:/vrpcfg.zip**
  **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

# 把客户的配置文件bresee.zip上传到设备上
<AR1>dir
    5  -rw-            567  May 30 2023 09:56:48   **bresee.zip**
    6  -rw-            594  May 30 2023 10:14:58   vrpcfg.zip
# 
<AR1>startup saved-configuration flash:/bresee.zip
This operation will take several minutes, please wait...
Info: Succeeded in setting the file for booting system
<AR1>dis startup
MainBoard: 
  Startup system software:                   null
  Next startup system software:              null
  Backup system software for next startup:   null
  **Startup saved-configuration file:          flash:/vrpcfg.zip**
  **Next startup saved-configuration file:     flash:/bresee.zip**

# 重启,问当前的配置是否配置,不保存
# 我们当前的配置已经保存过了,一旦在这里保存就会破坏客户的配置文件
<AR1>reboot
Info: The system is 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...

# 再开机就是客户的配置了!
Press any key to get started
<bresee>

# 测试完特准再把指向还原回去
<bresee>startup saved-configuration flash:/vrpcfg.zip
This operation will take several minutes, please wait...
Info: Succeeded in setting the file for booting system
<bresee>reboot
Info: The system is 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...

# 完美,又还原到了AR1
Press any key to get started
<AR1>
<AR1>

标签:rw,配置文件,zip,May,09,vrpcfg,VRP,30,操作
From: https://www.cnblogs.com/yizhangheka/p/17444089.html

相关文章

  • Elasticsearch专题精讲—— 操作文档 ——读写文档
     操作文档——读写文档1、Introductionhttps://www.elastic.co/guide/en/elasticsearch/reference/8.8/docs-replication.htmlEachindexinElasticsearchisdividedintoshardsandeachshardcanhavemultiplecopies.Thesecopiesareknown......
  • MySQL之DQL数据查询操作
    一:SQL概述及规范SQL(StructuredQueryLanguage,结构化查询语言)是使用关系模型的数据库应用语言,与数据直接打交道,由IBM上世纪70年代开发出来。后由美国国家标准局(ANSI)开始着手制定SQL标准,先后有SQL-86,SQL-89,SQL-92,SQL-99等标准。SQL有两个重要的标准,分别是SQL92和SQL99,它们......
  • 5-24|处理git免密操作
    你要知道这里面一般都是没有用户这一说法的git仓库免密首先自己的公钥在cat/root/.ssh/id_rsa.pub然后想要用什么用户进行操作呢,就去对面的那个/root/.ssh/authorized_keys就放在这里如果没有git用户就这样搞......
  • 【git】git常用操作
    一、git简介git通用操作流程如下图:  基础知识:1、工作区:本地存放项目文件的地方。2、版本库:即.git目录,其中主要包含两个部分,缓存区和本地仓库。3、缓存区:缓存区(Index或者Stage),add命令将工作区的文件添加到缓存区。4、本地仓库:本地master分支,commit命令将缓存区的文件添加......
  • 创龙教仪TL6748-PlusTEB教学实验箱实验操作教程:2-2 LED灯控制实验
    2-2LED灯控制实验(点击查看完整视频)1、实验目的本次视频教程是基于创龙教仪TL6748-PlusTEB教学实验箱完成的。本节视频的目的是学习基于StarterWare开发环境配置GPIO管脚的方法和原理,并实现StarterWare开发环境下的LED灯控制。2、实验原理StarterWareStarterWare是一个免费的软件开......
  • 飞书机器人与飞书后台API的一些操作记录
    在飞书群组里面选择“设置”——“群机器人”——“添加机器人”——“自定义机器人”webhook地址,俗称网络勾子,可以通过该地址给这个群组通过一个叫“自定义机器人”(名字在创建机器人时可以修改)的发言。自定义关键词,发送的消息必须包含关键词才会被发送。IP白名单,可以设置ip......
  • git的一些操作方法
    gitcheckout(xxx)前往其他分支xxxgitmerge(dev)合并其他分支把dev的代码拉下来gitbranch-a查看全部分支gitbranch-r查看所有远程分支gitcheckout-b分支的快速创建与切换gitbranch--set-upstream-to=origin/本地分支关联线上分支gitbranch-vv查看......
  • nacos服务下线操作时报错:The Raft Group [naming_instance_metadata] did not find th
    【问题描述】caused:errCode:500,errMsg:dometadataoperationfailed;caused:com.alibaba.nacos.consistency.exception.ConsistencyException:TheRaftGroup[naming_instance_metadata]didnotfindtheLeadernode;caused:TheRaftGroup[naming_instance_metad......
  • springboot使用jdbc连接mysql(不用配置文件)
     1、连接mysql的工具类:packagecom.jzproject.common.mysql;importcom.alibaba.fastjson.JSON;importcom.alibaba.fastjson.JSONArray;importorg.springframework.jdbc.core.JdbcTemplate;importjava.sql.*;importjava.util.ArrayList;importjava.util.HashMap;......
  • 单表的CRUD操作升级
    1.  使用模板方法设计模式优化oa项目  34- 上面的注解解决了配置文件的问题。但是现在的oa项目仍然存在一个比较臃肿的问题。  - 一个单标的CRUD,就写了6个Servlet。如果一个复杂的业务系统,这种开发方式,显然会导致类爆炸。(类的数量太大。)1.1 怎么解决这个类爆炸问题?34可以......