Build Your Own Independent Phone Newtork: Part 1

In many rural regions across the world, cellular signals are very weak or inexistent at all, rendering any communication other than face-to-face impossible. This constitutes a big obstacle in most situations where a group of people needs to exchange information. Fortunately, there exists a way to overcome this problem.

Setting up your own mobile network might seem out of reach at first glance, but it is in fact very attainable with a Raspberry Pi and some specific tools. Of course, the resulting network will be limited in range as the configuration lacks any relay antenna, but it will allow you and your hypothetic team to communicate with your smartphones, either by text messages or by voice. Being able to build such a network is a tremendously valuable skill that will prove to be useful in several situations: natural disasters, large-scale protests, trips to secluded areas with no coverage…

In this post and the next one, I will describe the process of creating a Wifi access point, completely independent from any external network (cellular, the Internet…), supporting real-time chat and voice calls. The project is divided into two parts for convenience: first, a tutorial on PirateBox, the firmware that the Pi will run, followed by a walk-through on how to set up the actual network to suit our specific needs. Note that for the time being, this project only supports Android phones.


Part 1: Download, Installation, and Configuration of PirateBox


Requirements

  • Raspberry Pi (Model 3 recommended)
  • USB storage drive (32+ GB recommended)
  • microSD card and reader (16+ GB recommended)
  • Ethernet cable
  • Wireless network adapter with powerful antenna and support for monitor mode
  • Wifi router with a connection to the Internet

Downloading and Flashing PirateBox 

The root of this project is PirateBox, an offline and anonymous file-sharing portal whose firmware can be installed on routers and single-board computers, like in our case the Raspberry Pi. I recommend reading this article if you want to know more.

PirateBox will be downloaded through a BitTorrent client. The specific image for Raspberry Pi 3 can be found here. Once downloaded, we open the file with our BitTorrent client which should in turn initiate another download as shown in the image below.

The next step is to flash the PirateBox image to a microSD card. As a measure of safety, it is always a good idea to unplug any external devices from the PC before inserting the microSD card: this prevents us from flashing the image to the wrong device. We will use Etcher to perform the task, as done previously in my post on installing Kali Linux on a Pi.

After following the on-screen instructions, the image should be successfully flashed to the card. However, note that there is a small chance of failure due to an error in Etcher’s processing. If this is the case, other flashing tools can be used, like Win32 Disk Imager or ApplePiBaker.

At this stage, the SD card should contain the following files:

Initializing and Configuring PirateBox on Pi

Now that the SD card is ready, we insert it into the Pi after connecting it to a router via an ethernet cable, then power it up. The setup is most conveniently done with a laptop through an SSH connection to the Pi. The choice of the SSH client does not affect the task; I personally use PuTTY. On the laptop, we open PuTTY, select SSH port 22, and write in the host name field: alarm@x.x.x.x, where the part after the @ should be replaced with the Pi’s actual IP address – it can be found with a program like Nmap or Fing.

At this stage, the SSH connection is successfully established. If everything was done correctly, we should be prompted for login credentials. Both the username and the password are “alarm”, which highlights the importance of running the passwd command as soon as possible to change the password. This finalizes the initial setup of PirateBox on the Pi: our Wifi access point is now available and should be visible to other devices.

To test our work, we can connect to the PirateBox AP from a laptop or smartphone and try to access any webpage from a browser. We should get redirected to the PirateBox home page. The ethernet connection is not needed anymore, except for updating the firmware.

The final step is to address the issue of storage usage: we want to use an external USB drive instead of the root folder on the SD card itself. This is done using the following command:

~$ sudo /opt/piratebox/rpi/bin/usb_share.sh

Finally, we enter the appropriate password when prompted to do so. The setup and configuration are now 100% complete for the scope of this first part.

Stay tuned for the next post where we will tweak and reprogram the setup to allow for a completely independent, off-the-grid communication system. As always, for any question or remark, leave a comment below and I will be glad to help.


Comments

Popular posts from this blog

Pixie-Dust Wifi Attack: Theory & Practice

Getting started in scripting

How to capture a WPA handshake