Ubuntu UFW firewall turns itself off

firewallUbuntuufw

I have UFW enabled on my server. However, I find that it is disabled at times, showing a status of "firewall not loaded". I enable it, verify that it is running (shows loaded and gives me a list of my active rules when asking for status verbose), and if I check it a few minutes later, it shows not loaded again.

I thought there might be a flag in the config to unload itself as a safety feature while it is being configured, but couldn't find anything. It seems to disable itself about every 5 minutes.

It is driving me crazy, any ideas? Could another firewall be loaded and cause the conflict? How would I know?

Best Answer

Sounds like the process is failing so check the logs.

If you have a standard install then /var/log/ufw.log and also maybe /var/log/syslog

In my experience your theory of another firewall causing a conflict is not plausible.

If the logs don't show anything, or you cannot find a suitable answer to your problem, try using strace on the process.

strace -o output ufw then check the file called output