How to Stop Ubuntu from Automatically Blocking Connections with UFW

The Blocked Server

Ubuntu includes ufw (Uncomplicated Firewall) as a front-end to the Linux kernel’s iptables/nftables packet filtering system. While ufw is disabled by default on desktop Ubuntu, it is frequently enabled by server setup guides, hosting providers’ initialisation scripts, or security-hardening tools. Once enabled, ufw blocks all incoming connections by default, which means that services you set up — such as a local web server on port 8080, an SSH daemon, a Samba file share, or a development database — become unreachable from other machines on the network. You configure the service, it starts successfully, but no one can connect to it because the firewall is silently dropping every incoming packet.

Disabling or Configuring UFW

To stop Ubuntu from automatically blocking incoming connections via the firewall, you can either disable ufw entirely or add specific rules to allow the traffic you need.

Open a terminal (Ctrl + Alt + T). To check whether ufw is currently active, run sudo ufw status. If it reports “Status: active,” the firewall is blocking traffic. To disable it entirely, run sudo ufw disable. The firewall will be deactivated immediately and will not re-enable on reboot. If you prefer to keep the firewall active but allow specific services, use the allow command instead. For example, to allow SSH: sudo ufw allow ssh. To allow a specific port: sudo ufw allow 8080/tcp. To allow all traffic from a specific subnet (e.g., your local network): sudo ufw allow from 192.168.1.0/24. After adding rules, run sudo ufw status verbose to verify. To re-enable the firewall after adding all necessary rules: sudo ufw enable. The rules persist across reboots, so you only need to configure them once.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.