How to protect your home network with a Raspberry Pi firewall
How to protect your home network with a Raspberry Pi firewall
Log in
Home Raspberry Pi
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)
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
$25 at Amazon
$13 at Amazon
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
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
Ad
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
192.168.1.1
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
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.
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
Ad
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
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
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
2. Enter 192.168.1.1 as the IP address and ensure that Port 22 and SSH are selected before clicking on Start.
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
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.
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
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.
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
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
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
Ad
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
https://www.xda-developers.com/protect-network-with-raspberry-pi-firewall/ 18/18