2014-10-28 11:43:39 +01:00
|
|
|
#!/bin/sh
|
2011-10-11 05:58:03 +02:00
|
|
|
# Usage: iptables-flush [-6]
|
|
|
|
|
2015-06-02 20:02:42 +02:00
|
|
|
iptables=/usr/bin/iptables
|
2014-10-28 11:43:39 +01:00
|
|
|
tables="filter mangle raw"
|
2011-10-11 05:58:03 +02:00
|
|
|
|
2014-10-28 11:43:39 +01:00
|
|
|
if [ "$1" = "-6" ]; then
|
2015-06-02 20:02:42 +02:00
|
|
|
iptables=/usr/bin/ip6tables
|
2011-10-11 05:58:03 +02:00
|
|
|
else
|
|
|
|
# Only ipv4 has a nat table
|
2014-10-28 11:43:39 +01:00
|
|
|
tables="$tables nat"
|
2011-10-11 05:58:03 +02:00
|
|
|
fi
|
|
|
|
|
2014-10-28 11:43:39 +01:00
|
|
|
for table in ${tables}; do
|
2011-10-11 05:58:03 +02:00
|
|
|
$iptables -t "$table" -F
|
|
|
|
$iptables -t "$table" -X
|
|
|
|
done
|
|
|
|
|
|
|
|
for chain in INPUT FORWARD OUTPUT; do
|
|
|
|
$iptables -P "$chain" ACCEPT
|
|
|
|
done
|