The home router project

Share on:

Why a DYI home router ?

My internet access is currently Internode ADSL2+ using a TP-Link modem and and Airport Extreme that takes care of PPPoE, firewall, WiFi (and some 1GB switch ports) and a Sipura device to get VoIP. The National Broadband Network will soon be deployed in my area using HFC (cable TV).

This should give greater speed (although being close to the exchange I get around 18Mbps) and less dropout (old house = old cabling = 1-2 dropouts everyday). BUT NBN HFC requires the use a Huawei HG659 in order to connect and get VoIP services.

I quite like having some control on my internet access (especially considering the security track record of Huawei and others ) so I started to research what I could do …

Whirpool Forums suggests that I could use my existing router as long as I can set the VLAN to 2. It is confirmed by my ISP : HFC: Ethernet WAN (with 802.1q VLAN 2)

Unfortunately, Apple’s Airport Extreme like lots of consumer oriented devices have no VLAN feature.

First roadblock, because I quite like this little device …

I can still use the Airport Extreme as a WiFi AP and Gigabit switch by using it in bridge mode but I now need a router and this is how it started.

Options

I could just use the Huawei HG659 I hear you say …

As I said not a big fan of those devices and secondly, where’s the fun in that ! :)

Moreover, articles like this one on codinghoror.com picked my fancy in suggesting that basic x86 PCs with a bit of opensource are working wonders.

Software Options

  • a flavor of Linux
  • pfSense
  • OpendBSD

I selected OpenBSD. pfSense is nice but the upcoming 2.5 version will mandate AES-NI CPU instructions which means lots of old hardware or low end CPUs (some Pentiums/Celeron) will not be supported.

Any version of Linux would be just fine, I just like the simplicity of OpenBSD and the secure by default approach.

Hardware Options

  • AliExpress mini PC with low power CPU, dual NICs, 4-8GB RAM and some SSD storage
  • eBay old Small Form Factor PC or Thin Client
  • reuse an old HP 8530p laptop

MiniPC are around AUD$200 and I would need to wait for delivery. Same for eBay regarding delivery but more upgrade options on configuration as I could use the PCIe x16 slot to put a quad NIC and convert the box as a switch as well as a home router.

Thin Client PC offers low power usage, even smaller form factor and can be comverted in general purpose computers

I also got tempted to build something bigger to build a Nutanix CE server but that wouldn’t pass the WAF (Wife Acceptance Factor) just yet …

I decided to do a proof of concept using The HP laptop … yes it’s circa 2008 with an Intel Core2Duo CPU, 4GB of RAM and a 250GB spining rust HDD but that will cost nothing as a proof of concept.

Well almost nothing as it only as a single NIC so I’ll need to add a USB Ethernet adapter. Luckily OpenBSD has plenty of options I can also replace the HDD with a 600GB Intel S3500 SSD spare I’ve got.

OpenBSD Install steps

Preparation

OpenBSD has a few installation options. My preference is for the “USB boot + network install” :

  • Download miniroot61.fs (61 being for OpenBSD 6.1). Good thing that Internode has a OpenBSD mirror … downloads are unmetered !!
  • Prepare the USB media. In the spirit of legacy hardware, I found a 8MB USB thumb drive … 8MB. dd if=miniroot61.fs of=/dev/rdisk3 bs=1m on my macOS (Disk Utility shows the disk number, just use rdisk and the number) and we’re set
  • Set BIOS options (No EFI as the 8530p warns that it’s experimental and disable all that is not required)
  • Boot from USB

Installation

OpenBSD is quite simple and straightforward, I started with :

  • Whole disk with auto-layout
  • root and additional user set
  • DHCP (static to come later) on Intel onboard NIC
  • no games or X server (xbase and xshare are OK)
  • HTTP install from Internode’s mirror

Even on this old laptop, this was completed in no time

First boot and setup

OpenBSD includes some documentation in what to do after the first boot : man afterboot I started by updating the OS : syspatch

OpenBSD comes with most things working out of the box but I started to receive some warnings about temperatures. Then the laptop started to turn itself off. sysctl was showing some interesting temp stats (sysctl hw or sysctl hw.sensors). A bit of research indicated that I needed to tune APM, OpendBSD doco shows :

# rcctl enable apmd
# rcctl set apmd flags -A
# rcctl start apmd

-A is for performance and on this 8530p that meant no CPU scaling (lowering the frequency when CPU is idle), so I changed it to -C. Seems to be running cooler and no more temp alerts so far …

Next up, configure the laptop to run with the lid closed : sysctl machdep.lidsuspend=0 (there’s also a BIOS option to set)

Todo - Change font on console

If you have a nice enough GPU (the HP laptop as an old ATI Radeon that qualifies as “good enough”), console switches to a higher resolution display.

Looks nice but I’m not convinced by the serif font …

Todo - buy a USB Ethernet dongle on eBay

8530p only has USB 2 so probably just a 10 / 100 adapter.

Might need to check if a USB 3 Gigabit adapter might work (AUD $20 on eBay) …

That TP-Link UE300 looks interesting.

Todo - Configure DNS caching

Todo - Configure PF

Todo - Configure Squid caching

Todo - experiment with VMM/Alpine Linux/Docker

Todo - upgrade laptop to SSD

Todo - setup VPN gateway

Todo - set em0 NIC to VLAN 2 for NBN HFC