rahdt007
Posts: 3
Joined: Thu Dec 24, 2015 3:28 am

ufw inactive after reboot

Sun Jan 03, 2016 8:28 am

I found my solution here
http://bbs.archbang.org/viewtopic.php?pid=31848#p31848

To start ufw on boot, create a shell script containing 2 lines

Sudo nano start_ufw.sh

#!/bin/sh
/usr/sbin/ufw enable

Ctrl-X to save it

sudo cp start_ufw.sh /etc/rc.local

To check:

sudo reboot

sudo ufw status

Killduke
Posts: 2
Joined: Sun Dec 08, 2019 2:15 pm

Re: ufw inactive after reboot

Sun Dec 08, 2019 2:25 pm

The proposed solution it's not ideal.

Accordingly to this post
The right solutions should be to edit this file

Code: Select all

sudo nano /lib/systemd/system/ufw.service

and add the following line at the end of the first section

Code: Select all

After=netfilter-persistent.service
The result should be like this:
[Unit]
Description=Uncomplicated firewall
Documentation=man:ufw(8)
DefaultDependencies=no
Before=network.target
After=netfilter-persistent.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/lib/ufw/ufw-init start quiet
ExecStop=/lib/ufw/ufw-init stop

[Install]
WantedBy=multi-user.target
Adding this line we tell the operating system to load ufw after the netfilter-persistent.
After this all should be fine.

Bye

Return to “Arch”