# No dhcpd or tftpd, no problem. Load OpenWRT firmware on Mikrotik RouterBoards the easy way using dnsmasq. Open two bash shell windows. In the 1st window execute the following and create your loader file:
# FIRST BASH SHELL WINDOW
mkdir -p /var/lib/tftpboot
# Create your loader.sh file
ifconfig enp6s0 192.168.1.10 up
dnsmasq -i enp6s0 --dhcp-range=192.168.1.100,192.168.1.200 \
--dhcp-boot=openwrt-18.06.1-<your supported routerboard-initramfs>-kernel.bin \
--enable-tftp --tftp-root=/var/lib/tftpboot/ -d -u root -p0 -K --log-dhcp --bootp-dynamic
# Make it executable.
chmod 755 /var/lib/tftpboot/loader.sh
# Ensure both your desired initram AND upgrade image files (2 files) have been moved to the above tftpboot directory. If you forget the corresponding upgrade file, on reboot you’ll find RouterOS is back. Once you’re interfacing with OpenWRT, make sure to manually execute the upgrade in order to purge the RouterOS. It will ensure your OpenWRT kernel sticks and survives power cycles.
# Unplug your ethernet cable that connects the Linux host you are currently on from your current internet router. Then connect this loose end into the WAN/Internet port on your MikroTik Routerboard.
# In your second bash window, execute the following commands: First we determine what the main interface name is that’s using your ethernet connection (in my case its enp6s0). Then we create a virtual interface assigning it an IP address that resides on the 192.168.88.0/24 network.
# SECOND BASH SHELL WINDOW
ifconfig | grep Ethernet | cut -d" " -f1
#enp6s0 <-- e.g. output. You may have more than one listed, its usually the top.
ifconfig enp6s0:0 192.168.88.2 up
# Now telnet to 192.168.88.1 and login (u:admin p:) assuming this is a new Routerboard. Once logged in execute the following two commands (do not close this window.)
/system routerboard settings set boot-device=try-ethernet-once-then-nand
/system routerboard settings set boot-protocol=dhcp
# FIRST BASH SHELL WINDOW
# Now quickly Unplug the power source from your Routerboard and plug it back in. You should soon see in your FIRST BASH WINDOW dhcp and a tftp directives and the sending of your OpenWRT image to the Routerboard. Give it some time to complete. A sign of completion is you will see OpenWRT dhcp messages in your FIRST BASH WINDOW.
# Once the first flashing is complete, unplug your ethernet cable from the Routerboard WAN port and plug it into its first LAN port. Depending on which Routerboard you have it may vary. You should now be able use a browser and log into OpenWRT via ip address 192.168.1.1. NOTE! you’re NOT FINISHED! Log into OpenWRT and navigate to System> Backup / Flash Firmware. In the Flash new firmware image section click choose file and load the OpenWRT sysupgrade image you stored in /var/lib/tftpboot then click Flash Image. Now your new OpenWRT router will survive reboots.
# Lastly decide to delete, or keep but disable and lock loader.sh until its needed again.
chmod 000 /var/lib/tftpboot/loader.sh
chattr +i /var/lib/tftpboot/loader.sh
# Visual confirmation loader.sh is locked down using lsattr.
# Sample results: