1

Though I have gone through quite a few threads on AskUbuntu (1, 2, 3), and elsewhere, I'm little confuse on how to proceed.

I'd like to completely remove ufw, delete all iptables chains and rules, for a fresh start with nftables firewall in Ubuntu MATE 19.04

If I understand correctly (from the threads I have linked), I need to run the following:

sudo systemctl reset ufw

sudo systemctl disable ufw

sudo apt purge ufw gufw

sudo iptables -F

sudo iptables -Z

Then ?

for i in `iptables -L INPUT --line-numbers |grep '[0-9].*ufw' | cut -f 1 -d ' ' | sort -r `; do iptables -D INPUT $i ; done
for i in `iptables -L FORWARD --line-numbers |grep '[0-9].*ufw' | cut -f 1 -d ' ' | sort -r `; do iptables -D FORWARD $i ; done
for i in `iptables -L OUTPUT --line-numbers |grep '[0-9].*ufw' | cut -f 1 -d ' ' | sort -r `; do iptables -D OUTPUT $i ; done
for i in `iptables -L | grep 'Chain .*ufw' | cut -d ' ' -f 2`; do iptables -X $i ; done


The questions I have are:

(1) How do I "disable or deactivate" iptables so it doesn't interfere with Nftables firewall later on.

(2) In addition to removing ufw, should I remove iptables too:

sudo apt remove --auto-remove iptables

(3) Then proceed with installing and configuring nftables, is this the correct order?

Jags
  • 2,235
  • 3
  • 28
  • 44

1 Answers1

0

How To Uninstall ufw On Ubuntu 16.04 LTS

(Work in Debian 11 with just apt intead of apt-get for me)

To uninstall ufw just follow these instructions.

Ă—Are you having problems? You can always add ufwagain by following the instructions at this link.

Uninstall just ufw

sudo apt-get remove ufw

This will remove just the ufw package itself.

Uninstall ufw and its dependencies

sudo apt-get remove --auto-remove ufw

This will remove the ufw package and any other dependant packages which are no longer needed.

Purging your config/data too If you also want to delete your local/config files for ufw then this will work.

Caution! Purged config/data can not be restored by reinstalling the package.

sudo apt-get purge ufw

Or similarly, like this ufw

sudo apt-get purge --auto-remove ufw

Taking from https://installlion.com/ubuntu/xenial/main/u/ufw/install/index.html

Need to Unintall iptable too? https://installlion.com/ubuntu/vivid/main/i/iptables/uninstall/index.html