Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I am attempting to set up an email server on a VPS running Debian Squeeze. I've setup Postfix according to the instructions at here.

Everything seems to work fine if I connect to the server from localhost:

mark@revolver:~$ telnet localhost 25
Connected to localhost.localdomain.
Escape character is '^]'.
220 ESMTP Postfix (Debian/GNU)
ehlo localhost
250-SIZE 30720000
250 DSN

Also, a relevant entry appears in /var/log/mail.log:

May  9 22:03:28 revolver postfix/smtpd[2919]: connect from localhost.localdomain[]

However, attempting to telnet remotely from my laptop is not working correctly. I can connect to the host on port 25, but the server won't respond to any commands and will close the connection after about 20 seconds. For example:

$ telnet 25
Connected to
Escape character is '^]'.
421 Cannot connect to SMTP server (, connect timeout
Connection closed by foreign host.

Interestingly, there is nothing in the log files.

Any ideas what might be causing this? I'm especially confused by the 421 error. Why is the server trying to connect itself?

share|improve this question
You have a firewall on the VPS, which is not allowing incoming SMTP connections. – Sandor Marton May 10 '13 at 2:53
I've already configured iptables to allow SMTP connections. And the connection is being established, but it just hangs for about 20 seconds before I get the 421 error and the connection is closed. – Mark May 10 '13 at 3:22
the fact that you get a 421 SMTP error code means that some (but maybe not your) MTA/Proxy is accepting the connection. Check if a local firewall/antivirus application or your provider is interfering with outgoing port 25 connections. try to connect from a different place to your vps. – Gryphius May 10 '13 at 5:45
There should be something in error log. But we are not mind readers, so post postfix config and all log which is logged at the time of test (not only what you find relevant). – Sandor Marton May 10 '13 at 13:33
Please post you poatconf -n along with your postfix log messages... – vijay rajah May 10 '13 at 15:48

The problem was the firewall after all. Port 25 was open, but those connections were being forwarded to port 465, which had not been allowed. A simple addition to the firewall solved the problem:

-A INPUT -p tcp --dport 465 -j ACCEPT

Thanks for the help guys!

share|improve this answer

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.