Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| toh:mikrotik:common [2022/09/25 15:25] – Add a warning that RouterOS v7 is not compatible kirelagin | toh:mikrotik:common [2023/09/25 21:57] – [Common Procedures for MikroTik RouterBoard Products] 532910 | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| <WRAP alert> | <WRAP alert> | ||
| - | OpenWrt is not compatible with the bootloader of RouterOS **v7**. Do NOT upgrade your device | + | OpenWrt is not compatible with the bootloader of RouterOS **v7** |
| + | |||
| + | This isn't fully true, while the first part looks correct: v7 RouterBoot doesn' | ||
| </ | </ | ||
| Line 11: | Line 13: | ||
| **TL;DR** | **TL;DR** | ||
| - | - Save the license key of RouterOS and (optional) | + | - (optional) |
| + | - Downgrade to RouterOS v6 if you previously upgraded to v7. | ||
| - Boot router via network boot (BOOTP/TFTP or DHCP/TFTP) for testing. OpenWrt isn't installed now, it's working from a RAM image. If it doesn' | - Boot router via network boot (BOOTP/TFTP or DHCP/TFTP) for testing. OpenWrt isn't installed now, it's working from a RAM image. If it doesn' | ||
| - If all right, write OpenWrt into flash of the router, then reboot. | - If all right, write OpenWrt into flash of the router, then reboot. | ||
| Line 26: | Line 29: | ||
| ===== First Things First: Don't Lose Your RouterOS License ===== | ===== First Things First: Don't Lose Your RouterOS License ===== | ||
| + | |||
| + | //Note: this step seems to be optional, at least for routers, since their license is tied directly to the hardware. Still, do this just in case.// | ||
| + | |||
| Before you start installing OpenWrt, save your RouterOS License .key file. This will allow you to use Mikrotik' | Before you start installing OpenWrt, save your RouterOS License .key file. This will allow you to use Mikrotik' | ||
| Line 31: | Line 37: | ||
| * [[#Saving MikroTik RouterBoard License Key Without Using WinBox|Procedure for Linux and other unix-like OS]] | * [[#Saving MikroTik RouterBoard License Key Without Using WinBox|Procedure for Linux and other unix-like OS]] | ||
| * [[# | * [[# | ||
| + | |||
| + | |||
| + | ===== Make sure the bootloader is compatible | ||
| + | |||
| + | The bootloader from RouterOS **v7** is not compatible with OpenWrt. If you have it, you will be able to netboot your device and flash OpenWrt, but after it reboots it will go straight to netboot again. | ||
| + | If this happens to you, [[https:// | ||
| + | |||
| + | To check the version of your bootloader from RouterOS, go to System → Routerboard in the web interface or run ''/ | ||
| + | |||
| + | If you have already booted an OpenWrt initramfs, to see the bootloader version run '' | ||
| + | |||
| ===== Selecting an OpenWrt version | ===== Selecting an OpenWrt version | ||
| Line 40: | Line 57: | ||
| ===== To Test-Drive OpenWrt, Netboot the initramfs File ===== | ===== To Test-Drive OpenWrt, Netboot the initramfs File ===== | ||
| + | |||
| Since an initramfs image is just a temporary image (only loaded into RAM), it is safe to test a particular version of OpenWrt by netbooting (using DHCP/ | Since an initramfs image is just a temporary image (only loaded into RAM), it is safe to test a particular version of OpenWrt by netbooting (using DHCP/ | ||
| When you power down your RouterBoard after loading an initramfs file, OpenWrt will simply vanish: a power down and reboot of the RouterBoard will revert to the prior version of firmware that is still in flash of the RouterBoard. | When you power down your RouterBoard after loading an initramfs file, OpenWrt will simply vanish: a power down and reboot of the RouterBoard will revert to the prior version of firmware that is still in flash of the RouterBoard. | ||
| Line 45: | Line 63: | ||
| If the RAM-based initramfs version you have selected works for you, feel free to try other versions of OpenWrt, such as Latest release or snapshot.\\ | If the RAM-based initramfs version you have selected works for you, feel free to try other versions of OpenWrt, such as Latest release or snapshot.\\ | ||
| Once you are happy with the RAM-based operation of OpenWrt, proceed to the step of [[#Flash OpenWrt|flashing OpenWrt]] in order to permanently write OpenWrt into your RouterBoard. | Once you are happy with the RAM-based operation of OpenWrt, proceed to the step of [[#Flash OpenWrt|flashing OpenWrt]] in order to permanently write OpenWrt into your RouterBoard. | ||
| + | |||
| + | Note: MikroTik' | ||
| ===== Downloading OpenWrt images for Mikrotik RouterBoards ===== | ===== Downloading OpenWrt images for Mikrotik RouterBoards ===== | ||
| The latest OpenWrt images can be downloaded from [[https:// | The latest OpenWrt images can be downloaded from [[https:// | ||
| - | Most OpenWrt supported RouterBoards are Atheros-based hardware: in that case, after selecting a release, go to the targets/ | ||
| - | For example, to download the 19.07.9 OpenWrt images for the (Atheros-based) RB450G, download from [[https:// | ||
| - | |||
| - | |||
| - | After the commit of [[https:// | ||
| - | This page has been updated to reflect this simplifying change used in OpenWrt Version 18 for the Mikrotik RouterBoards. | ||
| - | |||
| There will be just two images needed to install OpenWrt for any particular Mikrotik RouterBoard hardware platform: | There will be just two images needed to install OpenWrt for any particular Mikrotik RouterBoard hardware platform: | ||
| - The specific initramfs image to be downloaded into RAM during an initial netboot of the RouterBoard. | - The specific initramfs image to be downloaded into RAM during an initial netboot of the RouterBoard. | ||
| - | - The specific sysupgrade .bin image to be flashed into the Mikrotik router using the LuCI web interface. The correct | + | - The specific sysupgrade .bin image to be flashed into the Mikrotik router using the LuCI web interface |
| - | * Type of WiFi (AC vs. non-AC) installed on the RouterBoard. The 802.11 a/b/g/n WiFi products are ' | + | |
| - | * Size and type (NAND vs. NOR) of flash on the RouterBoard | + | |
| <WRAP leftalign round info 60%> | <WRAP leftalign round info 60%> | ||
| Line 69: | Line 80: | ||
| </ | </ | ||
| - | The following table explains the general convention of initramfs and sysupgrade file names, but does have exceptions. For example, for the nand-large images, it is quite model-specific whether you use the initramfs.elf or initramfs-lzma.elf image.\\ | ||
| - | The above [[toh: | ||
| - | |||
| - | ^ Flash Size | ||
| - | ^ ::: | ||
| - | | 16 MB NOR | rb-nor-flash-16M | ||
| - | | ::: | ::: | ||
| - | | 64 MB NAND | nand-64m | ||
| - | |128 MB NAND (or larger) | nand-large | ||
| - | |::: | ::: | ||
| - | |||
| - | Refer to the OpenWrt [[toh: | ||
| - | |||
| - | <WRAP leftalign round important 60%> | ||
| - | If you add packages to your installed version of OpenWrt (via opkg or LuCI), be careful to use the packages that are compiled specifically for the version of sysupgrade .bin you have running on your RouterBoard. | ||
| - | For example, if you decide to run nightly snapshots, be aware you'll want to also install and run the packages from that specific snapshot - each time you update the snapshot, you'll want to update both the sysupgrade .bin AND the packages you are using. | ||
| - | </ | ||
| - | |||
| - | <WRAP leftalign round important 60%> | ||
| - | If you are using a snapshot (e.g. for the RB750Gr3), there is no LuCI contained. The flashing can still be done using SSH as outlined in [[docs: | ||
| - | </ | ||
| ===== Netboot of OpenWrt Uses DHCP/ | ===== Netboot of OpenWrt Uses DHCP/ | ||
| Line 114: | Line 104: | ||
| === On Linux or other unix-like OS === | === On Linux or other unix-like OS === | ||
| - | == with dnsmasq == | + | === with dnsmasq |
| * Create the following script using a text editor such as vi: vi ~/ | * Create the following script using a text editor such as vi: vi ~/ | ||
| Line 146: | Line 136: | ||
| # ./loader.sh | # ./loader.sh | ||
| - | == with a generic DHCP/ | + | === with a generic DHCP/ |
| Copy openwrt-19.07-*-initramfs-* file to your TFTP server location. Set up your BOOTP server to point to your [[: | Copy openwrt-19.07-*-initramfs-* file to your TFTP server location. Set up your BOOTP server to point to your [[: | ||
| Line 165: | Line 156: | ||
| Connect the ethernet 1 port of your routerboard (typically the WAN port) to a network configured to reach the DHCP/ | Connect the ethernet 1 port of your routerboard (typically the WAN port) to a network configured to reach the DHCP/ | ||
| - | The RouterBoard default boot protocol is BOOTP. | + | The RouterBoard default boot protocol is BOOTP. |
| The instructions in this wiki tend to assume you have changed the netboot protocol to DHCP since DHCP netboot is supported by all DHCP servers.\\ | The instructions in this wiki tend to assume you have changed the netboot protocol to DHCP since DHCP netboot is supported by all DHCP servers.\\ | ||
| Line 178: | Line 169: | ||
| Most RouterBoard models generate a short beep when an image begins to netboot or load from flash (unless the RouterBoard has been put in ' | Most RouterBoard models generate a short beep when an image begins to netboot or load from flash (unless the RouterBoard has been put in ' | ||
| - | If you are using Tiny PXE as your netboot PXE DHCP/ | + | If you are using dnsmasq or Tiny PXE as your netboot PXE DHCP/ |
| To enable a netboot using the Reset button: | To enable a netboot using the Reset button: | ||
| Line 186: | Line 177: | ||
| - Plug the power jack back in | - Plug the power jack back in | ||
| - Observe activity LED(s). The LED behavior varies across models, but can be a good indicator about the boot process. | - Observe activity LED(s). The LED behavior varies across models, but can be a good indicator about the boot process. | ||
| - | - Release the reset button after you hear the beep (maximum 15 - 20 seconds). | + | - Release the reset button after you hear the beep (maximum 15 - 20 seconds) |
| === Method 2 - Use the RouterBoard serial COM port to enable TFTP netboot === | === Method 2 - Use the RouterBoard serial COM port to enable TFTP netboot === | ||
| Line 216: | Line 207: | ||
| Save | Save | ||
| - | Shutdown RouterBoard and next turn power off and on (don't reboot because on some devices " | + | Shutdown RouterBoard and next turn power off and on (don't reboot because on some devices " |
| - | + | ||
| - | === Method 4 - Using a running OpenWrt to enable TFTP netboot === | + | |
| - | + | ||
| - | The OpenWrt rbcfg utility permits to configure parameters of the routerboard bootloader. Note that this program may not work on all routerboards. | + | |
| - | + | ||
| - | opkg update | + | |
| - | opkg install rbcfg | + | |
| - | + | ||
| - | rbcfg set boot_device ethnand | + | |
| - | rbcfg set boot_protocol dhcp | + | |
| - | rbcfg apply | + | |
| - | + | ||
| - | Reboot. | + | |
| | | ||
| Line 253: | Line 231: | ||
| Congratulations: | Congratulations: | ||
| - | ==== Manually Flashing OpenWrt ==== | ||
| - | These instructions are deprecated since wget2nand is no longer used, but left here for reference. Note " | ||
| - | |||
| - | If wget2nand encounters problems, perform its steps manually from shell. | ||
| - | | ||
| - | cat /proc/mtd | ||
| - | dev: size | ||
| - | mtd0: 00040000 00020000 " | ||
| - | mtd1: 003c0000 00020000 " | ||
| - | mtd2: 07c00000 00020000 " | ||
| - | |||
| - | The following instructions assume that as shown above, kernel is /dev/mtd1 and rootfs /dev/mtd2. If these numbers are different on your model, appropriately change the following commands. | ||
| - | |||
| - | mtd erase /dev/mtd1 | ||
| - | mtd erase /dev/mtd2 | ||
| - | mkdir /mnt/kernel | ||
| - | mkdir /mnt/rootfs | ||
| - | mount / | ||
| - | mount / | ||
| - | |||
| - | Copy kernel & rootfs to routerboard: | ||
| - | |||
| - | scp bin/ | ||
| - | scp bin/ | ||
| - | |||
| - | Flash kernel & rootfs | ||
| - | |||
| - | mv / | ||
| - | chmod +x / | ||
| - | umount /mnt/kernel | ||
| - | cd /mnt/rootfs | ||
| - | tar -xvzf / | ||
| - | cd / | ||
| - | umount /mnt/rootfs | ||
| - | sync | ||
| - | |||
| - | Reboot | ||
| ===== When flashing doesn´t work ===== | ===== When flashing doesn´t work ===== | ||
| Line 338: | Line 279: | ||
| [[docs: | [[docs: | ||
| + | |||
| + | |||
| + | |||
| ===== Step-By-Step OpenWrt Installation Processes on Routerboard ===== | ===== Step-By-Step OpenWrt Installation Processes on Routerboard ===== | ||
| ==== With a Linux and other unix-like OS ==== | ==== With a Linux and other unix-like OS ==== | ||
| - | * [[# | + | |
| + | | ||
| * [[# | * [[# | ||
| * Connect to web interface http:// | * Connect to web interface http:// | ||
| - | * Go to " | + | * Go to " |
| * Go to " | * Go to " | ||
| * Unplug power. | * Unplug power. | ||
| * Create the following script using a text editor such as vi: vi ~/ | * Create the following script using a text editor such as vi: vi ~/ | ||
| - | Note: Don't forget to change USER, IFNAME, IP/DHCP IP-range and file name/folder path for your needs and replace openwrt-19.07-*-initramfs-* with the appropriate filename. | + | Note: Don't forget to change USER, IFNAME, IP/DHCP IP-range and file name/folder path for your needs and replace openwrt-22.03-*-initramfs-* with the appropriate filename. |
| #!/bin/bash | #!/bin/bash | ||
| Line 370: | Line 315: | ||
| --tftp-root=$(pwd) | --tftp-root=$(pwd) | ||
| - | * Copy openwrt-19.07-*-initramfs-* file to the folder where the script is located. | + | * Copy openwrt-22.03-*-initramfs-* file to the folder where the script is located. |
| * Make the script executable | * Make the script executable | ||
| Line 391: | Line 336: | ||
| * Congratulations, | * Congratulations, | ||
| - | ==== using SSH instead | + | ==== using SSH instead |
| - Pre-requisites. First, save the license key. Second, set-up the DHCP and TFTP services/ | - Pre-requisites. First, save the license key. Second, set-up the DHCP and TFTP services/ | ||
| - Connect to web interface http:// | - Connect to web interface http:// | ||
| - | - Go to " | + | - Go to " |
| - Go to " | - Go to " | ||
| - | - Unplug power, plug ethernet cable from DHCP/TFTP server to " | + | - Unplug power, plug ethernet cable from DHCP/TFTP server to " |
| - Connect ethernet cable from your PC with turned on DHCP client to port " | - Connect ethernet cable from your PC with turned on DHCP client to port " | ||
| - Establish SSH connection to root@192.168.1.1 \\ You should see OpenWrt banner. Check correct functioning of OpenWrt. \\ If you see no OpenWrt, then OpenWrt didn't boot on the router, so please check DHCP, TFTP — if these are correctly configured, then the test failed and this version of OpenWrt doesn' | - Establish SSH connection to root@192.168.1.1 \\ You should see OpenWrt banner. Check correct functioning of OpenWrt. \\ If you see no OpenWrt, then OpenWrt didn't boot on the router, so please check DHCP, TFTP — if these are correctly configured, then the test failed and this version of OpenWrt doesn' | ||
| Line 409: | Line 354: | ||
| - You first netboot an initramfs image of OpenWrt from your DHCP/ | - You first netboot an initramfs image of OpenWrt from your DHCP/ | ||
| - From that RAM-based running OpenWrt you use the web-based LuCI interface to permanently flash the appropriate sysupgrade .bin file (see above) using LuCI 'Flash image' | - From that RAM-based running OpenWrt you use the web-based LuCI interface to permanently flash the appropriate sysupgrade .bin file (see above) using LuCI 'Flash image' | ||
| - | |||
| - | Note the wget2nand utility has been deprecated in this latest release of OpenWrt since the UBI changes to the code now allow direct flashing of the NAND or NOR from the LuCI web interface. | ||
| The detailed 8 steps process below is updated to reflect the new ' | The detailed 8 steps process below is updated to reflect the new ' | ||
| Line 423: | Line 366: | ||
| - **You Are Almost There: OpenWrt is Now Running From RAM**\\ Now you have OpenWrt running in RAM on your RouterBoard. | - **You Are Almost There: OpenWrt is Now Running From RAM**\\ Now you have OpenWrt running in RAM on your RouterBoard. | ||
| - **Connect to RouterBoard ether2**\\ Unplug your Ethernet cable from ether1 and plug in to a LAN port on your RouterBoard such as ether2. Some RouterBoards do not enable all LAN ports, so you may need to experiment here. | - **Connect to RouterBoard ether2**\\ Unplug your Ethernet cable from ether1 and plug in to a LAN port on your RouterBoard such as ether2. Some RouterBoards do not enable all LAN ports, so you may need to experiment here. | ||
| - | - **Login to OpenWrt LuCI Web Interface or via SSH**\\ Use a web browser to open the OpenWrt LuCI web interface at 192.168.1.1. | + | - **Login to OpenWrt LuCI Web Interface or via SSH**\\ Use a web browser to open the OpenWrt LuCI web interface at 192.168.1.1. |
| - **Flash sysupgrade.bin Into RouterBoard**\\ Go to System-> | - **Flash sysupgrade.bin Into RouterBoard**\\ Go to System-> | ||
| Line 503: | Line 446: | ||
| Warning: once you run " | Warning: once you run " | ||
| + | |||
| + | ==== Routerboard configuration ==== | ||
| + | |||
| + | Routerboard bootloader settings are available in the Devicetree at ''/ | ||
| + | |||
| + | For example, to see the current silent-boot setting, you can run: | ||
| + | |||
| + | # cat / | ||
| + | [off] on | ||
| + | |||
| + | and to turn it on, run '' | ||
| ==== Saving MikroTik RouterBoard License key using WinBox and Windows ==== | ==== Saving MikroTik RouterBoard License key using WinBox and Windows ==== | ||
| Line 562: | Line 516: | ||
| Be sure to use Mikrotik WinBox to export your license key before installing OpenWrt. | Be sure to use Mikrotik WinBox to export your license key before installing OpenWrt. | ||
| + | |||
| + | ==== Downgrading RouterOS ==== | ||
| + | |||
| + | - [[https:// | ||
| + | - Upload the .npk file using FTP, SCP, or at http:// | ||
| + | - Run the ''/ | ||
| + | - After the device reboots, it will have donwgraded the RouterOS itself, but not the bootloader yet. To downgrade the bootloader, confusingly, | ||
| + | - Reboot and then run ''/ | ||
| + | |||
| + | ==== Manually Flashing OpenWrt with wget2nand (deprecated)==== | ||
| + | |||
| + | These instructions are deprecated since wget2nand is no longer used, but left here for reference. Note " | ||
| + | |||
| + | If wget2nand encounters problems, perform its steps manually from shell. | ||
| + | | ||
| + | cat /proc/mtd | ||
| + | dev: size | ||
| + | mtd0: 00040000 00020000 " | ||
| + | mtd1: 003c0000 00020000 " | ||
| + | mtd2: 07c00000 00020000 " | ||
| + | |||
| + | The following instructions assume that as shown above, kernel is /dev/mtd1 and rootfs /dev/mtd2. If these numbers are different on your model, appropriately change the following commands. | ||
| + | |||
| + | mtd erase /dev/mtd1 | ||
| + | mtd erase /dev/mtd2 | ||
| + | mkdir /mnt/kernel | ||
| + | mkdir /mnt/rootfs | ||
| + | mount / | ||
| + | mount / | ||
| + | |||
| + | Copy kernel & rootfs to routerboard: | ||
| + | |||
| + | scp bin/ | ||
| + | scp bin/ | ||
| + | |||
| + | Flash kernel & rootfs | ||
| + | |||
| + | mv / | ||
| + | chmod +x / | ||
| + | umount /mnt/kernel | ||
| + | cd /mnt/rootfs | ||
| + | tar -xvzf / | ||
| + | cd / | ||
| + | umount /mnt/rootfs | ||
| + | sync | ||
| + | |||
| + | Reboot | ||
| | | ||
| ===== Notes ===== | ===== Notes ===== | ||