First of all here is the list of things I want to do with the ip tables.
- Accept all IPs on tcp port 80
- Accept all IPs on tcp port 443
- Accept from my ip on tcp port SSH_PORT
I also want everything else to be secure and function normally, eg: be able to use wget.
Below is what I have created.
# Accept tcp packets on destination port 80 iptables -A INPUT -p tcp --dport 80 -j ACCEPT # Accept tcp packets on destination port 443 iptables -A INPUT -p tcp --dport 443 -j ACCEPT # Accept from specific ip on ssh iptables -A INPUT -p tcp -s 192.XXX.XX.XX/32 --dport SSHPORT -j ACCEPT # Accept all icmp traffic iptables -A INPUT -p icmp -j ACCEPT # Accept established tcp traffic on the specified ports iptables -A INPUT -m state --state ESTABLISHED --dport 32768:65535 -j ACCEPT # Drop eveything else iptables -P INPUT DROP iptables -P FORWARD DROP # Allow all output iptables -P OUTPUT ACCEPT