华为设备配置备份,配置文件导入导出,设备配置恢复,设备镜像上传


前言

此文中华为设备使用ENSP模拟器模拟,与现网设备有可能存在出入,不同产品型号所涉及命令需要根据华为官网产品文档对应,请注意查询设备产品文档,其他厂家设备原理相同,操作方式有差异


一、网络拓扑

在这里插入图片描述

二、配置需求

将AR1设备配置文件备份到本地,备份完成后清除AR1设备所有配置,重新配置IP地址与本地电脑连通,并导入配置文件,进行恢复配置。

三、备份配置操作流程

1.云桥接—模拟器与设备桥接

1)Cloud配置

双击Cloud1,进行新增UDP端口
新增UDP端口

2)选择电脑中存在的虚拟网卡,并新增虚拟网卡端口

新增虚拟网卡端口
PASS:如果你是真机环境,此时需要用一根网线一端接入设备接口,一端接入PC网卡接口。

3)选择端口,并增加接口

新增接口
PASS:需要增加完成端口后才能进行线路连接

4)端口增加完成后最终效果

最终效果

5)最后进行线路连接

选择接口
cloud与AR1互联

2.配置AR1接口IP地址,并测试本地PC与网络设备连通性

1)AR1

代码如下(示例):

<Huawei>system-view
[Huawei]sysname R1
[R1]interface   g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.246.2 24

PASS:如何确定电脑与网络设备连接IP地址,也可以自行进入电脑控制面板设置IP地址。
确定PC与模拟器设备互联IP

[R1]ping  192.168.246.1

  PING 192.168.246.1: 56  data bytes, press CTRL_C to break

    Reply from 192.168.246.1: bytes=56 Sequence=1 ttl=128 time=10 ms

    Reply from 192.168.246.1: bytes=56 Sequence=2 ttl=128 time=10 ms

    Reply from 192.168.246.1: bytes=56 Sequence=3 ttl=128 time=10 ms

    Reply from 192.168.246.1: bytes=56 Sequence=4 ttl=128 time=10 ms

    Reply from 192.168.246.1: bytes=56 Sequence=5 ttl=128 time=10 ms

2)R1配置一些自定义配置,方便验证是否配置恢复成功

interface LoopBack0

 ip address 1.1.1.1 255.255.255.255

<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

3)通过DIR命令查看保存的配置文件

R1

<R1>dir

Directory of flash:/



  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName

    0  drw-              -  Mar 21 2022 06:14:05   dhcp

    1  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip

    2  -rw-          2,263  Mar 21 2022 06:14:00   statemach.efs

    3  -rw-        828,482  May 26 2014 09:20:58   sslvpn.zip

    4  -rw-            267  Mar 21 2022 06:30:06   private-data.txt

    5  -rw-            580  Mar 21 2022 06:30:06   vrpcfg.zip   //华为设备配置文件

4)R1配置为FTP服务器,并设置用户名和密码

R1

<R1>system-view

[R1]ftp  server enable

[R1-aaa]local-user   funnet password  cipher  funnet123   //创建用户名和密码

[R1-aaa]local-user   funnet service-type   ftp     //用户服务类型

[R1-aaa]local-user   funnet  privilege  level  15    //配置为管理员用户

[R1-aaa]local-user   funnet  ftp-directory  flash:/        //开放用户访问flash目录的权限

<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

5)PC作为客户端下载配置文件到本地

PC打开CMD,并在桌面创建一个文件夹,并在CMD进入该目录

A、进入文件夹,并复制文件夹目录

复制文件夹目录
输入CD 并粘贴刚才复制的路径
进入目录

B、CMD使用FTP服务连接路由器

连接AR1,FTP服务器
如果登入失败,重新打开CMD再重复上述步骤重新连接,当然要是会退出可以退出重新连接即可。

C、使用dir查看文件列表

查看文件

D、下载配置文件

下载配置文件

E、查看文件夹

文件夹下的配置文件

F、导出配置完成

四、配置恢复操作

1、删除AR1上已经配置的loopback0接口

AR1

<R1>system-view

[R1]undo   interface  LoopBack 0

[R1]display  ip int brief 

*down: administratively down

^down: standby

(l): loopback

(s): spoofing

The number of interface that is UP in Physical is 2

The number of interface that is DOWN in Physical is 2

The number of interface that is UP in Protocol is 2

The number of interface that is DOWN in Protocol is 2



Interface                         IP Address/Mask      Physical   Protocol 

GigabitEthernet0/0/0              192.168.246.2/24     up         up       

GigabitEthernet0/0/1              unassigned           down       down     

GigabitEthernet0/0/2              unassigned           down       down      

NULL0                             unassigned           up         up(s)​​​​​​​

保存配置

<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

2、配置文件重命名

重命名配置文件

3、将PC设置为FTP服务器,并设置FTP可访问文件夹

1)此时使用3CDeamon软件搭建,大家可以自行选择,比如H3C标杆的神器也可以,类似的软件很多。

3CD

2)打开FTP server

打开FTP服务

3)点击Config FTP Server

配置FTP服务

4)配置登入密码,用户名保持默认为admin

设置密码
注意此时需要输入两次密码,密码必须大于6位数,此处使用admin123作为密码,大家可以自行选择喜欢的密码;

5)设置FTP能访问的文件夹

设置FTP目录
选择我们保存配置文件的目录
配置目录
点击应用并保存
应用
结束后还会弹出,点击确定和确定即可。

6)R1通过FTP客户端模式连接到PC搭建的FTP服务

<R1>ftp 192.168.246.1

Trying 192.168.246.1 ...



Press CTRL+K to abort

Connected to 192.168.246.1.

220 3Com 3CDaemon FTP Server Version 2.0

User(192.168.246.1:(none)):admin

331 User name ok, need password

Enter password:             //密码输入不显示

230 User logged in



[R1-ftp]

7)查看文件,并获取备份的配置

[R1-ftp]dir

200 PORT command successful.

150 File status OK ; about to open data connection

drwxrwxrwx 1 owner group         0 Mar 21 16:19 .

drwxrwxrwx 1 owner group         0 Mar 21 16:19 ..

-rwxrwxrwx 1 owner group       666 Mar 21 16:25 vrpcfg-backup.zip    //文件夹下的文件

226 Closing data connection

FTP: 170 byte(s) received in 0.140 second(s) 1.21Kbyte(s)/sec.



[R1-ftp]get vrpcfg-backup.zip

200 PORT command successful.

150 File status OK ; about to open data connection

226 Closing data connection; File transfer successful.

FTP: 666 byte(s) received in 0.160 second(s) 4.16Kbyte(s)/sec.

[R1-ftp]quit



<R1>dir

Directory of flash:/



  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName

    0  drw-              -  Mar 21 2022 06:14:05   dhcp

    1  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip

    2  -rw-            666  Mar 21 2022 08:56:07   vrpcfg-backup.zip   //获取的配置文件

    3  -rw-          2,263  Mar 21 2022 06:14:00   statemach.efs

    4  -rw-        828,482  May 26 2014 09:20:58   sslvpn.zip

    5  -rw-            267  Mar 21 2022 06:30:06   private-data.txt

    6  -rw-            647  Mar 21 2022 08:42:33   vrpcfg.zip



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

4、选择开机加载的配置文件为新上传的配置文件

<R1>startup   saved-configuration vrpcfg-backup.zip

This operation will take several minutes, please wait....

Info: Succeeded in setting the file for booting system

<R1>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    //此时一定要选择n

  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

System will reboot! Continue ? [y/n]:y

Info: system is rebooting ,please wait...

此时可以点击模拟器设备关机后再开机即可进入设备查看配置信息

<R1>display    ip int brief 

*down: administratively down

^down: standby

(l): loopback

(s): spoofing

The number of interface that is UP in Physical is 3

The number of interface that is DOWN in Physical is 2

The number of interface that is UP in Protocol is 3

The number of interface that is DOWN in Protocol is 2



Interface                         IP Address/Mask      Physical   Protocol 

GigabitEthernet0/0/0              192.168.246.2/24     up         up       

GigabitEthernet0/0/1              unassigned           down       down     

GigabitEthernet0/0/2              unassigned           down       down     

LoopBack0                         1.1.1.1/32           up         up(s)    

NULL0                             unassigned           up         up(s)

被删除的loopback0接口又恢复了

配置恢复方法适用于设备镜像升级,传文件使用镜像文件,并更改设备启动镜像即可完成设备升级,此教程可以去B站看超有趣学网络账号传的小视频,设备升级演示。

总结

如果发现操作步骤有问题的朋友可以私信我

  • 4
    点赞
  • 50
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值