How to delete iptables rule with cli?

Hello,
I inserted a silly rule via web interface and now I’m not able to reach the firewall from my internal LAN (green); I approach the box physically and delete the incriminated FORWARDFW, issue iptables-save and restart firewall via /etc/init.d/firewall command. But reloading the firewall command the rule is back on iptables. Is there any way to remove the rule via cli interface?

Tia,
Den

:thinking: After logging into the CLI, you can launch the elinks browser.

1 Like

The file that stores the wui firewall rules settings and provides them to iptables is
/var/ipfire/firewall/config

You would need to edit this file to remove the errant rule but you would likely need to change the order number at the beginning of the line for all rules that came after it is the last in the series.

Before editing the file make a backup copy so you can revert if something goes wrong.

There are also files outgoing and input in that directory for the Outgoing Firewall Access and Incoming Firewall Access tables on the wui page.

4 Likes

Hello tphz,
unfortunately that box is not up to date and elinks is not present. Anyway thanks for this tip I was unaware of it.

Den

Hello Adolf,
thanks; fixed the issue modify the file

/var/ipfire/firewall/config

Br,
Den

2 Likes