Meraki - OpenWRT/Kamikaze


Introduction

Besides the default Linux that comes installed on the Meraki, it is possible to flash the Meraki with OpenWRT/Kamikaze. You should examine the version of Linux that comes with the Meraki since it may satisfy your needs.

Preparing To Flash

There are several methods to flash the Meraki, but the simplest and quickest is using a Windows-based program called EasyFlash ( website ). There is a Linux version Thank you Steve for bringing this to my attention! Now we have another method for flashing!. You will also need WinPcap a packet capturing program with a builtin TFTP server ( website ). Finally, you will need for either Winblows or Linux these two files kernel image and the rootfs image. Other images can be found at the OpenWRT website.

Flashing (Windows)

A FYI, I found that some virus-scanning and firewall programs will interfere with the operation of WinCap/EasyFlash. You may have to disable some of these programs on your Windows-based PC if you have difficulties making them work properly.

First, install WinPcap. Next, install and launch EasyFlash. Make sure to disconnect the power adapter from the Meraki before launching EasyFlash.

Select the kernel and rootfs images. Select the network device and click "Go!" When you start to see the "No packet" message scrolling down the main window, plug the power adapter into the Meraki.

Go get something to eat and drink ... take a little nap ... as EasyFlash does its magic.


Flashing (Linux - Debian)

Just as in the windows case, the environment has to be fairly perfect for ap51-flash to work properly. I couldn't get it to run on Redrat/CentOS-based PCs, but it does run on some flavours of Debian.

After downloading ap51-flash and the two images (rootfs and kernel), simply issue the following command:

ap51-flash <interface> <rootfs image> <kernel image>

After issuing the command, plug the power adapter into the Meraki. Just as in the Windows version, this process will take about twenty minutes, YMMV.
    Thanks to Fred, I added this pseudo-time frame

First three lines
immediately
after launch
Next four lines
once router has
been recognized
(appears ~10 sec)
Next five lines
will appear if the
router is being
flashed properly
(on screen for ~7 mins)
Next three lines
for the kernel
(on screen for ~6 mins)
Last two line once
flashing has completed
The router will now reboot
  % ./ap51-flash eth1 openwrt-atheros-2.6-root.jffs2-64k openwrt-atheros-2.6-vmlinux-sm.gz
Reading rootfs file openwrt-atheros-2.6-root.jffs2-64k with 1703936 bytes...
Reading kernel file openwrt-atheros-2.6-vmlinux-sm.gz with 1048576 bytes...
rootfs(0x006a0000) + kernel(0x00100000) + nvram(0x00000000) sums up to 0x007a0000 bytes
Peer MAC: 00:18:0a:01:47:06
Peer IP : 192.168.84.1
Your MAC: 00:ba:be:ca:ff:ee
Your IP : 192.168.84.0
Setting IP address...
Loading rootfs...
Sending rootfs, 3328 blocks...
Initializing partitions...
Flashing rootfs...
Loading kernel...
Sending kernel, 2048 blocks...
Flashing kernel...
Setting boot_script_data...
Done. Restarting device...
%

After Flashing (all)

When the flashing process terminates (in Windows the EasyFlash window will automatically close), telnet to the Meraki (You will need to open a Command Prompt window in Windows to use telnet). It may take a few minutes before you will be able to telnet to the Meraki. The default address should be 192.168.1.1. If you are successful, issue a passwd command and change the root password. This will also disable telnet and enable ssh. Finally, you will need to reboot the Meraki. It will create its ssh keys during this reboot.

Once it has finished rebooting, you can ssh to the Meraki. The default address should still be set to 192.168.1.1.



About OpenWRT/Kamikaze

Basic Configuration Information

This is the way OpenWRT/Kamikaze partitions the Meraki.
        Filesystem                Size      Used Available Use% Mounted on
        /dev/mtdblock1            6.6M      1.8M      4.8M  27% /
        none                     14.6M     16.0k     14.6M   0% /tmp
        tmpfs                   512.0k         0    512.0k   0% /dev

