2017年6月16日 星期五

使用FTP Server備份Router的IOS或設定

首先設定本機的IP,設完接著設定FTP程式,本LAB使用3C Daemon程式(此程式同時具有TFTP及FTP的功能),啟動程式後,先點選到FTP Server欄位,再點選到Configure FTP Server,設定FTP存取資料用的資料夾路徑,同時,設定帳號及密碼,帳密在稍後需要使用到
(此處的FTP帳密,在LAB中設為admin及123456)

登入Router進行設定:
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.

設定Router上的FTP程式使用的預設帳號密碼:

Router(config)#ip ftp username admin
Router(config)#ip ftp password 12345
Router(config)#end
Router#

將IOS備份到FTP伺服器(資料夾)

Router#copy flash:c1841-adventerprisek9-mz.150-1.M10.bin ftp:
Address or name of remote host []? 192.168.10.1                           輸入FTP伺服器的IP
Destination filename [c1841-adventerprisek9-mz.150-1.M10.bin]?
Writing c1841-adventerprisek9-mz.150-1.M10.bin !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
43126032 bytes copied in 52.940 secs (814621 bytes/sec)

備份結束後,前往FTP資料夾檢視,確認檔案是否存在

設定檔的備份指令如下:

Router#copy startup-config ftp:

待指令執行完畢,同樣前往FTP資料夾確認檔案存在與否

使用TFTP Server備份Router的IOS或設定

本LAB中使用的是3C-daemon這個程式,在啟動程式前,先設定好本機的IP,便可在啟動時,自動將該IP設為TFTP伺服器的IP。(此處LAB,本機IP設定為192.168.10.1/24)

接著,設定TFTP伺服器存取資料的資料夾:
先點擊左側的Configure TFTP Server圖示

設定存取資料的資料夾





設定完成後,就可以開始做備份還原的動作了



一.Router備份IOS:

1.先將Console線以及網路線都接到Router上,Port隨意
2.登入Router後,先檢視IOS的名稱,一會需要用到

Router>
Router>enable
Router#show version 
Cisco IOS Software, 1841 Software (C1841-ADVENTERPRISEK9-M), Version 15.0(1)M10, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Tue 26-Feb-13 12:28 by prod_rel_team

ROM: System Bootstrap, Version 12.4(13r)T, RELEASE SOFTWARE (fc1)

Router uptime is 22 minutes
System returned to ROM by power-on
System image file is "flash:c1841-adventerprisek9-mz.150-1.M10.bin"          <-------------------
Last reload type: Normal Reload

 --More-- 

3.設定Router的IP,在接上網路線的Port上設定IP:

Router#
Router#configure terminal 
Router(config)#
Router(config)#interface fastEthernet 0/0                 (接哪個Port就到哪邊設定)
Router(config-if)#
Router(config-if)#ip address 192.168.10.2 255.255.255.0
Router(config-if)#no shutdown 
Router(config-if)#end
Router#

4.測試IP設定是否有誤:
從Router上Ping TFTP server,確認IP是否互通,不通就要回頭查看哪邊出錯

成功Ping通應如下列訊息
Router#ping 192.168.10.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms
Router#

5.開始將Router中的IOS備份到TFTP中

Router#
Router#copy  flash:c1841-adventerprisek9-mz.150-1.M10.bin  tftp   IOS名稱請參照先前的資訊
Address or name of remote host []? 192.168.10.1                               輸入TFTP伺服器的IP
Destination filename [c1841-adventerprisek9-mz.150-1.M10.bin]?    設定備份起來的檔案名稱
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
43126032 bytes copied in 59.860 secs (720448 bytes/sec)
Router#

複製成功,接著到本機的TFTP資料夾中,確認檔案存在就表示備份成功

PS:若是IOS檔案的大小超過16MB的話,檔案傳到一半,你可能會看到類似下列的訊息

!!!!!!!!.....
%Error writing tftp://192.168.10.1/c1841-adventerprisek9-mz.150-1.M10.bin (Timed out).....

原因是設備的TFTP的傳輸容量限制為16MB,超過就會出錯,這時,需要換成其他方式來傳輸,可以改用rcp或是ftp。


備份設定黨的方法相似,指令如下:
Router#
Router#copy  startup-config  tftp:   IOS名稱請參照先前的資訊
Address or name of remote host []? 192.168.10.1                               輸入TFTP伺服器的IP
Destination filename [Router-confg]?                 設定備份起來的檔案名稱,括號內為預設名稱
Writing startup-config...!!
[OK - 621 bytes]

621 bytes copied in 0.002 secs (310500 bytes/sec)

Router#

複製成功,接著到本機的TFTP資料夾中,確認檔案存在就表示備份成功

PS:若設定檔的大小超過16MB的話,同樣可能會出現Error writing的錯誤訊息