Cannot telnet to port 25

hpn asked:

When I try to telnet to port 25 using this command:

telnet 25

I get this message


And nothing more happens. I disabled csf but the problem still exsists. I also asked my VPS co. whether they have blocked port 25 and they said they have not blocked any port.

In postfix logs:

server2 postfix/smtp[30847]: connect to[]:25: Connection timed out

Is it possible that google has blocked my server ip address?


Tried yahoo (telnet 25) and it has the same result. I also disabled iptables(service iptables stop) but problem still exists.

My answer:

There are two obvious possibilities here.

  1. Your hosting provider or their upstream networks or your government have blocked outbound traffic to port 25.

  2. Google and Yahoo have blocked incoming connections from your network.

I see that you are located in Iran. Due to US law, companies in the US are prohibited from doing business with Iran, and sometimes this gets enforced rather aggressively (for instance, simply downloading free software from a web site might be blocked). If your VPS is also in Iran, this might be the cause of the issue.

To find out whether this is an issue, try connecting to a mail server in a country which is more friendly to Iran, such as Russia:

telnet 25

If this is successful, then you are affected by the US embargo. If this also fails, then you are being blocked by the hosting provider or their providers.

In both cases, I recommend you purchase VPS services outside the country, if the service you wish to run can be provided from a server outside the country.

Finally there’s a third possibility: Your VPS server’s IP address may have been blacklisted due to previous abuse seen from its address. In this case you will have to figure out where it was blacklisted and have it removed from those lists. This could be difficult.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.