Add New Page: You are not allowed to add pages Select section/namespace. New page title.
 

Installing Commotion OpenWRT on Mikrotik Routerboard Devices

OpenWRT doesn't provide a firmware image that can be written directly to the flash memory via the firmware update system in Mikrotik's RouterOS. So installing OpenWRT (and Commotion Router) is a two step process:

  • Booting the router from a TFTP server on the local area network. The TFTP server provides an .ELF image that is loaded into the router's memory.
  • Installing a separate kernel and file system image from a webserver on the local area network (or Internet).

The OpenWRT page for the RB450G outlines this process well, and this Commotion specific guide draws upon and references it, as well as other external documentation.

Resources:

Requirements:

  • A computer that can build Commotion OpenWRT from source. Alternatively, pre-built images for this platform from the Commotion Team
    • An initramfs image for network booting the router: openwrt-ar71xx-nand-vmlinux-initramfs-lzma.elf
    • The MAC address(es) of the ethernet interface on the routerboard(s) you're installing to.
    • For permanent installation, a compressed filesystem image: openwrt-ar71xx-nand-rootfs.tar.gz and linux kernel: openwrt-ar71xx-nand-vmlinux-lzma.elf
  • A computer that has a working serial port and an ethernet interface. This computer will also need to have some kind of serial terminal software. In our testing we used screen
  • A DHCP server and a TFTP server. In our testing we used dnsmasq for both. See: TFTP/BootP Server Setup Instructions
  • A webserver to host the permanent installation files. In our testing we used lighttpd

The instructions below assume you have:

  • a linux computer running Debian. Adjustments may be needed for other linux distros or other operating systems.
  • installed dnsmasq using these instructions: TFTP/BootP Server Setup Instructions
  • installed screen to monitor your routerboard's serial console
  • a power over ethernet (POE) injector, or a power plug to provide power to the routerboard.
  • a network switch to form a local area network (LAN) to connect both the routerboard and your computer to the same Local Area Network.

Installation Instructions

Stage 1: Boot the Routerboard from the Network

First, we need to boot the router from the network. Your computer running dnsmasq gives the routerboard a DHCP lease and provides it an “initramfs” image, which is transferred to the routerboard and loaded into RAM.

Copy Initramfs Image to /tftproot/

To boot the routerboard from the network, copy the appropriate file into /tftproot/.

sudo cp ./openwrt-ar71xx-nand-vmlinux-initramfs-lzma.elf /tftproot/

Configure dnsmasq to serve the copied file

In /etc/dnsmasq.conf add a link for the routerboard you wish to netboot. You'll need to know the MAC address of the ethernet interface on the routerboard. Here's what we added in our test of the Mikrotik RB411AH:

dhcp-host=d4:ca:6d:a5:84:73,192.168.10.101

You also need to tell dnsmasq what file to serve over the network by adding this line:

dhcp-boot=/tftpboot/openwrt-ar71xx-nand-vmlinux-initramfs-lzma.elf

Now restart dnsmasq just for good measure:

sudo service dnsmasq restart

If it restarts with no errors, you're ready for the next step.

Setup Serial Port Monitor

  • If you haven't installed screen, install it using this command:
    sudo apt-get install screen
  • Connect your serial port cable to your PC and to the routerboard.
  • The RB450G serial interface uses 8N1 with hardware flow control at 115200 bps.
  • We utilize a serial to USB converter which is available to linux at /dev/ttyUSB0. Your serial device may be at a different location.
  • After plugging in the serial cable, enter the following command in a new terminal window.
    sudo screen /dev/ttyUSB0 115200 -A
  • Upon issuing this command, the terminal window will clear and look blank. Leave this window open during the entire installation process
  • To confirm the serial console output is working, connect the POE to the routerboard. You should begin to see text in the terminal window showing the routerboard's boot process.

