Created
August 7, 2009 05:58
-
-
Save anotherjesse/163754 to your computer and use it in GitHub Desktop.
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 | |
echo "Flushing iptables..." | |
iptables -F | |
echo "SSH Allowed" | |
iptables -A INPUT -p tcp --dport 22 -j ACCEPT | |
echo "allow from localhost" | |
iptables -A INPUT -i lo -j ACCEPT | |
echo "allow from 192.168.1.1-100" | |
iptables -I INPUT 3 -i eth0 -m iprange --src-range 192.168.1.1-192.168.1.100 -j ACCEPT | |
echo "allow all pings" | |
iptables -I INPUT 5 -p icmp -j ACCEPT | |
# Set default policies for INPUT, FORWARD and OUTPUT chains | |
iptables -P INPUT DROP | |
iptables -P FORWARD DROP | |
iptables -P OUTPUT ACCEPT | |
# Accept packets belonging to established and related connections | |
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment