Last active
August 29, 2015 14:19
-
-
Save rameshvarun/064184efedd06f6af2b6 to your computer and use it in GitHub Desktop.
IP Tables Configurations
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 | |
# Flush all current rules | |
iptables -F | |
# Accept SSH Connections | |
iptables -A INPUT -p tcp --dport 22 -j ACCEPT | |
iptables -P INPUT DROP # By default, drop all incoming connections | |
iptables -P FORWARD DROP # By default refuse to forward packets | |
iptables -P OUTPUT ACCEPT # By default accept all outgoing connections | |
# Allow connections to localhost | |
iptables -A INPUT -i lo -j ACCEPT | |
# Accept packets belonging to established and related connections | |
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
# Accept TCP packets on PORT 80 | |
iptables -A INPUT -p tcp --dport 80 -j ACCEPT | |
# Accept TCP packets on PORT 3000 | |
iptables -A INPUT -p tcp --dport 3000 -j ACCEPT | |
# Save settings | |
/sbin/iptables-save | |
# List rules | |
iptables -L -v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment