22 lines
378 B
Plaintext
22 lines
378 B
Plaintext
|
#!/bin/bash
|
||
|
# Usage: iptables-flush [-6]
|
||
|
|
||
|
iptables=/usr/sbin/iptables
|
||
|
tables=(filter mangle raw)
|
||
|
|
||
|
if [[ "$1" == "-6" ]]; then
|
||
|
iptables=/usr/sbin/ip6tables
|
||
|
else
|
||
|
# Only ipv4 has a nat table
|
||
|
tables+=(nat)
|
||
|
fi
|
||
|
|
||
|
for table in "${tables[@]}"; do
|
||
|
$iptables -t "$table" -F
|
||
|
$iptables -t "$table" -X
|
||
|
done
|
||
|
|
||
|
for chain in INPUT FORWARD OUTPUT; do
|
||
|
$iptables -P "$chain" ACCEPT
|
||
|
done
|