Difference between revisions of "HOWTO:Backup your router"
(Created page with '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 i...') |
(→JTAG) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
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: | 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 = | + | = dd-wrt = |
+ | If you are running a relatively recent version of [http://www.dd-wrt.com/ dd-wrt], you can download the CFE from the web interface. | ||
+ | Location: | ||
+ | <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 = | ||
+ | For this method to work, we assume you have a working [[EJTAG]] interface to your router. For details, check out our [[Router Recovery]] page. | ||
+ | |||
+ | Use the <tt>-probeonly</tt> option to figure out what options TJTAG needs for your particular setup. | ||
+ | |||
+ | Backup the CFE with TJTAG: | ||
+ | <code><pre>user@host:tjtag$ ./tjtag -backup:cfe /wiggler /noemw /noreset</pre></code> | ||
+ | |||
+ | TJTAG will create a CFE.BIN file with some sort of timestamp identifier appended to the filename. Rename and store somewhere safe. |
Latest revision as of 17:59, 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 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
For this method to work, we assume you have a working EJTAG interface to your router. For details, check out our Router Recovery page.
Use the -probeonly option to figure out what options TJTAG needs for your particular setup.
Backup the CFE with TJTAG:
user@host:tjtag$ ./tjtag -backup:cfe /wiggler /noemw /noreset
TJTAG will create a CFE.BIN file with some sort of timestamp identifier appended to the filename. Rename and store somewhere safe.