cisco配置文件备份

 Cisco使用的操作系统称为IOS——Internetworking Operating System,存储在Cisco设备的Flash存储器上,除了IOS外,还有一个重要的文件:设备配置文件。为了方便管理,我们可以把IOS系统及设备配置文件备份在本地计算机上,当出故障时,我们可以把IOS系统或配置文件恢复到Cisco设备上,本文的操作以Cisco 3550为例。
⑴pwd命令,显示当前路径。

SW3550#pwd
flash:

SW3550#pwd
flash:/c3550-ipservices-mz.122-25.SEE/

  ⑵cd命令,切换目录命令

SW3550#cd c3550-ipservices-mz.122-25.SEE

  ⑶dir,显示当前路径下的文件

SW3550#dir
Directory of flash:/

2 -rwx 616 Mar 1 1993 01:25:31 +00:00 vlan.dat
4 drwx 128 Mar 1 1993 01:17:39 +00:00 c3550-ipservices-mz.122-25.SEE
3 -rwx 3977 Mar 1 1993 02:20:42 +00:00 config.old
371 -rwx 2356 Mar 1 1993 03:08:11 +00:00 config.text

15998976 bytes total (8002560 bytes free)
SW3550#

show flash命令也可以显示flash闪存中存储的文件:
SW3550#show flash

Directory of flash:/

2 -rwx 616 Mar 1 1993 01:25:31 +00:00 vlan.dat
4 drwx 128 Mar 1 1993 01:17:39 +00:00 c3550-ipservices-mz.122-25.SEE
3 -rwx 3977 Mar 1 1993 02:20:42 +00:00 config.old
371 -rwx 2356 Mar 1 1993 03:08:11 +00:00 config.text

15998976 bytes total (8002560 bytes free)
SW3550#

dir all用来显示当前路径下所有的文件

SW3550#dir all
Directory of flash:/

2 -rwx 616 Mar 1 1993 01:25:31 +00:00 vlan.dat
4 drwx 128 Mar 1 1993 01:17:39 +00:00 c3550-ipservices-mz.122-25
.SEE
3 -rwx 3977 Mar 1 1993 02:20:42 +00:00 config.old
371 -rwx 2356 Mar 1 1993 03:08:11 +00:00 config.text

15998976 bytes total (8002560 bytes free)
Directory of zflash:/

2 -rwx 616 Mar 1 1993 01:25:31 +00:00 vlan.dat
4 drwx 128 Mar 1 1993 01:17:39 +00:00 c3550-ipservices-mz.122-25
.SEE
3 -rwx 3977 Mar 1 1993 02:20:42 +00:00 config.old
371 -rwx 2356 Mar 1 1993 03:08:11 +00:00 config.text

15998976 bytes total (8002560 bytes free)
Directory of system:/

3 dr-x 0 <no date> memory
1 -rw- 2376 <no date> running-config
2 dr-x 0 <no date> vfiles

No space information available
Directory of nvram:/

380 -rw- 2356 <no date> startup-config
381 ---- 0 <no date> private-config

393216 bytes total (390808 bytes free)

  Cisco 3550的IOS文件扩展名是.bin,全名是:c3550-ipservices-mz.122-25.SEE.bin,存储在flash下的c3550-ipservices-mz.122-25.SEE目录下。

SW3550#cd c3550-ipservices-mz.122-25.SEE
SW3550#dir
Directory of flash:/c3550-ipservices-mz.122-25.SEE/

5 -rwx 6410981 Mar 1 1993 01:17:39 +00:00 c3550-ipservices-mz.122-25
.SEE.bin
6 drwx 4160 Mar 1 1993 01:17:59 +00:00 html

15998976 bytes total (8002560 bytes free)

  ⑷copy命令备份IOS及配置文件

  首先使用Cisco TFTP server架设一台TFTP服务器:

图一 Cisco TFTP Server

  使用copty flash tftp命令把flash存储器内的IOS文件备份到TFTP Server上。

SW3550#copy flash tftp
Source filename [/c3550-ipservices-mz.122-25.SEE/c3550-ipservices-mz.122-25]? c3
550-ipservices-mz.122-25.SEE.bin //输入IOS的路径及文件
Address or name of remote host []? 192.168.1.107  //输入TFTP Server的IP地址
Destination filename [c3550-ipservices-mz.122-25.SEE.bin]? //输入备份的目的址,也可以使用默认的名称。
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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server上。
SW3550#copy startup-config tftp
Address or name of remote host []? 192.168.1.107
Destination filename [sw3550-confg]? sw3550startupBack
!!
2356 bytes copied in 0.044 secs (53545 bytes/sec)
SW3550#

  使用copty tftp startup-config把TFTP上存储的配置文件备文件恢复到交换机上:
SW3550#copy tftp startup-config
Address or name of remote host []? 192.168.1.107
Source filename []? sw3550startupBack
Destination filename [startup-config]?
Accessing tftp://192.168.1.107/sw3550startupBack...
Loading sw3550startupBack from 192.168.1.107 (via Vlan1): !
[OK - 2356 bytes]
[OK]
2356 bytes copied in 9.196 secs (256 bytes/sec)

  ⑸erase命令删除配置文件,慎用该命令!

SW3550#erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [con
firm]y[OK]
Erase of nvram: complete
SW3550#
02:01:36: %SYS-7-NV_BLOCK_INIT: Initalized the geometry of nvram

  删除了startup-config文件后,查看NVRAM(非易失内存),可以看到startup-config文件大小为0byte。
Directory of nvram:/

382 -rw- 0 <no date> startup-config
383 ---- 0 <no date> private-config

393216 bytes total (393164 bytes free)

  恢复完配置文件后,再查看NVRAM:

Directory of nvram:/

380 -rw- 2356 <no date> startup-config
381 ---- 0 <no date> private-config

393216 bytes total (390808 bytes free)

  本文只是简单地介绍了dir、cd、copy、erase等命令的使用,可以完成一些重要的管理工具。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值