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