What is OpenWrt?
Tweaking router options is a definitive way to get the most out of your router, whether it’s a brand new TP-Link Archer C7 or the beaten-down Netgear N750 you left in your attic and forgot about years ago. For the past few years, the tinkerer’s choice of firmware has been OpenWrt.
OpenWrt is a tiny Linux installation that runs on your router and it can breathe new life into your old device by giving it some commendable features like letting it run block ads throughout your LAN, transform your router into a WiFi extender, shape traffic on your network, act as a NAS device and much more.
How Do I Get Started?
Installing the stock OpenWrt is a breeze. Just head over to the Supported Devices page and check if your device is compatible by going it through the Hardware List.
Take this file and flash through your Router’s Admin Interface. For most users, this should be fine, this stock firmware has enough features for most things, but if you’re a power user or you have a router with limited memory (I had only 4M
), then you may run into problems.
The problem with the lower end devices is that their memory is so small that they won’t let you install more than a couple of packages through opkg
or the luci
interface before you start getting errors saying that your device has run out of space. To make matters worse, opkg
is horrendous at handling crashed package installs, leaving partially installed files dangling without a means for cleanup.
But, don’t give up just yet. There is a relatively simple thing you can do to install the packages you want without a higher-end router burning a hole in your wallet.
Building a Custom OpenWrt Image from Scratch
Building a personalized version of the OpenWrt firmware lets you fine tune which pre-installed packages you want. This allows you to get rid of the bloat and install only those packages you need. Even on my 4M
memory TP-Link WR841N I was able to install about 5 or 6 additional packages before I started running out of space, which was more than enough for my needs. Okay then, let’s get started.
NOTE: To build OpenWrt you need either a Linux or MacOS system.
- Install all the dependencies that we would need for
make
during the build.
For Ubuntu 18.04# apt-get update # apt-get install sudo time git-core subversion build-essential gcc-multilib libncurses5-dev zlib1g-dev gawk flex gettext wget unzip python
For Arch Linux
# pacman -Syu subversion asciidoc bash bc binutils fastjar flex git gcc util-linu intltool make cdrkit openssl patch perl-extutils-makemaker rsync sdcc unzip wget gettext libxslt boost bin86 sharutils b43-fwcutter sudo libunistring
- Clone the latest OpenWrt master branch and navigate to it.
$ git clone https://github.com/openwrt/openwrt.git $ cd openwrt
- Update the package definitions in feeds.conf to the latest versions.
$ ./scripts/feeds update -a
- Install symlinks for packages in package/feeds/
$ ./scripts/feeds install -a
- Configure the custom firmware for packages you need through the
make
menu.$ make menuconfig
- Set the
Target System
to the one specified in your router’s hardware page. - If you have a low-end router then you might want to set the
Subtarget
todevices with low flash
. - Next, your
Target Profile
needs to be the exact model of your router. - Leave the rest of the configurations alone and just select the packages you need from the
luci
,Extra packages
,Network
,Utilities
andAdministration
sections. - Some packages that I would recommend are
adblock
,SQM
, and the correspondingluci
packages.
- Set the
- Save your configuration and run
make
. This will take a couple of hours depending on your CPU. - When the build process is complete, you can find your firmware as a
bin
file in thetargets
folder of thebin
directory. - Take this firmware file and flash it through your Router Admin page or through
ssh
, and there you have it, a fully featured OpenWrt router without splurging on an expensive router.