Difference between revisions of "HOWTO:Backup your router"

From Embedded Xinu
Jump to navigation Jump to search
Line 7: Line 7:
 
<code><pre>http://ROUTER_IP/backup/cfe.bin</pre></code>
 
<code><pre>http://ROUTER_IP/backup/cfe.bin</pre></code>
  
= CFE =  
+
= CFE =
 +
To backup the CFE from within the CFE itself you need an active [[HOWTO:Connect_to_a_modified_router|serial console] and a live network connection to a [[HOWTO:Deploy_Xinu|TFTP server]]. On the TFTP server, create a file for the backup image. It must be world writable. If you do not pre-create the file for the TFTP client, the backup may fail. We name and label our routers to keep them straight.  Consider naming the backup image after each router's hostname if you have many of them.
 +
 
 +
Example:
 +
<code><pre>
 +
user@xinuserver:tftpboot$ touch routername.cfe
 +
user@xinuserver:tftpboot$ chmod a+w routername.cfe
 +
</pre></code>
 +
 
 +
Access the [[CFE]] using the [[CFE#Getting into CFE|usual method]].
 +
 
 +
If necessary, configure the network interface and check the connection to your TFTP server (192.168.6.10 in this example):
 +
<code><pre>
 +
CFE> ifconfig eth0 -auto
 +
Device eth0:  hwaddr 00-1E-E5-86-02-7A, ipaddr 192.168.6.122, mask 255.255.255.0
 +
        gateway 192.168.6.50, nameserver 134.48.7.10, domain xinu.mu.edu
 +
*** command status = 0
 +
CFE> ping 192.168.6.10
 +
192.168.6.10 (192.168.6.10) is alive
 +
192.168.6.10 (192.168.6.10): 1 packets sent, 1 received
 +
*** command status = 0
 +
</pre></code>
 +
 
 +
Save the CFE region to the file you created on the TFTP server:
 +
<code><pre>
 +
CFE> save 192.168.6.10:routername.cfe BC000000 40000
 +
262144 bytes written to 192.168.6.10:routername.cfe
 +
*** command status = 0
 +
</pre></code>
 +
 
 +
Note: You can also save the entire flash image (CFE+Kernel+NVRAM) by passing 400000 as the length instead of 40000.  This isn't really necessary, but you might find it referenced elsewhere.  If you have to [[Router recovery|recover]] via JTAG it will take a LONG time to restore the entire flash image. It is much more efficient to load just the CFE, then upload the kernel via TFTP and use a factory reset to restore NVRAM.
  
 
= JTAG =
 
= JTAG =

Revision as of 17:46, 21 June 2011

When experimenting with kernels, you may find yourself corrupting the router and having to recover from a known good state. It is a good idea to make a copy of the CFE when it is in its original factory configuration for if and when. Here are a few different methods depending on your resources:

dd-wrt

If you are running a relatively recent version of dd-wrt, you can download the CFE from the web interface.

Location:

http://ROUTER_IP/backup/cfe.bin

CFE

To backup the CFE from within the CFE itself you need an active [[HOWTO:Connect_to_a_modified_router|serial console] and a live network connection to a TFTP server. On the TFTP server, create a file for the backup image. It must be world writable. If you do not pre-create the file for the TFTP client, the backup may fail. We name and label our routers to keep them straight. Consider naming the backup image after each router's hostname if you have many of them.

Example:

user@xinuserver:tftpboot$ touch routername.cfe
user@xinuserver:tftpboot$ chmod a+w routername.cfe

Access the CFE using the usual method.

If necessary, configure the network interface and check the connection to your TFTP server (192.168.6.10 in this example):

CFE> ifconfig eth0 -auto
Device eth0:  hwaddr 00-1E-E5-86-02-7A, ipaddr 192.168.6.122, mask 255.255.255.0
        gateway 192.168.6.50, nameserver 134.48.7.10, domain xinu.mu.edu
*** command status = 0
CFE> ping 192.168.6.10
192.168.6.10 (192.168.6.10) is alive
192.168.6.10 (192.168.6.10): 1 packets sent, 1 received
*** command status = 0

Save the CFE region to the file you created on the TFTP server:

CFE> save 192.168.6.10:routername.cfe BC000000 40000
262144 bytes written to 192.168.6.10:routername.cfe
*** command status = 0

Note: You can also save the entire flash image (CFE+Kernel+NVRAM) by passing 400000 as the length instead of 40000. This isn't really necessary, but you might find it referenced elsewhere. If you have to recover via JTAG it will take a LONG time to restore the entire flash image. It is much more efficient to load just the CFE, then upload the kernel via TFTP and use a factory reset to restore NVRAM.

JTAG