Created
August 28, 2011 11:34
-
-
Save yalla/1176565 to your computer and use it in GitHub Desktop.
Save and restore iptables rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
case "$1" in | |
start) | |
iptables-save > /tmp/firewall-rules.backup | |
for i in nat filter mangle; do | |
iptables -t $i -F | |
done | |
# TODO: Add your Tor-rules *here* | |
;; | |
stop) | |
for i in nat filter mangle; do | |
iptables -t $i -F | |
done | |
iptables-restore < /tmp/firewall-rules.backup | |
;; | |
restart) | |
$0 stop | |
$0 start | |
;; | |
*) | |
echo "Usage: $0 [start|stop|restart]" | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment