Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My iptables is causing postfix server not to send emails.

A problematic mail.log line is:

Mar 1 06:19:44 server postfix/smtp[9744]: 3D62CA06CA9: to=, relay=none, delay=42, delays=2.3/0.01/40/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for type=MX: Host not found, try again)

I found the other guy's explanation on how to fix this.

He proposed:

for ip in $DNS_SERVER
iptables -A OUTPUT -p udp -s $SERVER_IP --sport 1024:65535 -d $ip --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p udp -s $ip --sport 53 -d $SERVER_IP --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT-p tcp -s $SERVER_IP --sport 1024:65535 -d $ip --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp -s $ip --sport 53 -d $SERVER_IP --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

Isn't there any simpler rule without using the IP?

Thank you very much.

share|improve this question
up vote 3 down vote accepted

Firewall paranoia doesn't really work if you don't even understand your firewall.

Just set the OUTPUT policy to ACCEPT and allow ESTABLISHED traffic back in.

share|improve this answer
Thanks. Now I have ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED and since my OUTPUT policy is ACCEPT so everything now works. – valk Mar 1 '12 at 14:15

Your Answer


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.