Recipe 2.17 Deleting Firewall Rules
2.17.1 Problem
You
want to delete firewall rules, individually or all at once.
2.17.2 Solution
To
delete rules en
masse , also called flushing a
chain, do the following:For iptables:
# iptables -F [chain]
For ipchains:
# ipchains -F [chain]
To delete rules individually:For iptables:
# iptables -D chain rule_number
For ipchains:
# ipchains -D chain rule_number
2.17.3 Discussion
Rules are numbered beginning with 1. To list the rules:
# iptables -L
# ipchains -L
select one to delete (say, rule 4 on the input chain), and type:
# iptables -D INPUT 4
# ipchains -D input 4
If you've previously saved your rules and want your
deletions to remain in effect after the next reboot, re-save the new
configuration. [Recipe 2.19]
2.17.4 See Also
iptables(8), ipchains(8).