Iptables Reset
In this sample iptables_reset_programs.cfg #include file, we reset iptables--clear the existing firewall rules.
/////////////////////////////////////////////////////////////////////////////// // // iptables_reset_programs.cfg - clear the existing firewall rules // /////////////////////////////////////////////////////////////////////////////// if [ ! -x =iptables ]; then die "iptables: can't execute =iptables" fi =iptables -P INPUT DROP // set default policy to DROP =iptables -P OUTPUT DROP =iptables -P FORWARD DROP =iptables -F // flush all chains =iptables -X // delete all chains for table in filter nat mangle; do =iptables -t $table -F // delete the table's rules =iptables -t $table -X // delete the table's chains =iptables -t $table -Z // zero the table's counters done ///////////////////////////////////////////////////////////////////////////////
This iptables_reset_programs.cfg file is #included by the higher-level iptables_programs.cfg file.
We can also reuse this #include file to create a standalone firewall reset program, reset_iptables.
For more examples, see Samples.