OpenWRT Part TBD – Recovering from a catastrophic configuration failure

At some point you will likely completely banjax your router configuration to the point where it won’t issue IPs, boot fully or be in some other busted state and it just sits in the corner glaring at you. When the router is utterly vital to you being able to work and thus get paid, you may well be tempted to rip it off the wall, douse it in petrol and set it alight.

Whilst that may be somewhat cathartic, it’s not going to help much and it only takes a few minutes to recover a borked router. Think about that – you can hose the whole damned thing and still recover. Neat!

The official documentation is here, what follows is my somewhat abridged version.

  1. Get a nice cup of hot tea. Tea is vital! Do not underestimate the tea.
  2. Sup tea thoughtfully as you size-up your opponent.
  3. Examine the router, know the location of the main display LEDs (the WAN/Ethernet LED is probably the one you’ll be paying attention to).
  4. Also note any buttons that are not a power or reset buttons. In my case, I had an “AOSS” one I could use.
  5. Remove all the network cables bar one which you directly connect to the recovery PC; make sure this is connect to a LAN port on the router (probably LAN 1 or LAN <insert highest number here>).
  6. Configure the PC so that its Ethernet port (probably “eth0” has fixed IP “192.168.1.2“, netmask “255.255.255.0” and gateway “192.168.1.1
  7. Power off (or simply unplug) the router.
  8. Wait a moment.
  9. Power the router back on and pay attention to the LED you noted earlier.
  10. Once the LED starts to flash repeatedly, press the button you selected.
  11. Wait a moment.
  12. If the LED starts to flash very rapidly, congratulations you are if “failsafe” mode. If not, go back to step 7 and try a different button.
  13. From the PC, open a terminal and try ssh root@192.168.1.1 and if that fails (it probably will), try telnet 192.168.1.1
  14. Once in, you can now begin to correct issues. You’ll probably want to issue mount_root and then start to fix the file(s) in /etc/config
  15. Make sure your changes are saved and reboot. If the router starts normally, congratulations it’s been fixed. If not, go back to step 7 and try again.
  16. You can now reconnect everything as it should be and undo the changes you made to the PC.

This post was brought to you by “Whoops! I broke my ‘dnsmasq’ configuration”, the number 3 and a few words one should not use in polite society.

Leave a Reply