NVRAM

Default settings

On many router models, you can completly erase the NVRAM, some values will then reappear as default. This is often useful when you want to drop the relicts from the original firmware. Please look into the model docs to make sure its safe.

mtd -r erase nvram

boot_wait

On many router models (like Linksys), you can flash the router via tftp even in a special failsafe mode. To make sure the router will wait long enough for the tftp put command, set the special NVRAM parameter boot_wait

nvram set boot_wait=on
nvram commit

Firmware

Flashing via TFTP

You have to set the router in failsafe mode (often done by holding the reset button when switching the router on), then you can upload the image. On Linksys routers, the default ip address is 192.168.1.1, unfortunately, Asus routers uses the ip address saved in nvram.

tftp 192.168.1.1
tftp> binary
tftp> trace
tftp> rexmt 1
tftp> put <image.bin>

or from Windows:

tftp -i 192.168.1.1 put <image.bin>

Flashing via mtd

If you have direct access to the router, you can use mtd to flash the firmware locally. Copy the raw trx file via scp to the router and execute:

mtd -r write <image.trx> linux

Converting bin to trx

Some firmware contains a special header which is used for tftp upgrading, but not for the direct mtd upgrade. You can convert .bin files to .trx with:

dd bs=32 skip=1 if=<image.bin> of=<image.trx>