iptables blocking all outbound connections

I have the following rules set up:

  iptables -F
  iptables -A INPUT -s 192.168.0.0/16 -j ACCEPT
  iptables -A OUTPUT -d 192.168.0.0/16 -j ACCEPT
  iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
  iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
  iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
  iptables -A INPUT -i lo -j ACCEPT
  iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
  iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
  iptables -A INPUT -p tcp -m tcp --dport 12344 -j ACCEPT
  iptables -P OUTPUT ACCEPT
  iptables -P INPUT DROP

For some reason all outbound traffic is blocked, even though iptables -P OUTPUT ACCEPT is set.

What am I doing wrong?


I believe the problem is most likely issues relating to the returning traffic being rejected. Try adding a new line 2 reading

iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

To allow connections related to outbound connections you made to go through.