Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1755208
  • 博文数量: 226
  • 博客积分: 8233
  • 博客等级: 中将
  • 技术积分: 3514
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-18 22:54
文章分类
文章存档

2019年(3)

2018年(7)

2017年(2)

2012年(8)

2011年(67)

2010年(45)

2009年(94)

分类: 网络与安全

2019-06-24 16:16:48

配置的导入和导出场景

网络设备提供服务是根据加载配置文件而提供的,所以对设备的配置文件备份和恢复很重要,在设备正常运行的情况下要对配置文件进行备份,同样在设备出现配置问题的时候就需要恢复正常运行的配置文件。

配置文件的导入和导出方式:

1、配置文件的备份和恢复可以在设备上启用ftp服务,将配置文件导出到本地pc,需要的时候可以将此备份文件通过ftp服务再导入到设备的flash目录中,以便重启设备后恢复正常状态。

2、也可以通过其他的ftp服务器来备份和恢复设备的配置文件,通过ftp命令连接远程的ftp服务器来下载或上传配置文件。

启用网络设备的ftp服务导入、导出配置文件

开启设备的ftp服务及创建ftp用户

1
2
3
4
5
6
7
8
9
#开启ftp服务
[4F-NEWORKD-SOUTH01]ftp server enable
#创建ftp用户goser,指定ftp的目录为flash:
[4F-NEWORKD-SOUTH01]aaa
[4F-NEWORKD-SOUTH01-aaa]local-user goser password cipher 123456
[4F-NEWORKD-SOUTH01-aaa]local-user goser service-type ftp
[4F-NEWORKD-SOUTH01-aaa]local-user goser privilege level 3
[4F-NEWORKD-SOUTH01-aaa]local-user goser ftp-directory flash:
#保存配置
<4f-neworkd-south01>save

通过pc端连接ftp

  从终端PC通过FTP连接设备,输入用户名goser和密码123456,并采用binary模式进行文件传输。 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
C:\Documents and Settings\goser2703>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
00.cc
-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:18 private-data.txt
-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  2016 snmpnotilog.txt
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

导出配置到pc本地

1
2
#将设备的配置文件vrpcfg.zip下载到本地指定的目录中,这里切换下载目录为e盘,可以将配置文件下载后重命名
ftp> lcd  e:\
ftp> get  vrpcfg.zip  config.zip

导入以前备份好的配置文件到设备中

  设备作为FTP服务器,本地PC作为FTP客户端,将备份的配置文件上传到设备中。从终端PC通过FTP连接设备,输入用户名goser和密码123456,并采用binary模式进行文件传输。

1
2
3
4
#切换到备份的配置文件目录
ftp> lcd e:\
Local directory now E
#上传配置文件到设备中
ftp> put  config.zip

设置恢复的配置文件为下次启动配置文件并重启设备,这里在重启设备的时候注意提示:将修改的配置写入下次启动的配置文件中,一定要输入N,不然下次重启导入的配置文件不生效

1
2
3
4
5
6
7
8
9
10
11
12
<4f-neworkd-south01>startup saved-configuration config.zip
<4f-neworkd-south01>dis  startup
MainBoard:
  Configured startup system software:        flash:/s5700s-li-v200r007c00spc500.cc
  Startup system software:                   flash:/s5700s-li-v200r007c00spc500.cc
  Next startup system software:              flash:/s5700s-li-v200r007c00spc500.cc
  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防止设备当前的配置保存到备份的配置文件中。
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重启设备。

当然平时可以关闭设备的ftp服务,来提高设备性能,在需要开启ftp服务的时候再开启即可。

1
[4F-NEWORKD-SOUTH01]undo  ftp  server

通过远程ftp服务器来备份和上传配置文件

比如远程ftp服务器的ip地址为192.168.80.200    ftp用户名为:tom  密码为:123456

至于ftp服务器的部署,可以参考ftp部署:http://www.cnblogs.com/goser/articles/8509919.html

连接远程ftp服务器,将设备的配置文件上传到远程ftp服务器上

1
2
3
4
5
6
7
8
9
<4f-neworkd-south01>ftp   192.168.80.200
Trying 192.168.80.200 ...
Press CTRL+K to abort
Connected to 192.168.80.200.
220 (vsFTPd 2.2.2)
User(192.168.80.200:(none)):tom
331 Please specify the password.
Enter password:
230 Login successful.
 
#上传配置文件到ftp服务器
[ftp]put  vrpcfg.zip

从ftp服务器上下载配置文件到设备中

1
2
#从ftp服务器上下载配置文件,并重命名
[ftp]get vrpcfg.zip goser.zip
阅读(2545) | 评论(0) | 转发(0) |
0

上一篇:XP系统电脑无法远程桌面连接Win10系统电脑

下一篇:没有了

给主人留下些什么吧!~~