7

I am running Ubuntu Server 18.04

When I do:

sudo ufw enable

the output is:

Firewall is active and enabled on system startup

but when I do a reboot and run:

sudo ufw status verbose

the output is:

Status: inactive

I have checked /etc/ufw/ufw.conf:

ENABLED=yes

I have tried:

uninstalling and reinstalling ufw:

sudo ufw logging off

update-rc.d ufw defaults

sudo systemctl enable ufw

I have gone as far as I can go. Any help would be appreciated.

Edit: Hi steeldriver, thank you for your reply. Output is

systemctl status ufw.service
● ufw.service - Uncomplicated firewall
Loaded: loaded (/lib/systemd/system/ufw.service; enabled; vendor 
preset: enab
Active: active (exited) since Tue 2019-02-05 15:01:15 NZDT; 1h 49min 
ago
Docs: man:ufw(8)
Process: 456 ExecStart=/lib/ufw/ufw-init start quiet (code=exited, 
status=0/SU
Main PID: 456 (code=exited, status=0/SUCCESS)
Jedi
  • 491

3 Answers3

4

For me, this was a conflict with firewalld, and was resolved with:

sudo systemctl disable firewalld
Eliah Kagan
  • 117,780
1

I found the culprit. It was iredmail. There was a script in /etc/init.d/iptables that loaded iptables. This was conflicting with ufw preventing ufw from being enabled on boot. Once I stopped this script from running on boot my problem was solved. ufw is enabled on boot now.

Jedi
  • 491
  • Can you please guide on how did you removed this conflict. I removed the files "iptables" and "ip6tables" from /etc/init.d/iptables but still UFW gets disables on reboot. – Muhammad Ahmad Aug 15 '19 at 06:53
1

Adding this answer incase it helps somebody

In my case, in /etc/network/interfaces, there was this line at the end

pre-up iptables-restore < /etc/iptables.rules

There were some custom rules that were getting loaded from this file and it was causing ufw to be disabled. Removing this line fixed the issue

coderDude
  • 203