MikroTik and NetInstall

Today I bricked a MikroTik router. I have no idea what went wrong, but after upgrading an RB951G to 5.25, it was, um, uncommunicative. No SSID visible, no DHCP happening on the Ethernet ports, no response even when I set up a static address on the other end of the Ethernet. An enquiry to the ever helpful Mike Everest at Duxtel suggested I should try NetInstall and directed me to this wiki entry from MikroTik. If you use MikroTik routers and feel you too would like to know how to bring one back from the brink, read on.

Getting ready

Getting NetInstall was no problem – it’s available from the download area of the MikroTik website. Getting it running was no problem under WINE, either , except that it could not bind to the BOOTP server socket – permissions problems.

Neither setcap nor authbind brought relief, so with a gnashing of teeth I fired up a Windows XP virtual machine and ran NetInstall on that.

You’ll need a static address on an Ethernet port, and a direct connection between that Ethernet port and ether1 on the MikroTik. To avoid confusion, it’s probably best to disconnect any other network interfaces you may have, and disconnect anything else that may be plugged into the MikroTik. Make sure you have disabled any firewalls or packet filters you may have on the Ethernet interface you are using.

You’ll also need a paper-clip, bent open so that you can use the end of the wire to reset the MikroTik. Anything thin, rigid and blunt-ended will do – don’t use a needle, thumbtack or similar because you risk destroying the reset switch. A blunted toothpick works well, too.

And you will need a directory with the relevant MikroTik install files in it. I wanted RouterOS 5.25 (upgrading to that was what had got me into this situation in the first place), so I had already downloaded the 5.25 “upgrade” package from the MikroTik website. Because I was using a VM I had to put it in some shared filespace that the VM could see. A USB stick or CD would have worked as well.

Make sure you get the the files for the correct architecture! In my case, “mipsbe”.

Running NetInstall

NetInstall is a single executable; there is no setup or install step, you just run it. To enable the PXE boot server function, click the “Net booting” button; in the dialogue that pops up, check the “enable” checkbox, and put the address you want the router to get into the other field. This address should be one in the same subnet as the static address on your Ethernet interface. This address is only temporary – it allows NetInstall to talk to the router. After your router is upgraded (or in my case, back from the dead), you can configure it however you want.

Resetting the router

Now switch off the power to the router. Using your modified paper-clip, press and hold down the tiny reset switch located through a small hole just to the right of the power inlet on the router. It’s a very small switch, and it takes very little force to hold it down, but there is a distinct “click” (more a feeling than a sound) when you do. Then turn the power back on, while continuing to hold down the reset switch.

Keep holding down the switch; after a couple of seconds, the “ACT” LED will start to blink. When it stops blinking after about fifteen seconds, let go of the reset switch. This procedure instructs the router to perform a network boot; after another ten to twenty seconds (give it time!) you should see an entry for the router appear in the NetInstall “Routers/Drives” pane. The status should be “Ready”.

Uploading to the router

Select the router by clicking on its entry in the NetInstall “Routers/Drives” pane.

Click the “Browse” button in the “Packages” pane (the lower half of the NetInstall window) and navigate to wherever you put the MikroTik files. Check the box to the left of any file you want to upload. I recommend checking only the RouterOS package.

At this point the “Install” button should no longer be greyed out (if it is still greyed out, the router may not be selected in the “Routers/Drives” pane). Click “Install”; the checked files will be uploaded and your router will reboot.

One last reboot

I found that the router did not “come back” fully after this procedure. I’m not sure if it is formally required, but I strongly suggest that you reset the router configuration at this point. Carry out the same reset procedure as above, but this time release the switch as soon as the “ACT” LED starts to flash – after about 5 seconds.

And finally…

The router can now be configured as normal. If you were far-sighted enough to take a backup of your configuration, you can log in and restore from backup.

NetInstall has a lot of options I didn’t use. I don’t find it particularly intuitive, and the doco is minimal and a bit obtuse, but it got me out of a hole and is thus a Good Thing. I’m glad it’s in my toolkit, even if I do have to run it under Windows. If anyone knows how to get it working under WINE, do please let me know!