Zyngalu: Firewall
Index | Home Server | Hardware | Feedback | Mount USB Drive | Shut Down Pi | Computer IP Address

Linux Firewall ufw & gufw

I run a server. Infact if you see this page it's coming form my home server. So its a good idea to lock my system down as best I can. I do this with the ufw firewall. But I do need to open the firewall up so my computers can communincate. You do this by adding rules to the ufw firewall. I use SSH. This requies port 22 to be open. But thats not a problem as I make it so only certain computers can use this port. I do this by associating the port with the computers IP address.

Is the UFW Firewall Installed

sudo ufw status
[sudo] password for mpskinner:
Status: inactive

Install UFW Firewall

apt-get install ufw -y

Is Firewall Installed


Find Firewall Rull

sudo ufw status numbered
     To                         Action      From
     --                         ------      ----
[ 1] 24800/tcp                  ALLOW IN    192.168.0.121              (log)
[ 2] Anywhere                   REJECT IN   192.168.0.182
[ 3] 22                         ALLOW IN    192.168.0.121
[ 4] 22                         ALLOW IN    192.168.0.126

Delete Rule by choosing number associated with Rule you want to delete. In this example I delete rull 4

ufw delete 4
sudo ufw status numbered
     To                         Action      From
     --                         ------      ----
[ 1] 24800/tcp                  ALLOW IN    192.168.0.121              (log)
[ 2] Anywhere                   REJECT IN   192.168.0.182
[ 3] 22                         ALLOW IN    192.168.0.121

Block IP Address

  sudo ufw deny from 192.168.1.182 to any

or

sudo ufw reject from 192.168.0.182 to any