设为首页 收藏本站
查看: 868|回复: 0

[经验分享] cisco配置文件备份

[复制链接]

尚未签到

发表于 2016-6-5 08:46:02 | 显示全部楼层 |阅读模式
 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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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6410981 bytes copied in 53.516 secs (119796 bytes/sec)

  使用copy startup-config tftp命令把配置文件备份到TFTP 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等命令的使用,可以完成一些重要的管理工具。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-226416-1-1.html 上篇帖子: Cisco小失误,大麻烦 下篇帖子: Cisco路由器配置教程
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表