Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| toh:mikrotik:common [2019/06/07 20:23] – [Long read] change list numbering and some language corrections patrickocean | toh:mikrotik:common [2024/11/03 16:16] (current) – Clarify misleading routeros version restriction base258 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Common Procedures for Mikrotik | + | ====== Common Procedures for MikroTik |
| This page describes common procedures across MikroTik RouterBoard routers. If you edit / add information about a specific model, please consider linking to this page to avoid repeating common instructions. | This page describes common procedures across MikroTik RouterBoard routers. If you edit / add information about a specific model, please consider linking to this page to avoid repeating common instructions. | ||
| + | |||
| + | <WRAP alert> | ||
| + | OpenWrt is not compatible with the bootloader of RouterOS **v7**. Do NOT upgrade the firmware on your device to RouterOS **v7** or, if you did, downgrade to RouterOS Firmware **v6** before installing OpenWrt. | ||
| + | RouterOS doesn' | ||
| + | versions up to 6.49.10 or beyond. Confirmed working: 6.47.10 (tested on SXTsq 5 ac), 6.49.10 (tested on SXTsq 2nD). | ||
| + | </ | ||
| - | ===== Overview of OpenWrt installation ===== | + | ===== Overview of OpenWrt installation: TL;DR ===== |
| **TL;DR** | **TL;DR** | ||
| - | - Save the license key of RouterOS and (optional) | + | - (optional) |
| - | - Boot router via network boot (DHCP/TFTP) for testing. OpenWrt isn't installed now, it's working from a RAM image. If it doesn' | + | - 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' | ||
| - If all right, write OpenWrt into flash of the router, then reboot. | - If all right, write OpenWrt into flash of the router, then reboot. | ||
| - Tuning OpenWrt. | - Tuning OpenWrt. | ||
| - | **Long read** | + | ===== Overview of OpenWrt installation: |
| RouterBoards can netboot OpenWrt initramfs .elf (.bin in some instances) images via TFTP. This RAM-based initramfs OpenWrt image is first used to validate the desired OpenWrt version operates properly without overwriting any existing image in the NAND or NOR flash of the RouterBoard. | RouterBoards can netboot OpenWrt initramfs .elf (.bin in some instances) images via TFTP. This RAM-based initramfs OpenWrt image is first used to validate the desired OpenWrt version operates properly without overwriting any existing image in the NAND or NOR flash of the RouterBoard. | ||
| Line 22: | 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' | ||
| - | Save your license by using Mikrotik WinBox: it's under System-> | ||
| - | [[#Saving MikroTik RouterBoard License Key Without Using WinBox|See below]] for other methods | + | |
| + | * [[#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 | ||
| + | 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 36: | 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 41: | 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. | ||
| - | ==== Downloading OpenWrt images ==== | ||
| - | Images for the latest OpenWrt image can be downloaded from https:// | + | Note: MikroTik' |
| - | Most OpenWrt supported Routerboards are Atheros-based hardware: in that case, after selecting | + | |
| - | For example, | + | |
| - | + | ||
| - | After the commit of [[https:// | + | ==== Downloading OpenWrt |
| - | This wiki has been updated to reflect this simplifying change used in OpenWrt Version 18 for the Mikrotik RouterBoards.\\ | + | |
| - | Please refer to older versions of this wiki for instructions on using older releases of OpenWrt such as Chaos Calmer, Barrier Breaker, Attitude Adjustment, etc. | + | |
| + | The latest OpenWrt images can be downloaded from [[https:// | ||
| 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. | + | |
| - | * Size and type (NAND vs. NOR) of flash on the RouterBoard | + | |
| <WRAP leftalign round info 60%> | <WRAP leftalign round info 60%> | ||
| Line 65: | 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.\\ | + | ==== Netboot |
| - | The above [[toh: | + | |
| - | ^ Flash Size | + | Routerboards contain the Mikrotik RouterBoot netboot bootloader that will boot over the network and run an OpenWrt initramfs |
| - | ^ ::: | + | |
| - | | 16 MB NOR | rb-nor-flash-16M | + | |
| - | | ::: | ::: | + | |
| - | | 64 MB NAND | nand-64m | + | |
| - | |128 MB NAND (or larger) | nand-large | + | |
| - | |::: | ::: | + | |
| - | Refer to the OpenWrt [[toh:views: | + | === Mikrotik RouterBoot Boot Protocol: either BOOTP or DHCP === |
| + | The RouterBoard | ||
| - | <WRAP leftalign round important 60%> | + | - BOOTP Boot Protocol |
| - | If you add packages to your installed version | + | * Is the default boot protocol |
| - | For example, if you decide | + | * Not as commonly supported by DHCP/ |
| - | </WRAP> | + | * OpenWRT may be booted via BOOTP on all RouterBoard devices. |
| + | | ||
| + | * Not the default boot protocol of RouterBoards. | ||
| + | * Most DHCP/BOOTP/TFTP servers support this protocol. | ||
| + | * Not all versions of RouterBoot may boot OpenWRT using DHCP. | ||
| - | <WRAP leftalign round important 60%> | + | === Run a DHCP/BOOTP/TFTP netboot |
| - | 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 https:// | + | |
| - | </ | + | |
| - | ===== Step-By-Step OpenWrt Installation Process on Routerboard ===== | + | |
| - | ==== TL;DR: simple way for all supported models ==== | + | |
| - | - Pre-requisites. First, save the license key. Second, set-up the DHCP and TFTP services/daemons on server/router/PC to netboot | + | |
| - | - Connect to web interface http:// | + | |
| - | - Go to " | + | |
| - | - Go to " | + | |
| - | - Unplug power, plug ethernet cable from DHCP/TFTP server to " | + | |
| - | - 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' | + | |
| - | - If OpenWrt boots OK \\ '' | + | |
| - | - Next, to flash OpenWrt, run following command in the SSH session: \\ '' | + | |
| - | - Already establish SSH connection to root@192.168.1.1 (you may need to remove the line with " | + | |
| - | ==== Long read ==== | + | Various TFTP servers for various OS are documented [[: |
| - | Installing and upgrading OpenWrt on a RouterBoard is basically just a couple steps: | + | To comply with the DHCP/ |
| - | - You first netboot an initramfs image of OpenWrt from your DHCP/BOOTP/TFTP server into the RAM of the RouterBoard. | + | |
| - | - 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. | + | == On Linux or other unix-like OS using dnsmasq == |
| - | The detailed 12 step process below is updated to reflect | + | * Create |
| - | To install OpenWrt (works on all OpenWrt supported RouterBoards, | + | 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. |
| - | | + | |
| - | | + | IFNAME=enp1s0 |
| - | - If you use '' | + | /sbin/ip addr replace 192.168.1.10/24 dev $IFNAME |
| - | - **Download a DHCP/BOOTP/TFTP Server**\\ Download a DHCP/ | + | /sbin/ip link set dev $IFNAME up |
| - | * If you are instead wanting to re-install RouterOS (rather than install OpenWrt), download a copy of NetInstall from the Mikrotik website. | + | / |
| - | - **Download PuTTY and Connect Serial COM Port (Optional)**\\ The serial COM port will allow you to see/change activity on the RouterBoard console. Download a copy of PuTTY to your Windows PC so you can open a terminal window on the serial COM port of the RouterBoard. | + | --no-daemon \ |
| - | - If you use '' | + | --listen-address 192.168.1.10 \ |
| - | - If you didn't do this earlier, **run Mikrotik WinBox to Export RouterOS License File (Optional: So you can re-install Mikrotik RouterOS at a later date, if needed)**\\ With existing RouterOS running on your RouterBoard, | + | --bind-interfaces \ |
| - | - **Change PC to Static IP 192.168.1.10**\\ Now reconfigure your PC Ethernet to a static IP at 192.168.1.10 (this address is handy so you don't have to change your IP address in subsequent steps). | + | -p0 \ |
| - | - **Connect to RouterBoard ether1**\\ Connect your Ethernet cable to ether1 port of the RouterBoard, | + | --dhcp-authoritative |
| - | - **Run DHCP/ | + | --dhcp-range=192.168.1.100,192.168.1.200 \ |
| - | * If you are instead wanting to re-install RouterOS, run Mikrotik' | + | --bootp-dynamic |
| - | - **Force RouterBoard to Netboot**\\ Unplug the RouterBoard power jack, press its reset button, and plug the RouterBoard power back in while continuing to press the reset button. | + | --dhcp-boot=openwrt-19.07-*-initramfs-* \ |
| - | | + | --log-dhcp |
| - | | + | --enable-tftp \ |
| - | - **Login to OpenWrt LuCI Web Interface**\\ Use a web browser to open the OpenWrt LuCI web interface at 192.168.1.1. | + | --tftp-root=$(pwd) |
| - | - **Flash sysupgrade.bin Into RouterBoard**\\ Go to System-> | + | |
| - | Once you have OpenWrt running, you'll probably want to reset your PC's Ethernet back to DHCP instead of the ' | + | * Make the script executable |
| - | ===== Netboot of OpenWrt Uses DHCP/ | + | |
| - | Routerboards contain the Mikrotik RouterBoot netboot bootloader that will boot over the network and run an OpenWrt initramfs file. The initramfs file is a single file with the whole OpenWrt package: kernel plus filesystem. A RouterBoard has at least three flash partitions: bootloader, kernel and ubi. The MikroTik bootloader is preserved even after OpenWrt is installed into NAND or NOR flash. | + | $ chmod +x loader.sh |
| - | === Mikrotik RouterBoot Boot Protocol: either BOOTP or DHCP === | + | * Copy openwrt-19.07-*-initramfs-* file to the folder where the script is located. |
| - | The RouterBoard RouterBoot supports two different boot protocols when netbooting a RouterBoard: | + | * Run script loader.sh as root |
| - | | + | |
| - | * Is the default boot protocol of RouterBoards. When using bootp, there is no need to reconfigure the RouterBoards using serial port: you can just force netboot directly using the RouterBoard Reset button. | + | |
| - | * Not as commonly supported by DHCP/BOOTP/TFTP servers. | + | == On Linux or other unix-like OS with a generic |
| - | - DHCP Boot Protocol | + | |
| - | * Not the default boot protocol of RouterBoards | + | |
| - | * Most DHCP/ | + | |
| - | ==== Select | + | |
| - | Select any of the following choices | + | Copy openwrt-19.07-*-initramfs-* file to your TFTP server location. Set up your BOOTP server to point to your [[: |
| - | If using Choice 2 or 3, you will need a local copy of the ' | + | |
| - | wget -c https:// | ||
| - | ln -s openwrt-18.06.1-ar71xx-mikrotik-vmlinux-initramfs-lzma.elf openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf | ||
| - | Choice 1 assumes you are running from a Windows | + | === On Windows |
| - | Choice 2 and 3 assume you are running from Linux. The Linux choices expect the initramfs file to use the above specific name ' | + | |
| - | === Netboot Server Choice | + | Reconfigure your PC Ethernet to a static IP at 192.168.1.10 |
| - | The freeware Tiny PXE software | + | The freeware |
| - | Select the initramfs file as the Boot file Filename, un-check the gPXE or iPXE Filename option, select the Option 54 IP address for the ethernet cable you have connected to the RouterBoard, | + | Select the OpenWrt |
| if you have problems running Tiny PXE, you may need to turn off your firewall, run Tiny PXE as administrator, | if you have problems running Tiny PXE, you may need to turn off your firewall, run Tiny PXE as administrator, | ||
| It is especially important to ensure only one DHCP/ | It is especially important to ensure only one DHCP/ | ||
| - | === Netboot Server Choice 2 - Generic DHCP/ | ||
| - | |||
| - | Copy openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf to your TFTP server location. Set up your DHCP server to point to your TFTP server as the next-server and to that file as the bootfile. | ||
| - | |||
| - | === Netbook Server Choice 3 - dnsmasq === | ||
| - | |||
| - | To use dnsmasq: | ||
| - | |||
| - | * Copy openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf to ~/ | ||
| - | * Create the following script using a Linux editor such as vi: vi ~/ | ||
| - | |||
| - | #/bin/bash | ||
| - | ifconfig eth0 192.168.1.10 up | ||
| - | sudo dnsmasq -i eth0 --dhcp-range=192.168.1.100, | ||
| - | --dhcp-boot=openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf \ | ||
| - | --enable-tftp --tftp-root=~/ | ||
| - | |||
| - | If your shell don't set the environment variable $USER, please replace it with your user name. | ||
| - | Run script loader.sh | ||
| ==== Methods to set RouterBoard so it will TFTP netboot ==== | ==== Methods to set RouterBoard so it will TFTP netboot ==== | ||
| Line 186: | Line 154: | ||
| 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 readily | + | 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.\\ |
| - | However, if you have chosen to use a DHCP/ | + | However, if you have chosen to use a DHCP/ |
| When a boot protocol is set in RouterBoot, it is remembered: any of the methods here that force a netboot will then use the BOOTP or DHCP boot protocol previously selected in RouterBoot. | When a boot protocol is set in RouterBoot, it is remembered: any of the methods here that force a netboot will then use the BOOTP or DHCP boot protocol previously selected in RouterBoot. | ||
| Line 199: | Line 167: | ||
| 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 207: | Line 175: | ||
| - 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 217: | Line 185: | ||
| To enable a netboot using the serial COM port: | To enable a netboot using the serial COM port: | ||
| - Connect the COM port to a system (terminal server, PC). Set baud to 115200, 8 bits, no parity, 1 stop bit, no flow control. | - Connect the COM port to a system (terminal server, PC). Set baud to 115200, 8 bits, no parity, 1 stop bit, no flow control. | ||
| - | - Open a terminal window (can use software such as PuTTY on Windows | + | - Open a terminal window (can use software such as PuTTY to open a terminal window connected to the COM port). If RouterOS or OpenWrt are running you should have an interactive shell. |
| - Reboot the RouterBoard (unplug power, wait a couple seconds, plug back in). | - Reboot the RouterBoard (unplug power, wait a couple seconds, plug back in). | ||
| - Observe “Press any key within 2 seconds to enter setup”. Press a key in the terminal window. | - Observe “Press any key within 2 seconds to enter setup”. Press a key in the terminal window. | ||
| Line 224: | Line 192: | ||
| - Exit from the RouterBoot setup menu to begin the netboot: press ' | - Exit from the RouterBoot setup menu to begin the netboot: press ' | ||
| - | More information at: http:// | + | More information at: [[http:// |
| === Method 3 - Use a running RouterOS to enable TFTP netboot === | === Method 3 - Use a running RouterOS to enable TFTP netboot === | ||
| Line 233: | Line 201: | ||
| - System → Routerboard → Settings → Boot device: Try ethernet once then NAND | - System → Routerboard → Settings → Boot device: Try ethernet once then NAND | ||
| - | - System → Routerboard → Settings → Boot protocol: DHCP | + | - System → Routerboard → Settings → Boot protocol: DHCP (if BOOTP don't supported in your DHCP server) |
| - System → Routerboard → Settings → Force Backup Booter: Checked (if supported by your routerboard - !IMPORTANT) | - System → Routerboard → Settings → Force Backup Booter: Checked (if supported by your routerboard - !IMPORTANT) | ||
| Save | Save | ||
| - | Reboot routerboard | + | Shutdown RouterBoard and next turn power off and on (don't reboot because |
| - | + | ||
| - | === 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. | + | |
| | | ||
| - | ===== Flash OpenWrt | + | ==== Flash OpenWrt ==== |
| After the DHCP/ | After the DHCP/ | ||
| Line 274: | Line 229: | ||
| 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. | + | ==== When flashing doesn´t work ==== |
| - | + | ||
| - | 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. | + | === Problems with bad blocks === |
| - | mtd erase /dev/mtd1 | + | If you got problems while flashing because of (supposed) bad blocks, you could try to use the netinstall-tool from mikrotik |
| - | mtd erase /dev/mtd2 | + | |
| - | mkdir / | + | |
| - | mkdir / | + | |
| - | mount / | + | |
| - | mount / | + | |
| - | + | ||
| - | Copy kernel & rootfs | + | |
| - | + | ||
| - | scp bin/ | + | |
| - | scp bin/ | + | |
| - | + | ||
| - | Flash kernel & rootfs | + | |
| - | + | ||
| - | mv / | + | |
| - | chmod +x / | + | |
| - | umount / | + | |
| - | cd / | + | |
| - | tar -xvzf / | + | |
| - | cd / | + | |
| - | umount / | + | |
| - | sync | + | |
| - | + | ||
| - | Reboot | + | |
| + | It will reduce the number of bad blocks. [[https:// | ||
| + | There is also a nice netinstall-howto [[https:// | ||
| | | ||
| - | ===== Initial setup ===== | + | ==== Initial setup ==== |
| - | ==== LEDs ==== | + | === LEDs === |
| Check if the LEDs light up according to their desired functions (eg: under RouterOS). LED configuration is found in / | Check if the LEDs light up according to their desired functions (eg: under RouterOS). LED configuration is found in / | ||
| - | ==== Understanding/ | + | === Understanding/ |
| By default, OpenWrt tries to set up wired/ | By default, OpenWrt tries to set up wired/ | ||
| Line 331: | Line 257: | ||
| ethN.M is a VLAN on a switched ethernet. | ethN.M is a VLAN on a switched ethernet. | ||
| | | ||
| - | ==== Serial console | + | === Serial console === |
| If you solder the UART pins on the board, you can enable the serial console, adding this line to / | If you solder the UART pins on the board, you can enable the serial console, adding this line to / | ||
| Line 337: | Line 263: | ||
| ttyS0:: | ttyS0:: | ||
| | | ||
| - | ==== Disable silent-boot mode on RouterBOOT bootloader | + | === Disable silent-boot mode on RouterBOOT bootloader === |
| [[https:// | [[https:// | ||
| Line 351: | Line 277: | ||
| [[docs: | [[docs: | ||
| + | |||
| + | |||
| + | |||
| + | ===== Step-By-Step OpenWrt Installation Processes on Routerboard ===== | ||
| + | ==== With a Linux and other unix-like OS ==== | ||
| + | * Plug an ethernet cable between the router port 2 and your computer. | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * Connect to web interface http:// | ||
| + | * Go to " | ||
| + | * Go to " | ||
| + | * Unplug power. | ||
| + | * 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-22.03-*-initramfs-* with the appropriate filename. | ||
| + | |||
| + | #!/bin/bash | ||
| + | USER=user | ||
| + | IFNAME=enp1s0 | ||
| + | /sbin/ip addr replace 192.168.1.10/ | ||
| + | /sbin/ip link set dev $IFNAME up | ||
| + | / | ||
| + | --no-daemon \ | ||
| + | --listen-address 192.168.1.10 \ | ||
| + | --bind-interfaces \ | ||
| + | -p0 \ | ||
| + | --dhcp-authoritative \ | ||
| + | --dhcp-range=192.168.1.100, | ||
| + | --bootp-dynamic \ | ||
| + | --dhcp-boot=openwrt-19.07-*-initramfs-* \ | ||
| + | --log-dhcp \ | ||
| + | --enable-tftp \ | ||
| + | --tftp-root=$(pwd) | ||
| + | |||
| + | * Copy openwrt-22.03-*-initramfs-* file to the folder where the script is located. | ||
| + | * Make the script executable | ||
| + | |||
| + | $ chmod +x loader.sh | ||
| + | |||
| + | * Run script loader.sh as root | ||
| + | |||
| + | # ./loader.sh | ||
| + | |||
| + | * Plug ethernet cable from DHCP/TFTP server to " | ||
| + | * In the terminal you ran the script from, wait until you read " | ||
| + | * Kill the script (Ctrl + c). | ||
| + | * [[#Flash OpenWrt]] | ||
| + | * Connect ethernet cable from your PC with turned on DHCP client to port " | ||
| + | * Connect to web interface http:// | ||
| + | * Check correct functioning of OpenWrt. | ||
| + | * Go to System-> | ||
| + | * Click on ' | ||
| + | * Click on 'Flash image' | ||
| + | * Congratulations, | ||
| + | |||
| + | ==== using SSH instead of LuCI ==== | ||
| + | |||
| + | - Pre-requisites. First, save the license key. Second, set-up the DHCP and TFTP services/ | ||
| + | - Connect to web interface http:// | ||
| + | - Go to " | ||
| + | - Go to " | ||
| + | - Unplug power, plug ethernet cable from DHCP/TFTP server to " | ||
| + | - 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' | ||
| + | - If OpenWrt boots OK \\ '' | ||
| + | - Next, to flash OpenWrt, run following command in the SSH session: \\ '' | ||
| + | - Already establish SSH connection to root@192.168.1.1 (you may need to remove the line with " | ||
| + | |||
| + | ==== Detailed Steps ==== | ||
| + | |||
| + | Installing and upgrading OpenWrt on a RouterBoard is basically just a couple steps: | ||
| + | - 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' | ||
| + | |||
| + | The detailed 8 steps process below is updated to reflect the new ' | ||
| + | |||
| + | To install OpenWrt (works on all OpenWrt supported RouterBoards, | ||
| + | |||
| + | - **Download both OpenWrt files**\\ Download the two OpenWrt files to your PC: the initramfs file (initramfs.elf, | ||
| + | - If you didn't do this earlier, **save the RouterOS License File (Optional: So you can re-install Mikrotik RouterOS at a later date, if needed).**\\ If you run '' | ||
| + | - **[[# | ||
| + | - **[[# | ||
| + | * If you are instead wanting to re-install RouterOS, [[https:// | ||
| + | - **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. | ||
| + | - **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-> | ||
| + | |||
| + | Once you have OpenWrt running, you'll probably want to reset your PC's Ethernet back to DHCP instead of the ' | ||
| + | |||
| + | |||
| ===== Additional procedures ===== | ===== Additional procedures ===== | ||
| Line 358: | Line 375: | ||
| If your model is not yet supported by trunk, you need to download compile and patch OpenWrt sources. Always check if the model specific wiki instructions could already be obsolete and the necessary patches have already been integrated before embarking into compilation. | If your model is not yet supported by trunk, you need to download compile and patch OpenWrt sources. Always check if the model specific wiki instructions could already be obsolete and the necessary patches have already been integrated before embarking into compilation. | ||
| - | Full instructions are at [[:doc:howto:buildroot.exigence]] The following is a mostly a cheat sheet specifically for routerboards. | + | Full instructions are at [[docs:guide-developer:toolchain:install-buildsystem|Build system – Installation]]. The following is a mostly a cheat sheet specifically for routerboards. |
| OpenWrt sources are available via two release management systems, svn and git. If the model specific instructions specified one, use that, otherwise use git (faster). | OpenWrt sources are available via two release management systems, svn and git. If the model specific instructions specified one, use that, otherwise use git (faster). | ||
| Line 425: | Line 442: | ||
| 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 ==== | ||
| + | |||
| + | See [[http:// | ||
| + | |||
| + | With existing RouterOS running on your RouterBoard, | ||
| + | |||
| + | If you cannot connect to the RouterBoard RouterOS on a LAN port, try resetting the RouterBoard to its default settings: that will ensure you can connect using the ether1 port. Reset the RouterBoard to its default settings by unplugging power, press the Reset button, then plug power back in and continue holding the Reset button for 5 seconds. Now set your PC to a static IP address of 192.168.88.10. Move your Ethernet cable to the ether1 (usually WAN) port on the RouterBoard and get WinBox at 192.168.88.1 | ||
| + | |||
| + | If you have an old version of RouterOs/ | ||
| ==== Saving MikroTik RouterBoard License Key Without Using WinBox ==== | ==== Saving MikroTik RouterBoard License Key Without Using WinBox ==== | ||
| Line 430: | Line 468: | ||
| It's a good idea to save your RouterOS license .key file (export your license) before starting an install of OpenWrt. | It's a good idea to save your RouterOS license .key file (export your license) before starting an install of OpenWrt. | ||
| - | A simple method is to use the Mikrotik WinBox Windows application, | + | A simple method is to use the Mikrotik WinBox Windows application, |
| Otherwise, boot RouterOS and export the key to a file: | Otherwise, boot RouterOS and export the key to a file: | ||
| < | < | ||
| Line 449: | Line 486: | ||
| Copy contents, alternative 3: download files from web interface. Example | Copy contents, alternative 3: download files from web interface. Example | ||
| < | < | ||
| + | |||
| + | Copy contents, alternative 4: download files via scp. Example | ||
| + | < | ||
| The differences between the obtained key file and a key exported with Winbox are that the // | The differences between the obtained key file and a key exported with Winbox are that the // | ||
| Line 472: | Line 512: | ||
| 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 ===== | ||
| - | ==== Patchworks | + | === Patchworks === |
| - | Router model specific pages may refer to http:// | + | Router model specific pages may refer to [[http:// |
| - | The new patch server is https:// | + | The new patch server is [[https:// |
| - | ==== Rumors | + | === Rumors === |
| - | Some wiki pages claim that parallel compilation with -j N mail fail OpenWrt build. This seems not to be a problem for >= 14.07 and AR71XX builds as for RouterBoards, | + | Some wiki pages claim that parallel compilation with -j N may fail OpenWrt build. This seems not to be a problem for >= 14.07 and AR71XX builds as for RouterBoards, |
| Some wiki pages claim that you need to put paths into the OpenWrt build tree into your .bashrc so that compilation works correctly. This does not seem to be the case anymore. No problems encountered. | Some wiki pages claim that you need to put paths into the OpenWrt build tree into your .bashrc so that compilation works correctly. This does not seem to be the case anymore. No problems encountered. | ||
| - | ==== Links ==== | + | === Links === |
| [[https:// | [[https:// | ||