iptables flushing and restoring
This commit is contained in:
parent
2f3b03001a
commit
e76c241069
@ -57,6 +57,9 @@ read -p "Would you want to disable client-to-client routing? [yes] " ANSDROP
|
||||
if [ "$DROP" == "$ANSDROP" ]; then
|
||||
# disable forwarding
|
||||
iptables -I FORWARD -s $LOCALIPMASK -d $LOCALIPMASK -j DROP
|
||||
else
|
||||
echo "Deleting DROP rule if exists..."
|
||||
iptables -D FORWARD -s $LOCALIPMASK -d $LOCALIPMASK -j DROP
|
||||
fi
|
||||
|
||||
# MSS Clamping
|
||||
@ -82,3 +85,9 @@ if [ $? -ne 0 ]; then
|
||||
echo "Cannot save iptables-restore from $IPTABLES to $RCLOCAL."
|
||||
fi
|
||||
fi
|
||||
|
||||
iptables -F
|
||||
|
||||
if [[ ! -z $IPTABLERESTOR ]]; then
|
||||
$IPTABLESRESTOR < $IPTABLES
|
||||
fi
|
||||
|
||||
@ -55,6 +55,9 @@ read -p "Would you want to disable client-to-client routing? [yes] " ANSDROP
|
||||
if [ "$DROP" == "$ANSDROP" ]; then
|
||||
# disable forwarding
|
||||
iptables -I FORWARD -s $LOCALIPMASK -d $LOCALIPMASK -j DROP
|
||||
else
|
||||
echo "Deleting DROP rule if exists..."
|
||||
iptables -D FORWARD -s $LOCALIPMASK -d $LOCALIPMASK -j DROP
|
||||
fi
|
||||
|
||||
# MSS Clamping
|
||||
@ -84,3 +87,21 @@ if [ $? -ne 0 ]; then
|
||||
echo "Cannot save iptables-restore from $IPTABLES to $RCLOCAL."
|
||||
fi
|
||||
fi
|
||||
|
||||
IPTABLESRESTOR=$(which iptables-restore)
|
||||
RESTORPRESENTS=$(grep iptables-restore $RCLOCAL)
|
||||
if [ $? -ne 0 ]; then
|
||||
if [[ ! -z $IPTABLESRESTOR ]]; then
|
||||
sed -i -e "/exit 0/d" $RCLOCAL
|
||||
echo "$IPTABLESRESTOR < $IPTABLES" >> $RCLOCAL
|
||||
echo "exit 0" >> $RCLOCAL
|
||||
else
|
||||
echo "Cannot save iptables-restore from $IPTABLES to $RCLOCAL."
|
||||
fi
|
||||
fi
|
||||
|
||||
iptables -F
|
||||
|
||||
if [[ ! -z $IPTABLERESTOR ]]; then
|
||||
$IPTABLESRESTOR < $IPTABLES
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user