This is a list of startup scripts for OpenWRT/Kamikaze.
        /etc/init.d# ls -l
        -rwxr-xr-x    1 root     root         1448 Sep 20  2007 boot
        -rwxr-xr-x    1 root     root          242 Sep 29  2007 cron
        -rwxr-xr-x    1 root     root         5282 Sep 29  2007 dnsmasq
        -rwxr-xr-x    1 root     root          243 May 10  2007 done
        -rwxr-xr-x    1 root     root         1176 Sep 29  2007 dropbear
        -rwxr-xr-x    1 root     root         3852 Sep 29  2007 firewall
        -rwxr-xr-x    1 root     root          245 Sep 29  2007 httpd
        -rwxr-xr-x    1 root     root          346 Jul 24  2007 network
        -rwxr-xr-x    1 root     root          121 May 10  2007 rcS
        -rwxr-xr-x    1 root     root          123 May 10  2007 sysctl
        -rwxr-xr-x    1 root     root          297 Sep 29  2007 telnet
        -rwxr-xr-x    1 root     root           99 May 10  2007 umount
        -rwxr-xr-x    1 root     root          154 May  7  2007 usb

There are some configuration files in /etc/config that are used during startup. The IP address and hostname can be assigned here.
        root@OpenWrt:/etc/config# ls -l
        -rw-r--r--    1 root     root          145 Sep 29  2007 dhcp
        -rw-r--r--    1 root     root           68 Sep 29  2007 dropbear
        -rw-r--r--    1 root     root          956 Sep 29  2007 firewall
        -rw-r--r--    1 root     root          291 Jul  2  2007 network
        -rw-r--r--    1 root     root           41 Jan  1 00:04 system
        -rw-r--r--    1 root     root          247 Jan  1 00:02 wireless

Available Commands

The Meraki uses busybox which has many of the basic UNIX commands. A complete list of busybox commands and their website can be found here.


Commands on The Meraki

A list of the various commands available in OpenWRT in /bin is listed below:
        ash        fgrep      mount      sleep
        cat        firstboot  mv         sync
        chgrp      grep       netmsg     tar
        chmod      gunzip     netstat    touch
        chown      gzip       pidof      true
        cp         ipcalc.sh  ping       uci
        date       kill       ping6      umount
        dd         ln         ps         uname
        df         lock       pwd        vi
        dmesg      ls         rm         zcat
        echo       mkdir      rmdir
        egrep      mknod      sed
        false      mktemp     sh

Available in /usr/bin:
        [            env          mesg         test
        [[           expr         mkfifo       time
        arping       find         nc           top
        awk          free         nslookup     tr
        awx          head         passwd       traceroute
        basename     hexdump      printf       uniq
        bunzip2      hostid       reset        uptime
        bzcat        id           scp          wc
        clear        ipkg         seq          wget
        crontab      killall      sort         which
        cut          killall5     ssh          xargs
        dbclient     length       strings      yes
        dirname      less         tail
        dropbearkey  logger       tee
        du           md5sum       telnet

Available in /sbin. The commands in bold are not a symlink to busybox.
        halt          logread       switch_root
        hotplug-call  lsmod         sysctl
        hotplug2      mount_root    syslogd
        ifconfig      mtd           udevtrigger
        ifdown        pivot_root    udhcpc
        ifup          poweroff      usb-storage
        init          reboot        vconfig
        insmod        rmmod         watchdog
        klogd         route         wifi

Available in /usr/sbin. The commands in bold are not a symlink to busybox.
        80211stats     dnsmasq        iwspy
        athchans       dropbear       madwifi_multi
        athctrl        httpd          pppd
        athkey         iptables       rdate
        athstats       iwconfig       telnetd
        brctl          iwgetid        wlanconfig
        chroot         iwlist
        crond          iwpriv

  This material is based upon work supported by the National Science Foundation under grants #0435454 and #0454432, and the NSF Graduate Research Fellowship Program. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.