RADIUSdesk

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
user_guide:mikrotik:openwrt_rb750gr3 [2021/02/10 05:53] – [Export the RouterOS License Key] adminuser_guide:mikrotik:openwrt_rb750gr3 [2022/04/26 09:26] (current) – [Introduction] admin
Line 8: Line 8:
   * Some of their models are also able to run OpenWRT as an alternative to RouterOS.   * Some of their models are also able to run OpenWRT as an alternative to RouterOS.
   * OpenWRT is OpenSource and there is no paid for licensing involved on OpenWRT.   * OpenWRT is OpenSource and there is no paid for licensing involved on OpenWRT.
-  * This page will just cover the flash from RouterOS to OpenWRT.+  * This page will **only** cover the flash from RouterOS to OpenWRT on the Mikrotik RB750Gr3.
   * We will cover the configuration of the device once OpenWRT is running on it on a separate page.   * We will cover the configuration of the device once OpenWRT is running on it on a separate page.
  
Line 24: Line 24:
 ===== Export the RouterOS License Key ===== ===== Export the RouterOS License Key =====
   * It is recommended that you export the RouterOS license key in the event of returning to the original RouterOS, you might need to use it again to activate the RouterOS.   * It is recommended that you export the RouterOS license key in the event of returning to the original RouterOS, you might need to use it again to activate the RouterOS.
