华为交换机配置导⼊和导出
⽬录
⼀、场景介绍
⽹络设备提供服务是根据加载配置⽂件⽽提供的,所以对设备的配置⽂件备份和恢复很重要,在设备正常运⾏的情况下要对配置⽂件进⾏备份,同样在设备出现配置问题的时候 就需要恢复正常运⾏的配置⽂件。
配置⽂件的导⼊和导出⽅式:
1、配置⽂件的备份和恢复可以在设备上启⽤ftp服务,将配置⽂件导出到本地pc,需要的时候可以将此备份⽂件通过ftp服务再导⼊到设备的flash⽬录中,以便重启设备后恢复正 常状态。
2、也可以通过其他的ftp服务器来备份和恢复设备的配置⽂件,通过ftp命令连接远程的ftp服务器来下载
或上传配置⽂件。
⼆、实践操作
1、开启⽹络设备的ftp服务
`#开启ftp服务``[``4F``-``NEWORKD``-``SOUTH01]ftp server enable``#创建ftp⽤户,指定ftp的⽬录为flash:``[``4F``-``NEWORKD``-``SOUTH01``-``aaa]local``-``user goser password cipher ``123456``[``4F``-``NEWORKD``-``SOUTH01``-``aaa]local``-``user 2、通过ftp 查看交换机设备中的⽂件
C:\Documents and Settings\goser>ftp 192.168.10.18
Connected to 192.168.10.18.
220 FTP service ready.
User (192.168.10.18:(none)): goser
331 Password required for goser.
Password:
230 User logged in.
ftp> dir
200 Port command okay.
150 Opening ASCII mode data connection for directory list.
-rwxrwxrwx 1 noone nogroup 23240540 Aug 24 2015 s5700s-li-v200r007c00spc5
<
-rwxrwxrwx 1 noone nogroup 231021 Aug 24 2015 s5700s-li-v200r007sph001.
pat
-rwxrwxrwx 1 noone nogroup 836 Apr 17 06:18 rr.dat
drwxrwxrwx 1 noone nogroup 0 Jan 29 2016 user
-
rwxrwxrwx 1 noone nogroup 986 Apr 17 06:
-rwxrwxrwx 1 noone nogroup 836 Apr 17 06:18 rr.bak
drwxrwxrwx 1 noone nogroup 0 May 31 11:44 localuser
drwxrwxrwx 1 noone nogroup 0 Jan 29 2016 dhcp
drwxrwxrwx 1 noone nogroup 0 May 10 06:17 logfile
-rwxrwxrwx 1 noone nogroup 1360236 Apr 17 06:18 help.web
-rwxrwxrwx 1 noone nogroup 36 Jan 29 2016 $_patchstate_reboot
-rwxrwxrwx 1 noone nogroup 3684 Jan 29 2016 $_patch_history
-rwxrwxrwx 1 noone nogroup 4 Aug 03
drwxrwxrwx 1 noone nogroup 0 May 31 00:00 resetinfo
-rwxrwxrwx 1 noone nogroup 3141 May 31 11:35 backup.cfg
-
rwxrwxrwx 1 noone nogroup 968 May 31 11:44 vrpcfg.zip
3、导出配置到PC本地
#将设备的配置⽂件vrpcfg.zip下载到本地指定的⽬录中,这⾥切换下载⽬录为e盘,可以将配置⽂件下载后重命名
ftp> lcd e:\
ftp> get vrpcfg.zip config.zip
4、导⼊本地备份配置⽂件到⽹络设备
#切换到备份的配置⽂件⽬录
ftp> lcd e:\
Local directory now E
#上传配置⽂件到设备中
ftp> put config.zip
设置恢复的配置⽂件为下次启动配置⽂件并重启设备,这⾥在重启设备的时候注意提⽰:将修改的配置写⼊下次启动的配置⽂件中,⼀定要输⼊N,不然下次重启导⼊的配置⽂
件不⽣效
<4F-NEWORKD-SOUTH01>startup saved-configuration config.zip
<4F-NEWORKD-SOUTH01>dis startup
MainBoard:
Configured startup system software: flash:/
Startup system software: flash:/
Next startup system software: flash:/
Startup saved-configuration file: flash:/vrpcfg.zip
Next startup saved-configuration file: flash:/config.zip
<4F-NEWORKD-SOUTH01> reboot //重启设备。
Info: The system is now comparing the configuration, please wait.
Warning: The configuration has been modified, and it will be saved to the next startup saved-configuration file cfcard:/config.cfg. Continue? [Y/N]:N //注意:这⾥要选择N
//输⼊N防⽌设备当前的配置保存到备份的配置⽂件中。
Now saving the current configuration to the slot 13.
Save the configuration successfully.
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重启设备。