Creating a firewall with ufw

This recipe uses a simple, yet powerful command-line tool (ufw) to configure a firewall.

This recipe can be used to completely block network access to the Raspberry Pi. It can also be used to configure the Uncomplicated Firewall (ufw) to allow access through the firewall to specific applications (for example, web servers).

After completing this recipe, you will be able to protect network access to your Raspberry Pi using a firewall.

Getting ready


An Initial Setup or Basic Networking setup for the Raspberry Pi that has been powered on. You have also logged in as the user pi (see the recipes in Chapter 1, Installation and Setup for how to boot and log in and the recipes in Chapter 2, Administration for how ...

Get Raspberry Pi Networking Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.