-  * RouterOS can be accesses various ways which include+  * RouterOS can be accessed in various ways which include
         * Web based UI called Webfig (default http://192.168.88.1) on the LAN side of the board         * Web based UI called Webfig (default http://192.168.88.1) on the LAN side of the board
         * Using the WinBox application.         * Using the WinBox application.
Line 58: Line 58:
  
 Now that we have the license key taken care of we can go to the next step which is to load the RAM based OpenWRT onto the device Now that we have the license key taken care of we can go to the next step which is to load the RAM based OpenWRT onto the device
 +
 +===== Load a RAM based version of OpenWRT =====
 +  * In order for us to get the RAM based version of OpenWRT onto the Mikrotik two things are involved.
 +     - There has to be a BOOTP environment set up to serve the RAM based image
 +     - The Mikrotik has to be set in such a mode as to use the BOOTP environment to fetch the RAM based image using BOOTP
 +
 +==== Set up a BOOTP Environment ====
 +
 +   * On Ubuntu it is very simple and we just create a small shell script to take care of it
 +
 +<file bash  loader.sh>
 +#!/bin/bash
 +#HEADS UP substitute with the logged in user's name that you use to create this file e.g. whoami output
 +USER=system
 +#HEADS UP THIS MUST MATCH YOUR MACHINE'S LAN INTERFACE
 +IFNAME=enp8s0
 +/sbin/ip addr replace 192.168.1.10/24 dev $IFNAME
 +/sbin/ip link set dev $IFNAME up
 +/usr/sbin/dnsmasq --user=$USER \
 +--no-daemon \
 +--listen-address 192.168.1.10 \
 +--bind-interfaces \
 +-p0 \
 +--dhcp-authoritative \
 +--dhcp-range=192.168.1.100,192.168.1.200 \
 +--bootp-dynamic \
 +--dhcp-boot=openwrt-19.07.6-ramips-mt7621-mikrotik_rb750gr3-initramfs-kernel.bin \
 +--log-dhcp \
 +--enable-tftp \
 +--tftp-root=$(pwd)
 +</file>
 +  * As you can see we will serve the **openwrt-19.07.6-ramips-mt7621-mikrotik_rb750gr3-initramfs-kernel.bin** image to the Mikrotik.
 +  * Download this image (This was the latest 19.07 based image at the time of this writing - PLEASE CHECK IF ITS STILL THE LATEST!)
 +  * https://downloads.openwrt.org/releases/19.07.6/targets/ramips/mt7621/
 +  * Make sure it is located in the same directory as the loader.sh script.
 +  * Do the following to start up the BOOTP service
 +<code bash>
 +#CD to where the RAM image and loader.sh files are
 +chmod 755 ./loader.sh
 +sudo ./loader.sh
 +#WE get the following output
 +[sudo] password for system: 
 +dnsmasq: started, version 2.80 DNS disabled
 +dnsmasq: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth nettlehash DNSSEC loop-detect inotify dumpfile
 +dnsmasq-dhcp: DHCP, IP range 192.168.1.100 -- 192.168.1.200, lease time 1h
 +dnsmasq-tftp: TFTP root is /home/system/Documents/mt_flash 
 +</code>
 +
 +  * Our BOOTP environment is now ready for action.
 +  * Next we will make the Mikrotik use this environment to load the RAM image
 +
 +=== Force Mikrotik to use BOOTP ===
 +== We add a note on setting the Mikrotik up to do BOOTP ==
 +  * Not all Mikrotiks we worked with had BOOTP enabled after a reset.
 +  * For those there is a manual procedure you have to follow to enable this startup functionality.
 +  * https://wiki.mikrotik.com/wiki/Manual:Etherboot
 +  * https://wiki.mikrotik.com/wiki/Manual:RouterBOARD_settings
 +
 +== Kicking off BOOTP ==
 +  * To force the Mikrotik to use the BOOTP environment you need to connect the Internet Port of the Mikrotik to your Linux machine. (Internet Port is Port 1 on the Mikrotik)
 +  * Press the RESET button while powering up the board.
 +  * Wait for the first beep and release the RESET button.
 +  * This is what our dnsmasq script outputs during the process
 +<code bash>
 +dnsmasq-dhcp: 274610437 available DHCP range: 192.168.1.100 -- 192.168.1.200
 +dnsmasq-dhcp: 274610437 vendor class: MMipsBoot
 +dnsmasq-dhcp: 274610437 tags: bootp, enp8s0
 +dnsmasq-dhcp: 274610437 BOOTP(enp8s0) 192.168.1.144 48:8f:5a:e3:d4:9c 
 +dnsmasq-dhcp: 274610437 bootfile name: openwrt-19.07.6-ramips-mt7621-mikrotik_rb750gr3-initramfs-kernel.bin
 +dnsmasq-dhcp: 274610437 next server: 192.168.1.10
 +dnsmasq-dhcp: 274610437 sent size:  4 option:  1 netmask  255.255.255.0
 +dnsmasq-dhcp: 274610437 sent size:  4 option: 28 broadcast  192.168.1.255
 +dnsmasq-dhcp: 274610437 sent size:  4 option:  3 router  192.168.1.10
 +dnsmasq-tftp: sent /home/system/Documents/mt_flash/openwrt-19.07.6-ramips-mt7621-mikrotik_rb750gr3-initramfs-kernel.bin to 192.168.1.144
 +</code>
 +  * The USR LED will blink while OpenWRT is busy booting itself.
 +  * After a while it will stop and this should happen on the output of the dnsmasq script
 +<code bash>
 +....
 +dnsmasq-dhcp: 3516861450 available DHCP range: 192.168.1.100 -- 192.168.1.200
 +dnsmasq-dhcp: 3516861450 vendor class: udhcp 1.30.1
 +dnsmasq-dhcp: 3516861450 client provides name: OpenWrt
 +dnsmasq-dhcp: 3516861450 DHCPDISCOVER(enp8s0) 48:8f:5a:e3:d4:9e 
 +dnsmasq-dhcp: 3516861450 tags: enp8s0
 +dnsmasq-dhcp: 3516861450 DHCPOFFER(enp8s0) 192.168.1.146 48:8f:5a:e3:d4:9e 
 +dnsmasq-dhcp: 3516861450 requested options: 1:netmask, 3:router, 6:dns-server, 12:hostname, 
 +....
 +</code>
 +  * This simply means that OpenWRT are now fully booted and actually looking for an IP Address itself!
 +  * You can now (While the board is still powered up) move the cable to any of the LAN ports of the Mikrotik
 +  * Terminate the **loader.sh** script
 +  * Reconfigure the LAN interface on the Linux machine to have IP 192.168.1.10
 +<code bash>
 + sudo ip addr add 192.168.1.10/24 dev enp8s0
 +</code>
 +  * Connect to OpenWRT on 192.168.1.1
 +     * You can connect using Luci on http://192.168.1.1
 +     * Alternatively you can use ssh to connect to 192.168.1.1
 +
 +  * We are all set now to flash the final version of OpenWRT onto the device.
 +  * At this stage you can still return the device back to the original RouterOS by simply rebooting it since the OpenWRT running is all in RAM.
 +  * We are however not going to do that since we want to move over to OpenWRT permanently :-)
 +
 +===== Flash the permanent version of OpenWRT =====
 +  * Download the **sysupgrade** version of the firmware.
 +  * Ours is called **openwrt-19.07.6-ramips-mt7621-mikrotik_rb750gr3-squashfs-sysupgrade.bin** at the time of this writing.
 +  * We will show the shell commands to do the flash but the Luci GUI should work just as well
 +<code bash>
 +#Copy the *sysupgrade* file to the /tmp dir on the Mikrotik
 +scp openwrt-19.07.6-ramips-mt7621-mikrotik_rb750gr3-squashfs-sysupgrade.bin root@192.168.1.1:/tmp
 +#SSH into the Mikrotik
 +ssh root@192.168.1.1
 +#Change directory to /tmp
 +cd /tmp
 +#Do a sysupgrade 
 +sysupgrade openwrt-19.07.6-ramips-mt7621-mikrotik_rb750gr3-squashfs-sysupgrade.bin
 +#USR LED will flash while it is writing to flash
 +#After ~2min it will stop and reboot (beeper will beep) 
 +</code>
 +  * Congratulations you have now successfully migrated from RouterOS to OpenWRT
 +  * If it might happen so that in future you mess up the current version of OpenWRT so bad that it will not let you in, you can just repeat the BOOTP RAM image boot and repeat this step again.
 +  * This makes the RouterBoard pretty robust
 +
 +
 +
 +