ufw is not starting for me on boot. My /etc/ufw/ufw.conf file looks like this:
# /etc/ufw/ufw.conf
#
# Set to yes to start on boot. If setting this remotely, be sure to add a rule
# to allow your remote connection before starting ufw. Eg: 'ufw allow 22/tcp'
ENABLED=yes
# Please use the 'ufw' command to set the loglevel. Eg: 'ufw logging medium'.
# See 'man ufw' for details.
LOGLEVEL=low
So it seems it should start ok. However straight after boot I always get this:
$ sudo ufw status
Status: inactive
Using the "service" script to start it does not seem to work:
$ sudo service ufw start
$ sudo ufw status
Status: inactive
If I force a reload it will work just fine:
$ sudo ufw reload
Firewall reloaded
$ sudo ufw status
Status: active
And after that the "service" script works just fine:
$ sudo ufw status
Status: active
$ sudo service ufw stop
$ sudo ufw status
Status: inactive
$ sudo service ufw start
$ sudo ufw status
Status: active
How do I get ufw to start on boot?
Edit:
I am using Ubuntu 18.04 so systemd is being used. systemctl is-enabled reports as follows:
$ sudo ufw status verbose
Status: inactive
$ sudo systemctl is-enabled ufw.service
enabled
I also tried this:
$ sudo systemctl enable ufw
Synchronizing state of ufw.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ufw
$ sudo ufw status verbose
Status: inactive
And after a reboot it remains inactive. journalctl -p err reports nothing interesting. journalctl -u ufw reports:
$ journalctl -u ufw
...<snip>...
-- Reboot --
May 26 12:53:36 matt-laptop systemd[1]: Started Uncomplicated firewall.
So it certainly appears that it is attempting to start up ufw...it just seems that it doesn't actually do it!
ufw enable? help.ubuntu.com/community/UFW – PerlDuck May 26 '18 at 9:52ufw enablesuccessfully starts the firewall and setsENABLED=yesinufw.conf(it if isn't already set to "yes"). But this makes no difference. After a reboot ufw is still inactive. – Matt Caswell May 26 '18 at 10:03systemctlis user to enable/disable services at boot.journalctlis used to monitor services startup. ...sudo ufw statusshould list rules. Does it ? ... You can trysudo systemctl enable ufwand have a look atjournactl -u ufw...journalctl -p errwatch for errors. – cmak.fr May 26 '18 at 10:41systemctl is-enabled ufw.service– steeldriver May 26 '18 at 11:24journalctl -p erroutput.sudo ufw statusdoes not list rules, butsudo ufw status verbosedoes if I manually enable ufw first. – Matt Caswell May 26 '18 at 12:18