I’ve started experimenting with Ubuntu again recently with a Raspberry Pi4 that I have on my home network (running Ubuntu Server 20.04 LTS). I’ve had it with a view of home automation but have recently been experimenting with Pi Hole as a way of blocking Ads and known malware from the home network.
Below are some useful commands stored here more for my own purpose than anything! But were required to view the firewall status and open the DNS ports to the home network as they were blocked by default.
Check the firewall status and configuration
Display the status of the firewall on the server, including the configured firewall rules
sudo ufw status
Add firewall rules
Below are some example commands for adding firewall rules that were useful – in this case it was to allow DNS and DHCP traffic from devices on the network to the server.
# allow inbound traffic for DNS and DHCP
sudo ufw allow 67/udp
sudo ufw allow 53/udp