# accept all from localhost -A INPUT -s 127.0.0.1 -j ACCEPT # accept all previously established connections -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT # ssh -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT # ftp / webserver related -A INPUT -p tcp -m state --state NEW -m tcp --dport 20 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT # Windows / Samba -A INPUT -p tcp -m state --state NEW -m tcp --dport 137:139 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 426 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 445 -j ACCEPT # up to 5 Bit-torrent connections -A INPUT -p tcp -m state --state NEW -m tcp --dport 6881:6886 -j ACCEPT # reject everything else -A INPUT -j REJECT --reject-with icmp-port-unreachab