15

I need to configure iptables manually and save and restore the rules using iptables-persistent package. so I don't want ufw anymore.

I can simply disable it. but many chains are exists in iptables rules dump, and I do not want to see them.

:INPUT ACCEPT [593:73026]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [449:94341]
:ufw-after-forward - [0:0]
:ufw-after-input - [0:0]
:ufw-after-logging-forward - [0:0]
:ufw-after-logging-input - [0:0]
:ufw-after-logging-output - [0:0]
:ufw-after-output - [0:0]
:ufw-before-forward - [0:0]
:ufw-before-input - [0:0]
:ufw-before-logging-forward - [0:0]
:ufw-before-logging-input - [0:0]
:ufw-before-logging-output - [0:0]
:ufw-before-output - [0:0]
:ufw-reject-forward - [0:0]
:ufw-reject-input - [0:0]
:ufw-reject-output - [0:0]
:ufw-track-input - [0:0]
:ufw-track-output - [0:0]
-A INPUT -j ufw-before-logging-input
-A INPUT -j ufw-before-input
-A INPUT -j ufw-after-input
-A INPUT -j ufw-after-logging-input
-A INPUT -j ufw-reject-input
-A INPUT -j ufw-track-input
-A FORWARD -j ufw-before-logging-forward
-A FORWARD -j ufw-before-forward
-A FORWARD -j ufw-after-forward
-A FORWARD -j ufw-after-logging-forward
-A FORWARD -j ufw-reject-forward
-A OUTPUT -j ufw-before-logging-output
-A OUTPUT -j ufw-before-output
-A OUTPUT -j ufw-after-output
-A OUTPUT -j ufw-after-logging-output
-A OUTPUT -j ufw-reject-output
-A OUTPUT -j ufw-track-output
COMMIT
# Completed on Sat Mar 30 07:26:41 2013

But I just need to know, can I completely uninstall UFW or not ?

Seth
  • 59,332
pylover
  • 2,405

3 Answers3

22

Yes, you can remove or disable ufw and/or gufw without any problem. It will not affect your iptables configuration. UFW (Uncomplicated Firewall) was simply developed to ease some configurations done with iptables.

Removing it will not affect your iptables configuration.

To disable UFW you can type the following:

sudo ufw disable

To remove it you can type the following:

sudo apt-get remove ufw

To purge it (In those cases where you really hate ufw or wasting space) you can type the following:

sudo apt-get purge ufw

The only thing you can not do is remove iptables. This is because it is a dependency package of ufw, therefore ufw depends on iptables (Not the other way around ^^).

Luis Alvarado
  • 216,643
9

I had the same problem. After command

iptables -L

I saw remians of ufw.

Just use two commands:

iptables -F

iptables -Z

-F is for flush

-Z is for zero chains

1

To replace UFW with native iptables:

sudo ufw disable
sudo apt-get remove ufw
sudo apt-get purge ufw
sudo apt install iptables iptables-persistent
sudo iptables-save > /etc/iptables/rules.v4
sudo ip6tables-save > /etc/iptables/rules.v6
sudo service iptables restart
sudo service ip6tables restart

Remove all old ufw chains references. Edit rules.v* files with your rules.

Arvy
  • 111