OpenWrt on Raspberry Pi: Use Your Pi as a Router (Tutorial)
Recent Raspberry Pi models are more powerful than traditional routers, so using one in this role could be interesting. But it’s not perfect, as they’re not supported by most router software (or only in command lines). Fortunately, OpenWrt might be the solution. It’s available on Raspberry Pi with a web interface to configure everything. Let’s learn how to use it.
OpenWrt has a custom release available for all Raspberry Pi models. It can be flashed on an SD card like any other operating system. A few commands are required to configure the network on the first boot, but after that, everything can be done from the web interface.
Even if you are used to OpenWrt on a PC or traditional router, the installation process and initial configuration are quite different. So, let me guide you through the first steps until you get access to the web interface to do everything as usual.
If you’re new to Raspberry Pi or Linux, I’ve got something that can help you right away!
Download my free Linux commands cheat sheet – it’s a quick reference guide with all the essential commands you’ll need to get things done on your Raspberry Pi. Click here to get it for free!
Prerequisites: Before Installing OpenWrt
Before installing OpenWrt on your Raspberry Pi, there are a few prerequisites to keep in mind. Let me explain.
Update Your Bootloader
All Raspberry Pi models have a piece of code directly on the main board (not on the SD card) to handle the boot process. It has been frequently updated since the initial release (for example for USB and network boot support, bug fixes, etc.).
OpenWrt requires that your bootloader (the EEPROM package) is up-to-date.
This update is done automatically on Raspberry Pi OS, so if you’ve already used it (and have done the updates) on your Raspberry Pi, it’s probably already OK.
But, if you recently bought the Raspberry Pi, they recommend installing Raspberry Pi OS first, updating the EEPROM, and only then installing OpenWrt.
Here is how to check if the bootloader is up-to-date on Raspberry Pi OS:
- In a terminal, run this command:
sudo rpi-eeprom-update - It will tell you which version you have and if an update is available.

- If needed, you can then install the update with:
sudo rpi-eeprom-update -a
sudo reboot
Once done (after a full restart), you can stop the Raspberry Pi, and follow the next steps to install OpenWrt on it.
You can get answers from real experts in minutes.
Get help with your setup
Tip: Command lines can be a pain to memorize. I put the essential Linux commands on a printable cheat sheet so you don't have to keep googling them. You can grab the PDF here if you want to save some time.
Warning: Avoid Network Conflicts
As with most routers, OpenWrt will be set up with the IP address 192.168.1.1 by default on the first boot. There is a high probability that your current router is already using this IP address, which can create conflicts on your network.
If you don’t want to break anything, it’s probably better to unplug the Ethernet cable on the first boot or to create a different physical network while following this tutorial.
You can for example use a small network switch (I use this one on Amazon), plug the Raspberry Pi and your PC into it, and manually set your computer to use any IP starting with 192.168.1.X.
If you’re having a hard time with all the technical details, I can help you.
I’ve written a book to help you move from a beginner’s level to a more advanced one with Raspberry Pi (and everything that comes with it: Linux, network stuff, programming). Thousands of readers have finally become more familiar with this jargon and can now complete fun and useful projects easily.
⇒ Get your copy here.
Hardware Requirements
If you aren’t creating a separate network (especially if your main network is on the same range), you’ll need a keyboard and monitor plugged into the Raspberry Pi.
In my case, my home network starts with 192.168.222.X, so it won’t create any conflict. But I won’t be able to connect to 192.168.1.1 from my computer. So, I will change the Raspberry Pi IP address manually, with a few command lines, a keyboard, and monitor are required for this.
For your information, OpenWrt starts with a QWERTY configuration (US default) and doesn’t support any other layout. If, like me, you use something else, you might need this for the first boot:

Aside from that, you don’t need anything special.
Here’s what I’m using while testing this tutorial for you:
- Raspberry Pi: OpenWrt supports almost every board, including the newest Raspberry Pi 5.
For this tutorial, I’m using a Pi 4 with 4 GB RAM. - A good SD card: you don’t need anything fancy, the image is tiny, and the archive is less than 100 MB!
- My Raspberry Pi monitor (link to my review) with a micro-HDMI cable.
- My new favorite keyboard from Rii.
- An Ethernet cable.
That’s it, let’s see how to install OpenWrt on it now.
Install OpenWrt on Raspberry Pi
Here are the required steps to install OpenWrt on Raspberry Pi:
You might also like: The Raspberry Pi I'd actually buy today
- Download the latest image from the official Wiki.
- Flash it onto an SD card.
- Boot the Raspberry Pi.
- Configure the network interface.
- Access the web interface.
Let’s discuss how to do each of these steps in detail.
Download OpenWrt from the Official Website
The first step is to download the latest image available from the official Wiki.
On that page, find this table:

Go to the column corresponding to your Raspberry Pi model.
Click the link in the “Firmware Openwrt Install” box to download the image file.
It’s in .gz format, and there’s no need to extract it.
Flash the Downloaded Image
Once the image is downloaded, flash it onto your SD card. I use Raspberry Pi Imager for this task when I already have the image on my PC, but other tools like Balena Etcher will work just fine.
(Raspberry Pi Imager is free and can be downloaded here if you don’t have it yet.)
Bonus tip: If the terminal still feels confusing, I made a simple cheat sheet with 74 commands explained in plain English. You can grab it here for free..
If you want a clearer path than jumping from tutorial to tutorial, my book gives you a step-by-step roadmap to really understand your Raspberry Pi.
Check the book here
Here’s are the steps to flash the OpenWrt image:
Check this: Make Passive Income with Raspberry Pi
- Launch Raspberry Pi Imager and make the following selections.
- Device – select your Raspberry Pi model.
- OS – scroll down and click Use custom.
When prompted, point to the file you downloaded above.
- Storage – insert your SD card into your PC using an SD Card reader.
Select your SD card from the list. - Writing – click WRITE to begin the flashing process.

As you can see, the image is tiny (15 MB in this example), so it’ll only take a few seconds.
First Boot
Once the SD card creation is complete, insert it into your Raspberry Pi and power it on.
You’ll see a bunch of debug messages (white text on a black screen). Once it stops scrolling, press ENTER to get access to the command prompt:

If you get something similar, everything is fine, and you can move to the next step.
If the system doesn’t start, or you get an error, double-check the prerequisites (especially the EEPROM update) and feel free to visit the OpenWrt forum to ask for help.
Optional: Set the Ethernet IP Address
As mentioned previously, OpenWrt will set the Ethernet adapter to 192.168.1.1 by default.
If you connect an Ethernet cable from your PC directly to the Raspberry Pi, you should be able to access the web interface directly. If that works for you, then skip this next part.
Depending on your setup, however, you may need to change the default IP.
My network uses the subnet range 192.168.222.1-254, so I need to change it to access OpenWrt from my other devices. Or maybe 192.168.1.1 is already reserved by your primary router, so you need to set OpenWRT to use a different IP.
You can change the default IP address using these three commands:uci set network.lan.ipaddr=<YOUR_IP>
uci set network.lan.netmask=255.255.255.0
uci commit network
service network restart

Remember: the default keyboard layout is in QWERTY (US), so you might need to use the picture given previously to type these commands.
If you started with the network cable disconnected to avoid conflicts, you can now plug it in. In my case, I can now ping the Raspberry Pi over the network, so I’m ready to start configuration.
Note: In some setups, you will not be able to connect to OpenWrt if it’s sitting behind your primary router, as they both want to be the router.
The solution: connect your PC directly to your OpenWrt-Pi via an Ethernet cable.
Then you can modify the settings you need before bringing OpenWrt live.
Access the Web Interface
Now that you’ve got the OpenWrt device connected to your network, all of its configuration can be done from a web interface. So, you won’t have to use console commands anymore.
- From a PC on the same network as the Raspberry Pi, browse to the Pi’s IP address:
http://<YOUR-IP>It’s the IP you just set above, or maybe it’s 192.168.1.1 if you haven’t changed it. - The default username is root, and the password is left blank.

