- I would like to accept inbound only port 80,443,22, snmp, 3306 to my server.
- I would like to be able to allow all outbound ports
- I would like all other inbound connection to be dropped.
Put this rules in a shell script....
#!/bin/bash
# 3
iptables -P INPUT DROP
iptables -P FORWARD DROP
# 2
iptables -P OUTPUT ACCEPT
iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED
iptables -A FORWARD -j ACCEPT -m state --state ESTABLISHED,RELATED
# 1 (change eth0 for your interface)
iptables -A INPUT -j ACCEPT -i eth0 -p tcp -m multiport --dport 80,443,22,161,3306