PirateBox DIY Plug Computer
Introduction This page provides detailed instructions for how to build your own PirateBox using a plug computer and a wireless router. The newest version (0.3-3) of PirateBox now includes a shoutbox interface so that users can chat anonymously. Check out this short video demo for more info. Please post your questions, discoveries, ideas, and solutions in the PirateBox Forum
OverviewThis tutorial focuses specifically on the a Seagate Dockstar or Pogoplug (v2 - gray/pink - Pogoplug Pros not currently supported) and assumes that it will be connected to a wireless router running DD-WRT firmware. I've selected the Asus WL33GE Wireless Router because of it's small form factor. However, any router capable of supporting DD-WRT firmware will work - check out the DD-WRT router database for more info. Note: It is also possible to use PirateBox without a DD-WRT router - see this section below for more info. This version of the PirateBox system can be built for approximately US $100 (not including the case or optional battery). In fact, it can be built for much less assuming you already have some of the equipment. This hardware has been selected because of it's small form factor (and because it is relatively inexpensive). Substituting different hardware is certainly possible and, in certain cases, encouraged. If mobility is not a primary concern, you may consider using a more powerful (and larger) DD-WRT router as this will accelerate file transfer speeds. Stuff You'll NeedThis version of the PirateBox is made of the following components:
Pre-InstallationIf you are you using a brand new Dockstar or Pogoplug device, you must first update the locked uBoot boot loader with a new ulocked version that provides support for booting from USB drives. Jeff Doozan has created an easy to use script for this. This step only takes a couple of minutes - see instructions below. As an alternative, you may instead use Jeff Doozan's script to install Debian on a USB drive connected to the Dockstar or Pogoplug v2 (gray/pink). This method takes a little longer but will also install the unlocked uBoot boot loader on your device. See my Debian on the Seagate Dockstar wiki page for more info. Install unlocked uBoot Boot Loader1. Connect your Dockstar or Pogoplug device to your gateway router with an ethernet cable and plug it in. Visit your router's main administration page (e.g. 192.168.1.1) with a web browser to determine the IP address your router has assigned the Dockstar. 2. Open a terminal (Ubuntu users: Applications > Accessories > Terminal) and SSH into your plug computer: ssh root@IP_Address_Provided_By_Your_Router The default password is: stxadmin (ceadmin for Pogoplugs) 3. Install the unlocked uBoot using Jeff Doozan's script: cd /tmpwget [jeff.doozan.com]chmod +x install_uboot_mtd0.sh./install_uboot_mtd0.sh Once Jeff's script has successfully completed, you can unplug the Dockstar from power and begin the installation instructions below. Installation Instructions1. Format your USB Drive with GParted. On Ubuntu, you can install with: sudo apt-get install gparted Note: If you are using an Ubuntu Live CD, GParted comes pre-installed (System > Admin > GParted). Create the following three partitions: ext2 (500MB) (label: piratebox)swap (256MB) (no label)FAT32 (big as you like) (label: share) Note: After you finish formatting, mount the partitions by unplugging the USB Drive and plugging it back in to your computer. 2. Open a terminal on your computer and download and extract the PirateBox image into the piratebox (ext2) partition on your freshly formatted USB drive: sudo suwget --no-check-certificate https://github.com/downloads/daviddarts/PirateBox/piratebox_0.3-3.tar.gz 3. Now uncompress the file into the ext2 partition on the USB drive: tar xvpfz piratebox_0.3-3.tar.gz --strip-components 1 -C /media/piratebox 4. Exit super user and create "piratebox" directory on the /media/share (FAT32) partition: exitmkdir /media/share/piratebox 5. Navigate to piratebox directory and add the following five files to the piratebox directory: cd /media/share/pirateboxwget http://daviddarts.com/piratebox/.READ.ME.htm wget http://daviddarts.com/piratebox/.BACK.TO.MENU.htm wget http://daviddarts.com/piratebox/piratebox-logo-small.png wget http://daviddarts.com/piratebox/piratebox-logo.png wget http://daviddarts.com/piratebox/favicon.ico wget http://stackp.online.fr/wp-content/uploads/webserver.py 6. Unmount USB Drive using your file manager - Important: allow the system to "write" any extra data to the drive first before unplugging (be patient!) 7. Connect USB Drive to the back port of the Dockstar (beside the ethernet port) and connect the Dockstart to your DD-WRT router - see the DIY Tutorial on the wiki for more info. Note: If you would like to use your PirateBox with a non DD-WRT router, see this section on the wiki for instructions. 8. Start testing! Recovery System (Optional)Once you have your PirateBox up and running, you may wish to add Jeff Doozan's Recovery system to your plug device. This replaces the original Pogoplug kernel on mtd1 and the Pogoplug system on mtd2 with a more sophisticated system. Note: Before proceeding, you may need to change your PirateBox's nameserver address to match the IP address of your gateway router (the router you use to connect to the Internet). By default, the PirateBox's nameserver address is 192.168.1.1 which matches the default IP address for DD-WRT. If your gateway IP differs from this, you can change the PirateBox's nameserver address by navigating to the /etc/resolv.conf file and updating the address. Be sure to return it to 192.168.1.1 when you're done installing the Recovery System. 1. Connect your Dockstar or Pogoplug to your gateway router with an ethernet cable and power up the device. 2. Once it is up and running, SSH into the Dockstar and issue the following commands: cd /tmpwget http://jeff.doozan.com/debian/rescue/install_rescue.shchmod +x install_rescue.sh./install_rescue.sh 3. After the script has finished installing (should only take 1-2 minutes), you can shutdown the device (halt). Note: If you changed the nameserver as described above, be sure to change it back to 192.168.1.1 You can now visit the Recovery partition by unplugging your USB drive and rebooting your plug computer device (while still connected to your gateway router). Visit your router's main administration page (e.g. 192.168.1.1) with a web browser to determine the IP address your router has assigned the Recovery Partition and SSH into it: ssh root@IP_Address_of_Your_Recovery_Partition The default password is: root You can find more info about the Recovery System on Jeff Doozan's forum. Install DD-WRT on the Asus WL330GENow you'll need to install the DD-WRT Linux firmware on your router. The instructions below are for the Asus WL330GE wireless router. These instructions are a modified version of the instructions found on the DD-WRT wiki. For more info about installing DD-WRT on the Asus WL330GE, see this DD-WRT forum thread. Note: It is also possible to use PirateBox without a DD-WRT router - see this section below for more info. 1. First thing you'll need to do is install TFTP on your Ubuntu computer. Open a terminal and type: sudo apt-get install tftp NOTE: If you are using the Ubuntu Live CD, you can temporarily (lasts until your "reboot" the Live CD") install tftp by opening the Synaptic Package Manager (System > Administration > Synaptic Package Manager). Go to the "Settings" menu and select "Repositories." Put a check in the "Community-maintained Open Source Software (universe)" box and click the "Close" button. Type "tfpt" in the "Quick search" box and right click on the "tftp-hpa" check box and select "Mark for installation." Click the "Apply" button to install. NOTE: If you are using the Ubuntu Live CD, you should also temporarily install unrar as you'll need it to uncompress the Asus Utilities Pack in the next step. As per the instructions above, make sure that the "Universe" repository is selected and install the "rar" and "unrar" packages. 2. Next, download the Asus Utilities pack which includes two files (wl500g-clear-nvram.trx and wl500g-recover.trx) originally created for the Asus WL500 wireless router series but which work for the 330GE. Unrar it by right clicking on the file and selecting "Extract here." Place the two .trx files on your Desktop for easy access. 3. Then download dd-wrt.v24_micro_generic.bin from the DD-WRT Router Database (search for "asus wl330ge") and also place it on your Desktop. Change the file extension to .trx (dd-wrt.v24_micro_generic.trx) 4. Now connect your computer to the wireless router with an ethernet cable and then disable networking by right-clicking on the networking icon in the upper right of the screen and unchecking "Enable Networking." Then, set your wired networking to the static address 192.168.1.2 by using the following command (NOTE: your ethernet device may be called something other than "eth0" - if you're unsure, you can check by running the ifconfig command in a terminal). sudo ifconfig eth0 192.168.1.2 netmask 255.255.255.0 up 5. Now install the DD-WRT files. First do a Hard Reset by unplugging the router's power cord and waiting 20 seconds. Then press and hold the "Reset" button on the side of the router with a pen or paperclip and plug the router back in. Once the power light begins flashing, release the button. Ping the router to see if you have established a connection (if not, try hard resetting again): ping 192.168.1.220 You should see a series of numbers that look something like: 64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.752 ms Exit by pressing the Ctrl+C keys. Now move to your Desktop directory (this is where you placed the wl500g-clear-nvram.trx and wl500g-recover.trx files) and use tftp to transfer wl500g-clear-nvram.trx to the router (enter each command one at a time): tftp 192.168.1.220tftp> mode binarytftp> put wl500g-clear-nvram.trx Note: tftp should report a successful transfer in 10 seconds or so. Wait 2-3 minutes and then do another Hard Reset. Now use tftp to transfer wl500g-recover.trx to the router: tftp 192.168.1.220tftp> mode binarytftp> put wl500g-recover.trx tftp should report a successful transfer in 10 seconds or so. Wait 2-3 minutes and then do another Hard Reset. Now use tftp to transfer dd-wrt.v24_micro_generic.trx to the router: tftp 192.168.1.220tftp> mode binarytftp> put dd-wrt.v24_micro_generic.trx tftp should report a successful transfer in 10 seconds or so. Wait 2-3 minutes and then power cycle the router by unplugging and plugging it back in. The DD-WRT micro firmware should now be installed. 6. Now you should be able to access DD-WRT from a web browser. First, right click on your networking icon in the upper right of the screen and recheck "Enable Networking." Open a browser and navigate to http://192.168.1.1. Pick a username (root) and new password. Navigate to "Wireless > Basic Settings" and change the Wireless Network Name (SSID) to: PirateBox: Share Freely Click "Save" Configure HTTP RedirectNext we need to configure the router to automatically redirect all browser traffic to the server. 1. Connect your Dockstar to the Asus router with an ethernet cable and start both devices. Wait a few minutes and then join the PirateBox: Share Freely wireless network. Open a web browser and navigate to http://192.168.1.1 2. Take note of the IP address your router has assigned to your Dockstar (it may take a few minutes to issue an IP address - be patient) 3. Next, navigate to the "Services > Services" tab and check the "DNSMasq" and "Local DNS" buttons to "Enable." In the "Additional DNSMasq Options" add the following (NOTE: be sure to use your server's IP address): address=/#/192.168.1.121 Click "Save." 4. Now navigate to the "Services > Hotspot" tab and click "Enable" beside "HTTP Redirect." Use the following parameters: HTTP Destination IP: Your server's IP Address (mine was 192.168.1.121)<br>HTTP Destination Port: 80<br>HTTP Source Network: 192.168.1.0 (the "0" denotes the whole range of IP addresses under this address) Click "Save" and then go to the "Administration > Management" tab and click the "Reboot Router" button at the bottom of the page. Once the router is up and running, join the PirateBox wireless network from your computer and open a web browser. Try navigating to any page and you should now be redirected to the PirateBox welcome page. You should now be able to anonymously chat begin chatting or uploading and downloading files. System Enclosure and PowerThe final thing you'll want to do is put your PirateBox system inside some type of enclosure. I've used this great pirate lunch box though if you want your PirateBox to appear less threatening or conspicuous, you might consider just placing it in a backpack, large pocket, etc. The system will run on AC (110-240V) via the Dockstar's power supply or on DC via a 12V 2A battery. I've been using the Energizer XP8000 Rechargeable Power Pack which will power the system for about 5 hours. Of course, if you don't need to be mobile, a larger 12V lead acid battery would obviously give you a much longer charge. NOTE: To use the Energizer's DC 9V-12V port (marked green), you'll need to use the supplied blue cable. It's a tight fit but works just fine. To run the system on AC, I've simply drilled/dremmeled a hole in the back of the lunch box and run the cable through it. I've lined the hole with a black rubber grommet to make it appear more finished and also to protect the power cable from the sharp metal edge of the enclosure. I've affixed the Asus wireless router to the inside front wall of the lunch box with some velcro tape and connected the router directly to one of the USB ports on the Dockstar for power (the router comes with a short USB power cable). I've also drilled a small hole where the router's LED indicator lights are located. This allows users to easily determine if the system is powered up without opening the box and also makes the box look a little cooler and more finsished. The Asus WL330GE doesn't come with any external antennas and thus the antenna affixed to the outside of the box (see the pictures) is only for show. I included the antenna so that people would quickly recognize the PirateBox as a wireless device. Modding the Asus WL330GEBolsontanker posted a link on the PirateBox Forum to a great series of photos illustrating how to add an external antenna to the Asus WL330GE router. Additional InfoThe latest version of PirateBox includes a shoutbox that is based on JCW's PyShoutOut. It is powered by a Python web server that runs on port 8002. The server code and shoutbox files can be found in the /chat directory. The shoutbox web interface is currently set to refresh every 8 seconds which means there can be a short delay between posting a message and having it read by other chat clients on the PirateBox network. The refresh rate can be adjusted in the /chat/index.html file (see the exact line below) though keep in mind that setting a faster refresh rate will place additional stress on the server. At this point it is unclear how much refreshing or how many clients the server will support. interval = window.setInterval( 'refresh()', 8000 ); Using PirateBox Without DD-WRTIt is also possible to use PirateBox on a plug computer without a DD-WRT enabled router. The main disadvantage to this approach is that new users will not be automatically redirected to the PirateBox menu page (via HTTP Redirect). This means they must manually visit http://piratebox or http://piratebox.local (Linux or Mac OS X client computers) or http://IP_Address_Assigned_By_Your_Router (Windows, Linux, or Mac OSX client computers) in order to access the PirateBox web interface. In order to use PirateBox without a DD-WRT router running HTTP Redirect, the following settings must be changed. 1. The default nameserver for the PirateBox install is 192.168.1.1 - if this address differs from the IP address of the router you plan to use then you will need to update the resolv.conf file: /etc/resolv.conf 2. This version includes the [url=http://avahi.org/]avahi-daemon package[/url] which now provides Linux and Mac OS X support for non DD-WRT routers. This means you can connect your plug computer directly to any router (e.g. your home network router) and access the PirateBox web interface from any Linux or Mac OS X client computer connected to the network. Simply navigate to http://piratebox or http://piratebox.local and begin chatting and/or uploading/downloading files. Unfortunately support does not currently extend to Windows clients. In order to add Windows support, you will need to change all of the http://piratebox.local links to the IP Address assigned by your router to the PirateBox. Specifically, you will need to change the following files: /etc/init.d/piratebox_start/mnt/share/piratebox/.READ.ME.htm/mnt/share/piratebox/.GO.BACK.htm/bin/droopy PirateBox Without ChatNOTE: This tutorial was completely re-written on February 26, 2011. PirateBox now includes a shoutbox feature which allows all users connected to the PirateBox wireless network to chat anonymously with one another. Also, with the addition of a downloadable and pre-configured disk image, it is now significantly easier to install PirateBox directly onto a Dockstar or Pogoplug device. You can find the original DIY Tutorial 2 (without chat) here. |