# Mikrotik RB2011 OpenWRT Installation Procedure

RouterBoard RB2011 Install Tips Steak Electronics

\textbf{Mikrotik RB2011 Routerboard Install}
Contents
Contents
1.  Overview

4.  Pitfalls

1. Overview To install Openwrt on a Rack Mount server. One of the options is the Mikrotik RB2011 series of routers.

\textbf{EDIT: 11/28/19 Since this has been written, 19.01 RC has been released, and I would recommend people use that for the RB2011, as it should address issues with installation (SPI Flash write / RAM ECC errors covered in Troubleshooting section) which can occur on ‘some’ RB2011 models. }

2. Procedure This paper will not be a record of my work (though it took about 3 nights to compile this info). What it will be is a guide for others, or myself to install Openwrt on this router in the future. Let’s begin.

The general process will be the following:
\begin{verbatim}
1.) Run dnsmasq command which will start a DHCP server with
TFTP boot enabled
2.) Power off RB2011, Hold reset button, and power on.
Continue holding reset button until you see the DNSMasq
window report it has sent the file.
to the nand-large mikrotik image.
\end{verbatim}
Sounds simple? It should be! Millions of hours of engineering and manpower have gone into this, it better damn well be. But don’t be surprised if something unexpected occurs. I will cover some troubleshooting as well.

2.1. Run DHCP server with TFTP boot enabled I tend to make a shell command for the dhcp server command. It’s just one command, and will do all the gymnastics for you. Here we go:

\begin{verbatim}
//
#/bin/bash
#ifconfig eth0 192.168.1.10 up
sudo dnsmasq -i eth0 –dhcp-range=192.168.1.100,192.168.1.200 \
–dhcp-boot=openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf \
–enable-tftp –tftp-root=~/directory/where/file/is/ \
-d -u \$USER -p0 -K –log-dhcp –bootp-dynamic
//
\end{verbatim}
You can omit the ifconfig, and run it manually. Essentially, you must start an interface with a static ip at 192.168.1.0/24 network. Sometimes you will start getting connect: invalid argument errors when trying to run ping, or ssh, so when that happens, I simply
\\
\textbf{ifconfig eth0 0.0.0.0}

Then again init the interface with \textbf{ifconfig eth0 192.168.1.10 netmask 255.255.255.0}

You should be connected to Ethernet port 1 on the Mikrotik. Now, that’s all for part 1. Let’s reset it.

2.2. Power off Mikrotik, hold reset, and power on This section is self explanatory. The only things to note are the following:

Don’t need to hold reset when it’s on, then power off. No 30/30/30 crap here. Don’t need to wait that long. Simply power off, hold reset, then power on and hold for 20-30 seconds.

You can let go of reset when the TFTP boot says it sent the router file, but remain connected to Ethernet port 1, until you see the tftp boot print out the Openwrt hostname from the netbooted router. It takes a few seconds, but it will. After that you can plug into ethernet port 2,3,4 or anything besides 1.

2.3. Backup existing Flash of Mikrotik (optional – recommended) Next, login to the Openwrt. Make sure you login from ethernet 2 or 3 (but not 1).

Here’s an intermediate step. Navigate to the /tmp directory and backup the flash configuration.
\begin{verbatim}
cat /proc/mtd (review this, you want to copy the last two filesystems)
(they will either be /dev/mtdblock1+2 or /dev/mtdblock5+6)

FAST WAY:
You can directly dd to your remote computer from the router.
dd if=/dev/mtd6 | ssh user@host dd of=/somewhere.img

That saves some steps. And yes, the mtd6 is the same size
and checksum as the mtdblock6, I checked. But you should double
check too.

EDIT: You can’t restore the previous Mikrotik OS with these images, though. Not sure why.

SLOW WAY:
mkdir /mnt/kernel /mnt/rootfs
(assuming it’s at mtd1)
mount -t jffs2 /dev/mtdblock1 /mnt/kernel
mount -t jffs2 /dev/mtdblock2 /mnt/rootfs
cd /mnt/kernel
tar czf /tmp/mikrotik-kernel.tar.gz
cd /mnt/rootfs
tar czf /tmp/mikrotik-rootfs.tar.gz

