Some days ago I bought a TpLink MR3020 with the objective to create a pirate box and experience this kind of solution. I already tried to do a stuff like this some month ago based on a netgear wifi router having the capability of sharing usb storage. But the system was not easily portable and not extensible.
The proposed solution, based on this low cost router is an interesting opportunity to made the solution mobile.
Some basic information to understand How OpenWr / PirateBox work
After playing with this PirateBox installation procedure and being unlucky multiple time, I can deliver some information on how the system is built. which can help you to understand faster and avoid some troubles.
Once flashed with OpenWRT the TL-MR3020 system have different layers, the first one is a readonly filesystem loaded in /rom and mapped to / . This file system contains all the needed elements to run the OpenWRT with a size of 4MB. This is what you flash during the installation process.
Another filesystem mounted in /overlay and also mapped to / is used as a second layer to have a RW space on top of the /rom filesystem content. It allows to create and modify configuration files, to add application not part of the initial imagefile. The size of this filesystem is really small with 1.5MB and do not allow to install anything on the system. The risk is to fill the entire space and no being able to use correctly the device.
To work correctly, the PirateBox adds another storage space to extends filesystem. This layer is installed on the USB Stick you are providing during the installation process. An image file is created on the memory stick and mounted as /mnt/ext. For this reason, if you change the usb stick you must copy all the files to the new stick to get the PirateBox software installed and work. The size of this extension is not especially limited but created initially with a specified size of 19MB. This device is mapped to loop0.
The last special directories are /var and /tmp both located in the same tmpfs. In fact these directories are created in the RAM memory. As the device provides 32MB of RAM memory, 14MB are allocated to these directories. This space is used when installing PirateBox for example to download the packages but also for application runtime. The content is lost when the device is rebooting.
How to access / reset your PirateBox
After making lots of change on my system, I finished to get it unworkable. To reset the system to the defaut, you need sometime to access the failsafe mode. The procedure is the following one :
1 . Switch the mode selection to AP (AP/WISP/3G switch)
2. Click on WPS and keep is clicked
3. Power up the MR3020
4. As soon as the WPS led blink slowly (2/s), change the switch to 3G mode
5. The WPS led strats blinking fastly
6. Now you can telnet the MR3020 on IP 192.168.1.1
7. You need to mount the /overlay directory to clean it up
8. Clean /overlay
rm -rf /overlay/*
9. Switch back to WISP mode then Restart the device
How I installed my PirateBox
Before proceeding the installation you need to have a USB stick to be used as a storage drive but also needed to proceed the piratebox installation. I assume it is better to start directly with a large drive and as much as possible a small (in terms of physical dimension) stick. For my testing purpose I only have a large one (in term of size) but a small one in terms of capacity… I’ll explain later how to change it…
Before installing, ensure that http://daviddarts.com/ website is accessible. The installation process try to connect to that site and when down (as in my case), it can create some trouble.
To proceed the installation I followed the perfect tutorial found here in french as it is my native language. This tutorial seems also interesting and better. Be careful, this did not work correctly for me, so here is what I think we must do, based on the modification I had to do after:
- Follow steps 1 to 8 concerning the openwrt installation and password setting.
- Change network configuration :
config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0' config interface 'wan' option ifname 'eth0' option type 'bridge' option proto 'static' option ipaddr '10.0.0.31' option netmask '255.255.255.0' option gateway '10.0.0.254' list dns '10.0.0.254' config interface 'lan' option ifname 'eth0' option type 'bridge' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option gateway '10.0.0.254' list dns '10.0.0.254'
Interface wan is the interface connected to your local network and able to connect to internet
Interface lan is used by piratebox and its setting is changed during the installation. using it as you Internet interface may cause trouble later.
3. Change the firewall settings as indicated in the step 11 in the tutorial
4. Do not proceed this : Install missing packages
opkg update opkg upgrade luci
5. Do not proceed this : Start uHttpd server
/etc/init.d/uhttpd enable /etc/initd/uhttpd start
6. Do not proceed this : At this step you should be able to see a web page typing the Ip adress in your browser
7. Install USB modules
opkg update opkg install kmod-usb-uhci insmod usbcore insmod uhci opkg update opkg install kmod-usb-ohci insmod usb-ohci
8. Insert the Fat32 formated USB stick
9. ensure you are able to ping daviddarts.com
10. Install piratebox
cd /tmp /tmp$ wget http://cr.23bit.net/piratebox/piratebox_0.2-5_all.ipk /tmp$ opkg update && opkg install piratebox*
10. Check that Ip Address in /etc/config/network has been switch back to 192.168.1.1, otherwise, do it as this configuration is repeated in multiple files by the installation process. Using another IP would make the PirateBox not working.
In case you need to reinstall your PirateBox
I had to re-flash my PirateBox due to some trouble during installation related to the non accessibility for the daviddarts website. To proceed this reinstallation of the OpenWrt Firmware, it is not still possible to use the integrated web interface.
To erase all the settings done, simply erase the /overlay directory
rm -rf /overlay/*
Then reboot the system and restart the installation procedure as if the system was just flashed.
Once Internet is reconfigured you can also re-flash the system by using the following command :
cd /tmp wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin sysupgrade -n *.bin
How to Upgrade to PirateBox 0.5
When you installed the first version of piratebox and you want to uprade, you need first to clean the existing configuration once connected to the piratebox :
rm -rf /overlay/*
Then you need to clean the usb stick with you laptop and, once rebooted, to reconfigure the network as described previously.
Then upgrade the firmware, You can do this by connect to the piratebox the execute the following command:
cd /tmp wget http://piratebox.aod-rpg.de/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin sysupgrade -n *.bin
Then you have to reconnect on IP 192.168.1.1 using telnet and recreate the network config
Reconfigure the USB modules
insmod uhci insmod usb-ohci
Install PirateBox 0.5.1
cd /tmp wget http://piratebox.aod-rpg.de/piratebox_0.5.1_all.ipk opkg update && opkg install piratebox*
/opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf imageboard
Change ADMIN_PASS and secret in vi /opt/piratebox/www/board/config.pl
Original Tutoral : http://wiki.daviddarts.com/PirateBox_DIY_OpenWrt
MR3020 OpenWRT wiki page : http://wiki.openwrt.org/toh/tp-link/tl-mr3020