Building a freedom-friendly wifi pocket-router

Installing and configuring operating systems on single-board computers can be painful when there is no nearby ethernet connection available. A pocket-router that provides wired internet access over an existing wireless network can help here. In this article, I discuss why I decided to build one myself and describe the particular steps conducted. Moreover, I also present measures regarding performance and power consumption.



Reinventing the wheel is usually a bad idea. Therefore, I first looked for a ready-made wifi router that would meet my expectations:

  • the device should be as small as possible
  • the device should run only free firmware and software that is actively supported
  • it should be easy to configure the device on-the-go
  • the device should require low power and no dedicated wall plug (ideally it should be powered from an USB port of the “device-under-installation” or from a small power bank)
  • powering off the device should be safely possible by just pulling the power connector

With such high expectations set, it might not come as a big surprise that it was hard to find such a device. The closest match I came across was the “Free Software Wireless-N Mini VPN Router” from Thinkpenguin [1]. Unfortunately, I did not find a local retailer for this device. In addition, with just 16 megs of MTD flash and 64 megs of RAM this device is rather limited in terms of resources (but luckily not endangered in losing upstream support at the moment).

Since I had plenty leftover parts from other projects anyways, I decided against buying more stuff and for taking the self-building path. Another argument pro building such device yourself is that are a later free to easily switch hardware if you find that you require more performance.


I selected the following hard- and software from my home inventory:

  • Xunlong OrangePi Zero [2] with small plastic case
  • old microSD card (even ancient cards with just 512 MB of storage would suffice)
  • Atheros-based USB-Wifi dongle with ath9k chipset such as [3]
  • OpenWRT [4] - this article is based on version 19.07.2

Please note that while the OrangePi Zero already provides on-board wifi, I decided against using it because (1) it requires non-free firmware, (2) it is not officially by OpenWRT, and, (3) performance and driver support seemed quite poor to me.

Ignoring the OrangePi Zero's onboard-wifi, I am not aware of any non-free firmware or other binary blobs that would be required to operate the selected hardware. Therefore, it should also be possible to use LibreCMC instead of OpenWRT. Since LibreCMC does not provide any binary builds for this platform, I decided to stick with OpenWRT.

I would like to stress that there is absolutely no need to use the described hardware. If you already have an arbitrary single-board computer that is supported by OpenWRT and a compatible wifi dongle you should be perfectly fine. However, depending on the particular hardware, you might need to slightly adapt some of the described steps.

For the installation itself, you need some additional equipment:

  • a serial console (USB-TTL)
  • a computer capable of using the serial console to connect to the pocker-router
  • a terminal emulation program such as picocom [5]
  • a web browser
  • a LAN port in your router/firewall that serves IP addresses via DHCP and provides internet access


All data and information provided in this tutorial is for informational purposes only. The author makes no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this tutorial and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis.

In no event, the author will be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this tutorial.

Step 1: Installing OpenWRT

First of all, locate the OpenWRT image for your hardware using their website. Make sure to use the squashfs image and not the ext4 variant because otherwise your device will later lack the ability to be safely unplugged without additional steps.

The next step is to retrieve the particular OpenWRT image, check its hashsum and unpacked it. This is how it looked like on my OrangePi Zero:

sha256sum openwrt-19.07.2-sunxi-cortexa7-sun8i-h2-plus-orangepi-zero-squashfs-sdcard.img.gz
gunzip openwrt-19.07.2-sunxi-cortexa7-sun8i-h2-plus-orangepi-zero-squashfs-sdcard.img.gz

Now, the image can be written to an sdcard that is is connected to your computer (replace /dev/sdX by the actual device):

dd if=openwrt-19.07.2-sunxi-cortexa7-sun8i-h2-plus-orangepi-zero-squashfs-sdcard.img of=/dev/sdX bs=1M

Finally, take out the sdcard and you you should be ready for the next step.

Step 2: Adding USB wifi support

