Enhance your router with OpenWRT

image of a the backside of a wireless router
(Image credit: deepblue4you)

If you think your wireless router is only good enough to dish out IP addresses to connected devices around your house, you need to infuse new life into it with the OpenWRT firmware. 

Just as you can replace the operating system on your computer and on your Android phone, you can flash a new firmware on your router as well. 

In fact, there are several embedded operating systems designed for routers, but few offer as much dexterity as OpenWRT. The open source embedded Linux distro offers a lot more options out of the box than your router’s stock firmware. Moreover it can be fleshed out though a Linux-like package management system.

screenshot of the OpenWRT dashboard showing available resources

(Image credit: OpenWRT)

Features

OpenWRT supports thousands of additional packages that you can use to add all sorts of extra functionality to your router.

For instance, Airbnb hosts can use OpenWRT to create a guest WLAN that enables access to the Internet, but not their internal network. Similarly, small businesses can use OpenWRT to set a virtual private network (VPN) based on OpenVPN or WireGuard

If your router has a USB port, you can hook up a USB disk and use it as a network attached storage (NAS), or stream content across the network. You can also connect a USB webcam for live video surveillance, or for streaming video.

While OpenWRT works with a host of routers, its developers suggest it works best with multi-core, ARM-based devices with at least 256 MB of RAM for acceptable performance for most tasks. Also, while a router without USB support can still be used as a web or application server, a USB port can extend the use of the router manifold.

image of the network interfaces on the router

(Image credit: OpenWRT)

Installation

Loading new router firmware will vary based on the make of your router. The page for your router on OpenWRT’s website will have the exact steps. 

Broadly speaking the project produces two types of images for supported routers. If you are installing OpenWRT for the first time you’ll need a Factory image. If you are upgrading from one OpenWRT version to another you need the Sysupgrade image.

Generally speaking you can flash the OpenWRT image on your router through the firmware upgrade page on its stock firmware. 

Remember however that before you flash the firmware, make sure you connect the router to your computer via an Ethernet cable. The flashing process can take a few minutes, and you shouldn’t interrupt the process. Once it’s complete, the router will automatically reboot.

screenshot showing the traffic flowing over the OpenWRT router

(Image credit: OpenWRT)

Initial configuration

Once the router has been flashed and restarted, fire up a browser on the computer connected to the router via the ethernet cable and head to 192.168.1.1, which is the default address that OpenWRT assigns to the routers.

This will bring up a login page. OpenWRT uses the root user as the default administrator, which by default doesn’t have a password. You can login and configure the router without setting a password, but OpenWRT will keep displaying a banner at the top of the administration interface to remind you to set a password, until you do so.

To set a password for the root user, log in to the administration page, and head to System > Administration. Enter a password and click the Save & Apply button to finalize the changes. 

As you might have noticed, the administration interface also has a Save button. You can use this button to save changes across multiple tabs, without committing them to the router. Once you have made all the changes, you can ask OpenWRT to commit them to the router with the Save & Apply button. 

Before proceeding further, it’s also a good idea to enable SSH access to log into your router from the terminal. While the graphical administration interface offers a lot of flexibility, some tasks take a lot less time when done from the command-line interface (CLI).

To enable SSH access, switch to the SSH Access tab from under System > Administration. Click the Add instance button to add a Dropbear instance to connect to the SSH server inside OpenWRT. You can safely leave the other settings to their default values, and click Save & Apply to bring the SSH server online.

You can now connect to the router either using the ssh command from a Linux machine, such as ssh root@192.168.1.1, or using a SSH client like PuTTY from Windows. The password will be the same as the one you’ve set for the root user.

screenshot of OpenWRT's package management system

(Image credit: OpenWRT)

Setup WiFi

The last bit of configuration that you need to do before you can play around with the interesting stuff is setting up the WiFi, which is desabled by default for security reasons. 

To allow computers in your network to connect to your OpenWRT router over WiFi, head to Network > Wireless. This page will list all the wireless radios in your router. Many modern routers have multiple routers, one for 2.4Ghz, and another for 5Ghz, but the process of setting up either is the same.

Begin by clicking the Add button corresponding to the radio you want to configure. Scroll down to the Interface Configuration section, make sure the Mode is set to Access Point, and enter the ESSID of the wireless network in the space provided. 

Then switch to the Wireless Security tab, and use the pull-down menu to select the WPA2-PSK encryption, which is what OpenWRT recommends for small/home office users. Then enter the password in the Key textbox.  

image detailing the dependencies of the OpenNDS package

(Image credit: OpenWRT)

Then switch to the Advanced Settings tab, to select the correct country code for your OpenWRT router to ensure it meets the country’s legal regulations. You can leave the other settings to their default values, or tweak them according to your needs. 

Click Save, and repeat the steps for the other radio if your router has one. When you’re done, click Save & Apply. You can now scan and connect to your router using the ESSID and the specified password. 

You can now access the OpenWRT router from any computer or device on your network. 

Conclusion

You can now flesh out your router as per your needs. One of the best things about OpenWRT is its ample documentation that have step-by-step instructions for virtually all popular tasks, such as setting up a captive portal,  configure dynamic DNS, setup a NAS, and a lot more.

Mayank Sharma

With almost two decades of writing and reporting on Linux, Mayank Sharma would like everyone to think he’s TechRadar Pro’s expert on the topic. Of course, he’s just as interested in other computing topics, particularly cybersecurity, cloud, containers, and coding.