2014-10-28 11:43:39 +01:00
|
|
|
#!/bin/sh
|
2011-10-11 05:58:03 +02:00
|
|
|
# Usage: iptables-flush [-6]
|
|
|
|
|
|
|
|
iptables=/usr/sbin/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
|
2011-10-11 05:58:03 +02:00
|
|
|
iptables=/usr/sbin/ip6tables
|
|
|
|
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
|