With the microSD card inserted, hook up the serial console to your pocket-router, start the terminal emulation program on the connected computer and attach the power connector to the pocket-router. You should see OpenWRT boot up. This is how it looked like in my case:


OpenWRT is optimized for size. Therefore, support for USB wifi devices is not enabled by default and requires the installation of additional packages. This is where things get a little tricky if your device device has only one ethernet port like mine. In this case, OpenWRT will configure the only ethernet port to be the LAN side of the network - leaving you without a WAN connection in the first place. Adding hardware such as USB ethernet adapters does not help since drivers for such devices are also missing from the default installation.

To install additional packages, we need to reconfigure the ethernet port temporarily to be used as WAN port via the serial console. Therefore, edit /etc/config/network and uncomment the whole LAN section. The resulting LAN section should look like this:

#config interface 'lan'
#        option ifname 'eth0'
#        option proto 'static'
#        option ipaddr ''
#        option netmask ''
#        option delegate '0'

With the LAN section neutralized, add a WAN configuration:

config interface 'wan'
       option ifname 'eth0'
       option proto 'dhcp'

And restart the network:

service network restart

Connect the ethernet port of your pocket-router to a any LAN port that provides internet access (typically the “normal” router you already use). Inspect the output of ip a and make sure you have internet access e. g. by using the ping command. With internet access established, we can update the package lists and download the modules required for our usb wifi dongle.

opkg update
opkg install kmod-ath9k-htc
opkg install wpa-supplicant

(If you want to use a wifi dongle with a different chipset, please replace the kmod-ath9k-htc package in the previous step acoordingly.)

Finally, revert the configuration changes (remove or comment the added wan section and uncomment the lan section) and restart the network once more:

service network restart

Step 3: Configuring the WAN side

The remaining steps are easy and should be self-explanatory for anyone who has setup OpenWRT to use the wifi as WAN connection before:

  • Connect your computer to the pocket-router and open OpenWRT's web-based configuration page in your browser by pointing it to the URL of the administration page (
  • Log in using the empty password and make sure you set a new, strong password.
  • Navigate to “Network” -> “Wireless”. You should see at least one radio device here.
  • Click on the topmost “radio0” device and hit “Scan” to search for wireless networks.
  • Click on the button “Join netwoprk” next to the network you want to use.
  • Check the box “replace wireless configuration” and provide the connection parameters (typically your WPA passphrase).
  • hit “Submit” and then “Save” in the following screen.
  • Hit “Save & Apply”.

That's it! You can now unplug the your pocket-router from its power line and disconnect the serial console. Plug your new pocket-router to the LAN port of your “computer-to-be-installed”, connect power (a USB port should be sufficient) and enjoy internet access!


To check whether the pocket-router behaves as expected I conducted a few basic measurements.


The pocket-router is fully operational in less than 34 seconds (measured: from plugging in to getting the first ping response from a system on the WAN side).

To measure performance, I ran a speedtest using the service provided by nPerf [6] from a Lenovo Thinkpad X200 connected to the pocket-router. The “real” wifi router that provides 802.11n wireless service was located about 10 meters away in a different room with one wall inbetween. The speedtest reported a transfer speed of 46 MBit/s and a latency of 15 ms.

Power consumption

The pocket-router takes a little less than 1.5 Watts in idle mode (WAN and LAN connected but no traffic):


Under full load (when running a speed test) the power consumption did not increase when measuring downstream traffic. However, when uploading data, power consumption increased to around 2.5 Watts:


Final thoughts

A self-built pocket-router like the device described in this article can be quite handy - not only for my original use case. Building one yourself with OpenWRT is easy except for downloading the required packages when using a device that has just one LAN port. I hope that this article provided some help with that. Feedback is highly appreciated!


(The providers of these resources are solely responsible for them - see legal notice).


(Comment features are provided by external parties and are not monitored by me.)

Join the discussion on Mastadon (external resource)