Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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

share|improve this answer
    
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 '11 at 14:06
    
Yeah, this solved it, thanks a lot. –  Xeross Mar 4 '11 at 18:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.