FTP导入导出脚本配置举例

105 阅读2分钟

前言

本次内容涉及设备配置的导出与导入 涉及的技术包含FTP内容 教会你简简单单的导入或者导出配置脚本

工具准备

软件版本介绍
HCLv5.10.2华三模拟器
XFTP7vBuild 0155传输工具
  • HCL所需的 Oracle VM VirtualBox 按照所需版本安装即可

配置举例

实验要求

要求导出RTA路由器的配置文件 并且修改后再导入配置

网络拓扑

image.png

RTA配置

[RTA]local-user RTA
[RTA-luser-manage-RTA]password simple admin@1234
[RTA-luser-manage-RTA]service-type ftp
[RTA-luser-manage-RTA]authorization-attribute user-role network-admin
[RTA-luser-manage-RTA]qu
[RTA]line vty 0 4
[RTA-line-vty0-4]authentication-mode scheme
[RTA-line-vty0-4]user-role network-operator
[RTA-line-vty0-4]qu
[RTA]ftp server enable
[RTA]interface GigabitEthernet 0/0
[RTA-GigabitEthernet0/0]ip address 192.168.0.1 255.255.255.0
[RTA-GigabitEthernet0/0]qu

HOST

  1. 运行XFTP软件

  2. 新添会话以及属性

    image.png

  3. 传输配置文件

  • 使用XFTP

    image.png

  • 使用CMD

    image.png

    image.png

    C:\Users\admin 导出后文件路径

  1. 修改脚本配置 导入配置
<RTA>tftp 192.168.0.2 get startup_fix.cfg
Press CTRL+C to abort.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2612  100  2612    0     0   274k      0 --:--:-- --:--:-- --:--:--  850k
Writing file...Done.

<RTA> // 导入配置
<RTA>dir
Directory of flash: (VFAT)
   0 drw-           - Jun 13 2024 11:40:22   diagfile
   1 -rw-         735 Jun 13 2024 11:41:54   hostkey
   2 -rw-         252 Jun 13 2024 11:59:30   ifindex.dat
   3 -rw-       43136 Jun 13 2024 11:40:22   licbackup
   4 -rw-       43136 Jun 13 2024 11:40:22   licnormal
   5 drw-           - Jun 13 2024 15:09:56   logfile
   6 -rw-           0 Jun 13 2024 11:40:22   msr36-cmw710-boot-r0424p22.bin
   7 -rw-           0 Jun 13 2024 11:40:22   msr36-cmw710-system-r0424p22.bin
   8 drw-           - Jun 13 2024 11:40:22   seclog
   9 -rw-         591 Jun 13 2024 11:41:54   serverkey
  10 -rw-        2612 Jun 13 2024 15:06:16   startup.cfg
  11 -rw-       44700 Jun 13 2024 11:59:30   startup.mdb
  12 -rw-        2612 Jun 13 2024 15:16:49   startup_fix.cfg   // 导入成功

1046512 KB total (1046332 KB free)

<RTA>
  1. 修改下次启动脚本为修改版
<RTA>startup saved-configuration startup_fix.cfg 
Please wait...... Done.
// 修改下次启动脚本
  1. 效果检验
<RTA>reboot  // 重启设备
Start to check configuration with next startup configuration file, please wait.........DONE!
Current configuration may be lost after the reboot, save current configuration? [Y/N]:n
This command will reboot the device. Continue? [Y/N]:y
Now rebooting, please wait...
%Jun 13 15:09:57:887 2024 RTA DEV/5/SYSTEM_REBOOT: System is rebooting now.
Press ENTER to get started.
<router>%Jun 13 15:10:37:773 2024 router SHELL/5/SHELL_LOGIN: Console logged in from con0.
<router>
<router>
<router>
<router>