You’ve now gained access to the full interface of OpenWrt.
But before going any further, setting a root password is a good idea.
Set the root Password
The first step once connected to the web interface will be to set a password for root.
Go to System > Administration, and you’ll get a form looking like:

Fill in a strong password, and click Save to apply the change.
Tips to Use OpenWrt on Raspberry Pi
We’re almost done, but let me give you a few tips to use OpenWrt on your Raspberry Pi.
My goal today is not to host a masterclass on OpenWrt, but at least explain the first steps to get you started the right way.
Switch to SSH
As soon as you have set the IP address and the root password, the SSH service becomes available.
So, if in the future you need to run a few command lines on OpenWrt, it will probably be more comfortable to use your SSH client instead of typing them directly on the Pi.
You can log in with root. On most operating systems, you can use this command from a terminal:ssh root@IP

Type the password you just set, and you’ll be connected.
Check this: Don't buy a new SD card until your read this.
If you need more guidance on how to use SSH with a Raspberry Pi, click the link to read my full guide about it. It’s mostly for Raspberry Pi OS, but the principles are the same with any distribution (and I share my favorite SSH client in it).
Update System Time
When you install OpenWrt fresh, it will often have the wrong date. This misalignment can interfere with updating packages later.
Here’s how to update your system time on OpenWrt:
- Go to System > System.
- Under the General Settings tab, click either Sync with browser or Sync with NTP-Server.
You can try both for good measure.
- Wait 5-10 seconds for it to sync.
It will update your system to UTC date and time, which is a good default. - Click Save & Apply at the bottom.
Now the Local Time should be correct (don’t forget it’ll be in UTC).
Configure the DNS Server
I had many issues with the web interface at first, but I quickly identified the reason.
For example, I was getting these errors when trying to update new packages:
- Failed to download the package list from X
- opkg_download: Check your network settings and connectivity.
- Failed to send request: Operation not permitted.
That’s because we haven’t set a DNS server for OpenWrt to use, so almost everything that requires Internet access won’t work. There are 2 possible solutions here.
Solution #1: Use Custom DNS Servers
- In the web interface, go to Network > Interfaces.
- Click Edit in front of the LAN interface.
- Go to the Advanced Settings tab and find the field Use custom DNS servers.
- Fill in the address of your preferred DNS server. You can use one on the local network if you have one, or simply a public DNS server (I’m testing with 8.8.8.8, the one from Google).

- Click Save. Back on the next screen, don’t forget to hit Save & Apply.

Solution #2: Change Protocol to DHCP Client
If the above method didn’t work for you, try this one.
Usually, people will turn an OpenWrt device into a router that’s connected straight to the internet. But in my case, the OpenWrt-Pi was sitting behind another router, my primary router. This configuration caused DNS issues where OpenWrt couldn’t access the internet.
One solution is to make OpenWrt receive its DNS from your primary router. Here’s how:
- Go to Network > Interfaces.
- Click Edit.
- Under the General Settings tab, change Protocol to DHCP client.

- Click Save. Back on the next screen, hit Save & Apply.
Your Pi will reconnect to the network and receive a new IP address. You’ll have to figure out your Pi’s new IP address, since it will be randomly applied.
Once you can reconnect to the web interface, check if the internet access is working.
Go to Network > Diagnostics and click IPv4 Ping. If it works, you should get a response.

Install Add-ons
If the Internet connection is available and the DNS server is configured properly, you can now use the Software feature in the web interface to install new packages.
Bonus tip: If the terminal still feels confusing, I made a simple cheat sheet with 74 commands explained in plain English. You can grab it here for free..
The System > Software page is pretty empty by default. Click on Update lists… to sync with the repository. You should get something like:

Note: If your update fails, it’s probably because OpenWrt can’t reach the internet. To check, go to Network > Diagnostics and try to ping a domain. If pinging fails, use the methods in the sections above to fix your DNS settings.
You might also like: 25 project ideas you can try at home with Raspberry Pi
Similar to how packages work on Raspberry Pi OS and most Linux distributions, you can easily install new packages on OpenWrt from this page (we’ll use it later).
You’ll find drivers for specific devices, as well as traditional packages (that you can use in command lines) or features for the web interface. There is a search engine you can use to quickly find something here.
Enable the Wireless Interface
On my Raspberry Pi 4, there is a wireless interface, and it was detected automatically. So, you can quickly configure it and use it once you get access to the web interface.
I lost a bunch of time testing this because I was trying to configure it from the Network > Interfaces menu, but in fact, it was already there under Network > Wireless.
If you use a Raspberry Pi 4, you should have something like:

Click on “Scan” to see a list of the wireless network detected.
Click on the one you want to be connected to and fill out the form with your password:

Follow the steps in the wizard to save the configuration and get connected to your Wi-Fi.
If everything goes well, you should now see both network configurations on the home page:
You might also like: Need a clear GPIO pinout diagram? Here's mine.

It’s a pretty bad example, as I should use two different network ranges if my goal was really to build a router. But I’m just showing you how to configure the basics. After that, you’re free to change anything to fit your needs.
For example, once connected to your Wi-Fi, you can now configure the Ethernet to use a different network range, to isolate your Ethernet network from the other computers.
How to Use a USB adapter
Raspberry Pis only have an Ethernet adapter, which is not great to build a router. On some models, you have the wireless interface, but not all of them. Good news: if your case uses a USB to Ethernet adapter with OpenWrt, it’s supported!
I have one model (from a random brand from Amazon), and when I plugged it in, it was detected directly.
On the monitor, I got these messages:

Even if OpenWrt is detecting that you plugged something, it won’t necessarily have the driver installed by default (and it’s not plug & play, you’ll need to install it).
There are two things to note in the previous screenshot:
- The manufacturer is Realtek. We don’t care about the brand noted on the adapter, the important element is the network adapter manufacturer, which is generally Realtek or Intel.
- The exact model is 8153 (RTL8153).
With this info, you can go into the software installer and search for the corresponding driver. If you have a different adapter, make sure to search for your exact model.
The search engine is not perfect, though. In my case, there was no result, whatever I tried. I found online that you can use the RTL8152 driver for the 8153 model. So, I installed it, and it was then detected properly in the web interface.

But you might need to do a little bit of research to find the correct driver that is missing.
Once done, you can go to Network > Devices and you should see your USB adapter here:

Click on “Configure” to create a new interface using this network device.
Stuck on this project? Ask me or other Pi users in the RaspberryTips Community. We help each other out and you'll get answers quick. Join and fix it together.
Going Further with OpenWRT
From there, using OpenWrt on your Raspberry Pi wouldn’t be different from using it on any other device. You have access to the web interface and your hardware is properly detected (even if you use USB adapters), so you can move on and create the configuration you need.
As I told you, my goal here was to help you to get started when using a Raspberry Pi instead of a more traditional device. If you need more guidance, you can follow the official documentation or any good tutorial online, even if it’s not written for Raspberry Pi.
And if you don’t like OpenWrt and want to try the old school method (with IPTables), you can follow this other tutorial I wrote years ago, explaining how to do everything manually :-). There is also a brief introduction in it about networking in general, that might be interesting even if you do the same project with OpenWrt.
An alternative to iptables, while staying in command lines, would be to test “ufw” which stands for “Uncomplicated FireWall”. I explain everything in this article.
Not getting the same result?
Even when you follow every step, small differences in OS version, hardware or config can change the outcome. Instead of wasting time guessing, get help from people who have already fixed the same kind of issue.
- Get help on your exact issue
- Access step-by-step videos for tricky setups
- Browse the website without ads