Finally, scp the two tar files to your local machine.

\end{verbatim}
2.4. Sysupgrade the sysupgrade bin To install on the RB2011, you should use the sysupgrade bin from the netbooted Openwrt. You should already be logged into the Netboot openwrt. At this point, scp the sysupgrade bin to the tmp folder. (I used the nand-large image, not the 64M one). Navigate to /tmp and then run
\\

That should be it. Give it a few minutes to reboot, and if all goes well, you will have a functioning rack mount FOSS router. Good.

3. Troubleshooting – Bad RAM ECC Errors I’ve done this process on 3 different RB2011 routers. The first I used the 64M image, and it worked without issue. The 2nd, I tried the 64M image but it failed, so I repeated the netboot process, and used the large image. It worked from there.

On the 3rd router, it wouldn’t boot the image. I tried manually installing via flashing the rootfs, and vmlinuz images manually, from the netboot, but that didn’t work either. Finally, I connected a serial port (UART). [1] I connected Minicom and watched the Openwrt kernel attempt to boot. From the boot messages, I could clearly see what the problem was: Bad RAM (ECC Errors). So if the above steps don’t work, I recommend simply soldering a wire to the RX, wrapping a wire around the ground pin, and listening to the boot console.

You can always netboot again, if you flash the wrong image for some reason. The Mikrotik is good, in that the netboot functionality is easy to use. Well designed, I tip my hat to them. Just be careful not to write to the bootloader. Otherwise, there is also a labeled JTAG connector which might (possibly) work.

4. Pitfalls 4.1. Other Openwrt configs, beware! Don’t think you can upload a working configuration from a different piece of Openwrt hardware to this device. The ports in the /etc/config files may be different, and it might not boot. If you make a mistake, just netboot, then sysupgrade again. I will admit, I did this.

5. References

https://openwrt.org/toh/mikrotik/rb2011

https://openwrt.org/toh/mikrotik/rb2011uias

https://openwrt.org/toh/mikrotik/common

EDIT: After installing this on 2/4/19, I found that some of them did not install without some changes. There is a forum thread on this, but for now you have to install from git master, for ‘some’ rb2011 models. In 19 release, the errors should be resolved, and the release file should just work. Installing from git is not difficult, and don’t be afraid. There are three settings you have to adjust in make menuconfig. the target architecture (ar71xx), the make (mikrotik) and that this is a Nand-large type. The rest of menuconfig can be left at defaults.

Here’s the copied and pasted instructions from https://forum.openwrt.org/t/building-and-installing-lede-image-from-source-on-mikrotik-rb433/7172/13

It covers everything, except that if you get warnings about missing dependencies, you must run a script in the openwrt directory. I believe it’s ./scripts/feeds. update -a

./scripts/feeds install -a

If you are unsure, search the forums.

I hope this can help someone,
leave me a message if there is something to correct.

something is taken from: https://wiki.openwrt.org/toh/mikrotik/rb433 18

Thanks
FMH

COMPILE FROM SOURCE



sudo apt install build-essential git zlib1g-dev

as non privileged user



cd ~; mkdir lede-project
git clone https://github.com/lede-project/source.git 5
cd source

i made only this choiche
--- Target System (Atheros AR7xxx/AR9xxx)
--- Subtarget (Mikrotik devices with NAND/NOR flash)
--- Target Profile (MikroTik RouterBoard (64 MB NAND))

exit and save .config file



make

if something missing check the errors
when everything is finished
sudo mkdir /tftpboot
sudo cp bin/targets/ar71xx/mikrotik/lede-ar71xx-mikrotik-vmlinux-initramfs-lzma.elf /tftpboot/boot.elf
sudo cp bin/targets/ar71xx/mikrotiklede-ar71xx-mikrotik-nand-64m-squashfs-sysupgrade.bin

1. All you need is Ground and an RX of the router (it’s near the power plug, marked on the pcb).