0% found this document useful (0 votes)
9 views

How to protect your home network with a Raspberry Pi firewall

This document provides a comprehensive guide on setting up a network-wide firewall using a Raspberry Pi and OpenWrt to enhance home network security. It details the necessary equipment, installation steps for the OpenWrt firmware, and configuration of firewall settings through the LuCI web interface. The guide emphasizes the importance of firewalls in protecting against cyber threats while also suggesting additional security measures like antivirus software.

Uploaded by

Warren Mack
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

How to protect your home network with a Raspberry Pi firewall

This document provides a comprehensive guide on setting up a network-wide firewall using a Raspberry Pi and OpenWrt to enhance home network security. It details the necessary equipment, installation steps for the OpenWrt firmware, and configuration of firewall settings through the LuCI web interface. The guide emphasizes the importance of firewalls in protecting against cyber threats while also suggesting additional security measures like antivirus software.

Uploaded by

Warren Mack
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

 Log in

Home  Raspberry Pi

How to protect your home network with a Raspberry Pi firewall


Here's how you can configure a network-wide firewall with your Raspberry Pi

BY AYUSH PANDE PUBLISHED 1 DAY AGO

With an abundance of malware on the Internet, securing your network is more crucial than ever. Setting up a
firewall is a great way to protect all your computing devices from network-based cyberattacks. For the
uninitiated, a firewall refers to a security tool that utilizes rules and policies to filter traffic and prevent external
threats from compromising your system.

Ad

If you have a Raspberry Pi, you can set up a network-wide firewall on the palm-sized SBC with the help of
OpenWrt. This process can be slightly cumbersome for a newcomer, so we’ve compiled a thorough guide to

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 1/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

help you protect your home network with this miniature device.
Link copied to clipboard

RELATED
Ad
Raspberry Pi 5 review: The holy grail of DIY projects got even better (and rarer)

What you’ll need


For obvious reasons, you'll need a Raspberry Pi as the foundation of this project. Although I used a Raspberry
Pi 5 when creating this guide, you can follow along on older RPi boards. A blank microSD card is also needed,
though you can go for a cheap 1GB card because the OpenWrt operating system doesn't take up a lot of space.

Ad

Since OpenWrt requires you to connect your Raspberry Pi to both your router and PC, you’ll need access to two
Ethernet ports. Unfortunately, all mainline Raspberry Pi boards are only equipped with a single RJ45 socket, so
you’ll have to purchase a USB-to-Ethernet adapter.

Raspberry Pi 5

$60 at Adafruit

$60 at CanaKit

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 2/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

Link copied to clipboard


SanDisk 256GB Ultra microSDXC card Ad

$25 at Amazon

TP-Link USB to Ethernet Adapter


$13 $15 Save $2

$13 at Amazon

Flashing the OpenWrt firmware


OpenWrt, or Open Wireless Router, is an operating system that offers plenty of settings to customize your
network. It’s also the easiest way to make a Raspberry Pi-flavored firewall for your home network.

1. Start by heading to Balena Etcher’s official website and downloading the portable version of the app.

2. Open OpenWrt’s firmware selector web page, choose your Raspberry Pi model from the list and click on the DOWNLOAD
(SQUASHFS) button.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 3/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

If you’re rocking an older Raspberry Pi board, you can also switch from the nightly Snapshot build to a more stable version of
Link copied to clipboard
OpenWrt. Ad
3. Run the Balena Etcher executable app as an admin.

4. Click on Flash from file and choose the SqashFS firmware image before selecting the Open option.

5. Click on Select target, pick the microSD card where you want to flash the image, and hit the Select button.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 4/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

Link copied to clipboard


Ad

6. Press the Flash button and wait for Balena Etcher to write the OpenWrt files on the microSD card.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 5/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

Link copied to clipboard


Ad

Ad

Launching the LuCI web interface


Unlike most of our Raspberry Pi projects, where you switch to the SBC to view the output, you can access the
network settings via OpenWrt’s LuCI interface from the web browser of your PC.

1. Using the Ethernet-to-USB adapter, connect your Raspberry Pi to your router.

2. Plug one end of the second Ethernet cable in your Raspberry Pi's RJ45 socket and the other end into your PC's RJ45 port.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 6/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

3. Power on your Raspberry Pi.


Link copied to clipboard
Ad
4. Head back to your PC and launch the LuCI interface by typing the following address into your web browser:

192.168.1.1

5. Enter root as the Username and Password and click on Login.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 7/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

Link copied to clipboard


Ad

6. Once the web interface boots up, it’s a good idea to set a secure password by clicking on the Go to password configuration…
option.

7. Select the Save button after entering your new password.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 8/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

Link copied to clipboard


Ad

Ad

Configuring the firewall via OpenWrt


With OpenWrt’s web interface now ready to use, you can tweak the firewall settings to your heart’s content.
There are mutliple firewall options available on OpenWrt, but we'll only go over three of the most important
sections.

1. Hover your cursor over the Network tab and click on Firewall.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 9/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

2. On the General Settings page, you can tweak the input, output, and zone forwarding settings for individual zones and zone
Link copied to clipboard
pairs. You can also add new zone rules, and toggle the Drop invalid packets and Enable SYN Flood Protection options from
Ad
this tab.

3. If you want remote devices to be able to access your home network, you can also navigate to the Port Forwards tab.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 10/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

Link copied to clipboard


Ad

Once you're there, select the Add button and enter the Name, External port, and other settings for the new port forwarding
rule.

4. Finally, you can modify the packet rules for all traffic via the Traffic Rules tab.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 11/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

Link copied to clipboard


Ad

By default, this section contains several rules, which you can Edit or Delete as per your needs. You can also set new rules by
clicking on the Add button.

Ad

Note

Be sure to click on Save & Apply after editing the firewall settings for each tab.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 12/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

(Optional) Launching the OpenWrt CLI


Link copied to clipboard
Ad
If you’re more familiar with command-line interfaces, you can use the Unified Configuration Interface (UCL)
using SSH. Although we have a dedicated article for setting up SSH on the Raspberry Pi, it’s much simpler on
OpenWrt. All you need to do is the following:

1. Download PuTTY from this link and install it on your PC.

2. Enter 192.168.1.1 as the IP address and ensure that Port 22 and SSH are selected before clicking on Start.

3. Accept any warnings should PuTTY display them.

4. Type root when PuTTY prompts you to enter a username.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 13/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

Link copied to clipboard


Ad

Ad

A neat aspect of UCL is that you can paste any command from the Firewall Configuration page on OpenWrt’s
website instead of navigating through a multitude of toggles and options inside the LuCI web page.

A Raspberry Pi-flavored firewall to keep threats at bay

That’s it for this guide! The traffic and zone rules will depend entirely on your use case and requirements. For
example, you might not want to access HTTP requests. In this case, you can modify the traffic rules to reject all
incoming, outgoing, and forwarded packets from Port 80.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 14/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

Sadly, a firewall won't be enough to protect your system from all types of malware, and that's why you should
Link copied to clipboard
Ad of security for your devices. Conversely, if you only
look into antivirus software if you want an additional layer
care about getting the highest Wi-Fi speeds, you’re better off investing in a premium router instead.

Ad

RELATED

Best Wi-Fi 7 routers in 2024

Readers like you help support XDA Developers. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.

Subscribe To Our Daily Newsletter! 80,000+ People Already Do

Email Address

SUBSCRIBE

By subscribing, you agree to our Privacy Policy and may receive occasional deal communications; you can unsubscribe anytime.

 Comments 2       

Related Topics
RASPBERRY PI NETWORK

About The Author


Ayush Pande

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 15/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall
(160 Articles Published)
Link copied to clipboard
Ad
Ayush Pande is a hardware, gaming, and crypto writer based in India. When he's not writing articles, you can find him tinkering with computers, playing long RPGs, or
strumming a guitar.

Recommended Articles

RASPBERRY PI
1 
This $16 Raspberry Pi-powered rover is a great start in robotics

RASPBERRY PI
+ 
12 years ago today, the Raspberry Pi made SBCs more accessible to everyone

NVIDIA
2 
Nvidia might release its own handheld gaming PC

WINDOWS 11
4  
Evolution of the Windows Start menu: How we got to where we are today

4:31

AI & MACHINE LEARNING


+ 
4 reasons Copilot is actually useful now

COMPUTING
+ 
How to safely clean your motherboard

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 16/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall

Link copied to clipboard


Ad
Try popular services free for 12 months

Ad

Create your Azure free account

Today's Best Deals

Anker’s GaNPrime 65W charger gets aggressive 47% discount in limited-time deal
22 hours ago

Don't sleep on this Anker 2-pack charger bundle that's now discounted to its lowest price yet
2 days ago

Anker’s ultra-compact power bank is now dirt cheap at 37% off for a limited time
2 days ago

See More

Ad

Join Our Content Team Home Contact Us Terms Privacy Copyright About Us Fact Checking Policy Corrections Policy Ethics Policy

Ownership Policy Disclosure Policy Advertise Recognized Developer Program Owned & Operated by Valnet Inc.

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 17/18
4/9/24, 2:00 PM How to protect your home network with a Raspberry Pi firewall
Copyright © 2024 www.xda-developers.com

Link copied to clipboard


Ad

https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 18/18

You might also like