0

I'm trying to set-up iptables so it will only allow incoming connections on ports I specify.

I managed to get it working however it seems I somehow managed to break outgoing connections in the process.

Both NS look-ups and pings seem to fail, and probably everything else too.

Current rules:

Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

So how can I make this work, while still allowing outgoing connections?

1 Answer 1

3

Try: iptables -A INPUT -p TCP -m state --state ESTABLISHED,RELATED -j ACCEPT

1
  • I agree, except the ,RELATED, which isn't needed just to allow return-half packets, though it seems to be cargo-culted in by a lot of people. Depending on what kernel modules are loaded, RELATED can let in a lot more traffic than you might like, and I would advise against using it without good reason to do so.
    – MadHatter
    Mar 4, 2011 at 14:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .