How to configure Ubuntu Firewall?

by aliya.yundt , in category: Security , a year ago

How to configure Ubuntu Firewall?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by noemy.bosco , a year ago

@aliya.yundt 

Ubuntu Firewall is known as UFW (Uncomplicated Firewall). It is a frontend tool to manage iptables rules. Follow these steps to configure UFW on Ubuntu:

  1. Check UFW Status:sudo ufw status verbose It will show the current status of UFW.
  2. Allow SSH Connections:sudo ufw allow ssh It allows the SSH connection on port 22.
  3. Allow HTTP and HTTPS Traffic:sudo ufw allow http sudo ufw allow https It allows HTTP and HTTPS traffic on ports 80 and 443.
  4. Allow Specific Port:sudo ufw allow <port>/tcp Replace <port> with the actual port number. It allows traffic on the specified port.
  5. Deny All Incoming Connections:sudo ufw default deny incoming It denies all incoming connections except those that are explicitly allowed.
  6. Allow All Outgoing Connections:sudo ufw default allow outgoing It allows all outgoing connections.
  7. Enable UFW:sudo ufw enable It enables UFW and starts the firewall.


These are some basic commands to configure UFW on Ubuntu. You can use other UFW commands to add, delete, or modify rules as per your requirement.