35 lines
592 B
Django/Jinja
35 lines
592 B
Django/Jinja
#!/bin/bash
|
|
|
|
flush()
|
|
{
|
|
for chain in INPUT OUTPUT FORWARD
|
|
do
|
|
iptables -P $chain ACCEPT
|
|
iptables -F $chain
|
|
ip6tables -P $chain ACCEPT
|
|
ip6tables -F $chain
|
|
done
|
|
#for chain in INPUT OUTPUT PREROUTING POSTROUTING
|
|
for chain in POSTROUTING
|
|
do
|
|
iptables -t nat -F $chain
|
|
ip6tables -t nat -F $chain
|
|
done
|
|
}
|
|
|
|
load()
|
|
{
|
|
iptables-restore -n /etc/iptables/iptables.conf
|
|
ip6tables-restore -n /etc/iptables/ip6tables.conf
|
|
}
|
|
|
|
if [[ $1 == 'start' || $1 == 'restart' ]]
|
|
then
|
|
flush
|
|
load
|
|
elif [[ $1 == 'stop' ]]
|
|
then
|
|
flush
|
|
else
|
|
echo "Please provide start or stop"
|
|
fi |