Fix ufw service not loading after a reboot

I have a Ubuntu 18.04/20.04 server running ufw (Uncomplicated Firewall) and Docker. Docker relies on iptables-persistent, which is an interface to a much more powerful and complicated firewall that many people would rather avoid.

The problem here is that ufw and iptables-persistent are both ways for creating the same firewall. On my server, only one service would ever run at startup negating the other.

After a reboot ufw would always be disabled.

Even though the ufw service is enabled, if you look closely, the active service has exited.

If I check the server services, both ufw and netfilter-persistent are enabled. netfilter-persistent is a means for managing iptables on Debian and Ubuntu systems.

The fix is simple; we need to tell the operating system to load ufw after the netfilter-persistent.

Find and backup the ufw service.

Update and save the modified service by appending After=netfilter-persistent.service to the [Unit] block.

Reboot and test.


Fix ufw service not loading after a reboot



邮箱地址不会被公开。 必填项已用*标注