Raspberry Router


I built myself a UMTS router. An extravagant one. Out of scotch tape and parts I found in my apartment. Here’s how.

First of all: This is not your usual router. This thing was initially built out of necessity: I had (and still have) an unlimited/uncapped mobile data plan for my tablet, which is not capable of doing wifi tethering for my phone. So as a student (read: lazy and cheap) I did not want to leave the four walls I call home dormitory just to watch Youtube videos on my phone.

This is what I had available:

  • a 512MB raspberry pi b
  • he USB UMTS modem that came free with my data plan
  • a TP-Link TL-WN722N wlan dongle
  • an old class 4 sdcard

I installed Kali Linux for the Pi on it, simply because I don’t need much, and it comes with all of the software we need for this.
Those are:

  • hostapd to create the wireless hotspot
  • dnsmasq as a simple DHCP server
  • iptables for some routing configuration
  • wvdial to connect the modem to the carrier’s network
  • USB_modeswitch, because windows. :/
  • RPi.GPIO library for the HD44780

There are plenty of tutorials on how to set up a hotspot with those tools, but I uploaded the configuration files to github.

Due to the placement of the USB ports (stacked on top of each other) I had to remove the casing of the wifi card, so I could fit both the UMTS and the wifi dongle into the Pi.
This lead to overheating whenever the network was heavily loaded (which is quite often in a flat shared by three people).

This monster was in service for a few months in this state, before I bought some short USB cables to relocate and seperate said devices.

And this is where I deviate from the usual procedure.

When visiting my hometown one day I found a Hitachi HD44780 compatible character LCD from a scrapped project and took it with me.
Initially it only displayed the SSID and :) if it was probably* working or :( if it can’t ping google.
*Spoiler: it was unreliably as hell.

But now I finished a shell script that does extensive checking:

  • is the UMTS modem still available (not overheated) and in the right mode
  • is the WLAN stick still alive
  • are the processes for hostapd, dnsmasq and my wvdial-redialler still running
  • ping

The screen still displays the SSID, but now also the numbers of clients.
If the connection test is in progress, it also shows a letter a to i while a test is in progress. And while idle, it scrolls the cursor ( _ ) from left to right, so you know the device hasn’t locked up. This can be caused by the dodgy power management of the Pi.
If a test fails, it shows an error message on the LCD and tries to fix the problem, if it is software related.

This is the end of this router for now, as it is finally working quite reliably. For the future I have planned splicing the USB power of the dongles so I don’t need to unplug them when they crap out, but just pull some GPIO pins low for a second or two.

Here is the shell script that checks for everything!