Firewall

Last modified: 2022-12-11

Network

It's a network security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules.

Status

ufw status
ufw status verbose

Enable/Disable the Firewall

ufw enable

ufw disable

Set Default Policies

# Allow all
ufw default ALLOW

# Deny all
ufw default DENY

Rules

  • Allow

    ufw allow 22
    ufw allow 22/tcp
    ufw allow 80
    ufw allow 80/tcp
    
    # Allow the given ip address access to port 22 for all protocols
    ufw allow from <ip> to any port 22
    
  • Deny

    ufw deny 22
    ufw deny 22/tcp
    ufw deny 80
    ufw deny 80/tcp