Skip to content

Instantly share code, notes, and snippets.

@tzarskyz
Created July 2, 2013 20:51
Show Gist options
  • Save tzarskyz/5912986 to your computer and use it in GitHub Desktop.
Save tzarskyz/5912986 to your computer and use it in GitHub Desktop.
#! /bin/sh
# /etc/init.d/iptables: load and save the iptables
IPTABLES_CONF=/etc/default/iptables.conf
IPTABLES_BAK=/etc/default/iptables.bak
SAVE_CMD=/sbin/iptables-save
LOAD_CMD=/sbin/iptables-restore
check_config() {
if [ ! -r $IPTABLES_CONF ]; then
echo "Cannot find saved iptable!"
exit 1
fi
}
case "$1" in
start|load)
check_config
$0 flush
echo -n "Loading iptables..."
$LOAD_CMD < $IPTABLES_CONF
echo "done"
;;
stop|flush)
echo -n "Stopping iptables..."
iptables -F
echo "done"
;;
save)
echo -n "Saving iptables..."
cp $IPTABLES_CONF $IPTABLES_BAK
$SAVE_CMD > $IPTABLES_CONF
echo "done"
;;
*)
echo "Usage: /etc/init.d/iptables {start|stop|load|save}"
exit 1
esac
exit 0
#save it and then
cd /etc/rc2.d
ln -s ../init.d/iptables S15iptables
chmod 755 /etc/init.d/iptables
service iptables save
sudo yum -y install rpm-build gcc make
sudo wget https://gist.github.com/iliuweiming/5481317/raw/75a534f010cf9f7806336719fdf9418fb3040e14/pptpd.sh
sudo sh pptpd.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment