From Homebrew Router to OpenWRT



Last Updated:

website

I’m switching my Homebrewed Debian Router running nftables to Pi-Hole to OpenWRT.

Why?

Because I want something easier to manage. Setting up a raw Linux firewall using just nftables was cool, but feels a bit like this cobbled together mess especially after I added Pi-Hole to the mix, and I just want to try a proper router distro now.

OpenWRT

OpenWRT is mainly targeted toward embedded devices like the old router you might have laying around at home, but it can actually be installed on regular x86_64 PC Hardware too. There’s no proper installer though, you need to download an .img then dd that on to you the hard drive you want to install OpenWRT on. After that you will need to resize the root partition to fill the rest of your hard drive.

Check out the official docs here.

Installation

dd if=openwrt-21.02.0-x86-64-generic-ext4-combined.img bs=1M of=/dev/sdX and then you’re done. That’s it. Well almost, you need to expand the root filesystem. You should also probably install additional firmware.

Thankfully, resizing the root filesystem is super easy:

# Install packages
opkg update
opkg install parted
 
# Identify disk name and partition number
parted -l -s
 
# Expand root partition
parted -f -s /dev/sda resizepart 2 100%
 
# Apply changes
reboot

To resize the partition, and then:

# Install packages
opkg update
opkg install losetup resize2fs
 
# Map loop device to root partition
losetup /dev/loop0 /dev/sda2 2> /dev/null
 
# Expand root filesystem
resize2fs -f /dev/loop0
 
# Apply changes
reboot

To resize the filesystem.

Thoughts

It’s pretty cool so far. As much as I like being neckbeard commandline warrior having a GUI to easily visually everything and see who’s connected to the network and metrics is pretty nice. I also still have the TP Link router also with OpenWRT on it which I will continue to use as a WAP.