Boot the RB411AH/RB450G from the local network

  • Connect the LAN port of your POE injector to the switch that is connected to your computer.
  • Connect the POE port of the injector to the routerboard and switch over to the serial console termina. At this point, you should begin seeing the routerboard's boot process in your serial console terminal.
  • As the device boot, there will be a prompt to enter the bootloader menu. Press any key to access it. If you miss it, disconnect and reconnect the power to the routerboard to start over.
  • The bootloader menu looks like this:
    What do you want to configure?
      d - boot delay
      k - boot key
      s - serial console
      o - boot device
      u - cpu mode
      f - cpu frequency
      r - reset booter configuration
      e - format nand
      g - upgrade firmware
      i - board info
      p - boot protocol
      t - do memory testing
      x - exit setup
  • Select o - boot device and then select 1 to boot once from the network, and then boot from the nand after that.
  • Select x to exit setup.
  • The RB450G will reboot. Let the bootloader menu time out.
  • Your computer should give the Routerboard a DHCP lease, recognize its MAC address and the device will boot from the file hosted in /tftproot/
  • If it does not boot from the network, re-check your configuration in /etc/dnsmasq.conf and look at the messages in /var/log/syslog to diagnose th issue
  • Assuming the device booted from the network, you should see the Commotion text banner and command prompt.
  • If you need to troubleshoot, see the OpenWRT wiki for more detail: http://wiki.openwrt.org/toh/mikrotik/rb450g#boot.the.rb450g.from.the.network

Installing Commotion to Permanently to the Routerboard's NAND Flash

At this point, your routerboard is running Commotion in memory. To permanently install Commotion to the device's NAND flash, you must have a webserver running where the kernel and filesystem images are hosted. In our testing, we used the same machine to netboot the routerboards and provide files for installation using a local webserver, lighttpd.

Install Lighttpd

This command will install the small webserver, lighttpd.

sudo apt-get install lighttpd

Lighttpd's default website is hosted at /var/www. Once it's running, you should be able to see its default webpage by entering your computer's IP address into a web browser.

Copy Install Files into /var/www

After network booting, the device uses a special program called wget2nand to install the kernel and filesystem onto the device. These files need to be hosted by your webserver.

Copy these files into /var/www :

  • openwrt-ar71xx-nand-vmlinux-lzma.elf
  • openwrt-ar71xx-nand-rootfs.tar.gz

Install Commotion OpenWRT

Back in your serial console terminal, use the following command to install Commotion to the routerboard's NAND Flash. This assumes that your computer's IP address is 192.168.10.1 :

wget2nand http://192.168.10.1/

If successful, your serial console should display information indicating that the device is being flashed, and eventually it will reboot.

Once the device is rebooting, you can use the commands below to turn off dnsmasq and lighttpd:

sudo service dnsmasq stop
sudo service lighttpd stop

When the router has completely rebooted, it will provide your computer with a DHCP lease. Note that you may need to change your wired port settings from the static IP that you set before to receive an address from a DHCP server.

For more information, see: http://wiki.openwrt.org/toh/mikrotik/rb450g#install.the.openwrt.distribution

Upgrading

Upgrading the RB411 and RB450G requires re-flashing with an updated kernel and filesystem image, as described above using the wget2nand script in /sbin/ You cannot use (or build) a sysupgrade image to update through Commotion Router's web interface like other routers we support.

  1. Obtain updated installation image and kernel files and host them using lighttpd or your local webserver of choice as described above
  2. Connect your local webserver to the node and obtain an IP address from it. Note your server's IP address provided by DHCP.
  3. Log into the node over ssh: ssh root@<node IP address>
  4. Run wget2nand to flash the updated files onto the node: wget2nand http:<your servers IP address/ - Reboot the node, exit, and proceed with configuration after your machine receives an IP address. note: this upgrade procedure is in testing. It may be necessary to completely reinstall using the full procedure described above. ===== Configuring Commotion ===== At this point, Commotion is ready to be configured. Once you have a lease from the router, go to http://thisnode in a web browser to access the Commotion Setup Wizard.