Created
August 1, 2011 15:14
-
-
Save zaininnari/1118317 to your computer and use it in GitHub Desktop.
iptables CentOS5.6
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/sh | |
iptables -F | |
iptables -X | |
iptables -P INPUT DROP | |
iptables -P OUTPUT ACCEPT | |
iptables -P FORWARD DROP | |
iptables -A INPUT -i lo -j ACCEPT | |
iptables -A OUTPUT -o lo -j ACCEPT | |
iptables -A INPUT -s 10.0.0.0/8 -j DROP | |
iptables -A INPUT -s 172.16.0.0/12 -j DROP | |
iptables -A INPUT -s 192.168.0.0/16 -j DROP | |
# iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT | |
iptables -A INPUT -p tcp --dport 22 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 80 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 443 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 25 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 110 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 587 -j ACCEPT | |
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