Im a noob at iptables, and have recently setup a new server ans used webmin to tell iptables to allow incomming port 80, 443, and 22. However with iptables enabled the server can no longer ping external servers or do dns lookups.

What do I need to change in iptables to allow such things?

Thanks!

link|improve this question

Here is a screenshot of my current webmin config: dl.dropbox.com/u/1184943/webmin_firewall.png – mrlanrat Mar 12 '11 at 4:01
Why not just edit your question? – pepoluan Mar 12 '11 at 4:05
feedback

3 Answers

The rules are going to change depending on whether you have a firewall which all traffic passes through, or the firewall is on the actual machine you want to protect. I've written the rules assuming the latter.

But if you have a dedicated firewall box which protects other servers, you'd probably want

 -A FORWARD

Instead of INPUT our OUTPUT.

The easiest thing to do would be to allow all outbound traffic for that server. Or you could be more specific, its up to you.

# Allow outbound traffic from MyServer
iptables -A OUTPUT -j ACCEPT -s $myServer

Where $myServer is whatever IP you have. Not sure about how you'd do this in webmin, sorry.

Whether you want to allow all outbound traffic, or be more specific, is up to you.

EDIT:

You may also find it useful to allow inbound ICMP (for pings), if you haven't already.

iptables -A INPUT -j ACCEPT -p ICMP -d $myServer
link|improve this answer
I think I already allow all outbound traffic, take a look at the screenshot I attached. – mrlanrat Mar 12 '11 at 4:02
feedback

I never use Webmin to configure iptables, but check if you can add a rule:

Allow incoming traffic related/reply to outgoing traffic.

Or,

Allow established incoming traffic.

If there's no such rule, you have to add two rules:

Allow incoming UDP from port 53

Allow incoming ICMP

link|improve this answer
feedback
up vote 0 down vote accepted

Ok, I figured it out.

I deleted all the rules I have and reset the firewall with a bunch of preset defaults the webmin module provided.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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