Reset-iptables

From Nasqueron Agora
Revision as of 02:02, 3 November 2014 by Dereckson (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

/usr/sbin/reset-iptables is a script which allows to reset a default standard configuration of iptables.

   #!/bin/sh
   IPTABLES=iptables
   
   # RESET DEFAULT POLICIES
   $IPTABLES -P INPUT ACCEPT
   $IPTABLES -P FORWARD ACCEPT
   $IPTABLES -P OUTPUT ACCEPT
   $IPTABLES -t nat -P PREROUTING ACCEPT
   $IPTABLES -t nat -P POSTROUTING ACCEPT
   $IPTABLES -t nat -P OUTPUT ACCEPT
   $IPTABLES -t mangle -P PREROUTING ACCEPT
   $IPTABLES -t mangle -P OUTPUT ACCEPT
   
   # FLUSH ALL RULES, ERASE NON-DEFAULT CHAINS
   $IPTABLES -F
   $IPTABLES -X
   $IPTABLES -t nat -F
   $IPTABLES -t nat -X
   $IPTABLES -t mangle -F
   $IPTABLES -t mangle -X

Source: LanceBaynes, How to reset all iptables settings?, Unix & Linux Stack Exchange (exact script of the source unknown).