# How to delete iptables rule with cli?

**URL:** <https://community.ipfire.org/t/how-to-delete-iptables-rule-with-cli/7077>\
**Category:** Installing & Running IPFire\
**Created:** [21 January 2022 10:57 UTC](https://community.ipfire.org/t/how-to-delete-iptables-rule-with-cli/7077 "2022-01-21T10:57:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![d3nt4ku](https://community.ipfire.org/user_avatar/community.ipfire.org/d3nt4ku/32/4691_2.png) [@d3nt4ku](https://community.ipfire.org/u/d3nt4ku)\
**Post date:** [21 January 2022 10:57 UTC](https://community.ipfire.org/t/how-to-delete-iptables-rule-with-cli/7077/1 "2022-01-21T10:57:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tphz](https://community.ipfire.org/user_avatar/community.ipfire.org/tphz/32/16551_2.png) [@tphz](https://community.ipfire.org/u/tphz)\
**Post date:** [21 January 2022 11:44 UTC](https://community.ipfire.org/t/how-to-delete-iptables-rule-with-cli/7077/2 "2022-01-21T11:44:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bonnietwin](https://community.ipfire.org/user_avatar/community.ipfire.org/bonnietwin/32/12350_2.png) [@bonnietwin](https://community.ipfire.org/u/bonnietwin)\
**Post date:** [21 January 2022 11:53 UTC](https://community.ipfire.org/t/how-to-delete-iptables-rule-with-cli/7077/3 "2022-01-21T11:53:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![d3nt4ku](https://community.ipfire.org/user_avatar/community.ipfire.org/d3nt4ku/32/4691_2.png) [@d3nt4ku](https://community.ipfire.org/u/d3nt4ku)\
**Post date:** [21 January 2022 13:00 UTC](https://community.ipfire.org/t/how-to-delete-iptables-rule-with-cli/7077/4 "2022-01-21T13:00:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![d3nt4ku](https://community.ipfire.org/user_avatar/community.ipfire.org/d3nt4ku/32/4691_2.png) [@d3nt4ku](https://community.ipfire.org/u/d3nt4ku)\
**Post date:** [21 January 2022 13:01 UTC](https://community.ipfire.org/t/how-to-delete-iptables-rule-with-cli/7077/5 "2022-01-21T13:01:44Z")

</div>

Hello Adolf,  
thanks; fixed the issue modify the file

> `/var/ipfire/firewall/config`

Br,  
Den
