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.

 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2018-01-02.   This site is PIKT® powered.
Copyright © 1998-2018 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
firewall
macros