How to connect to ports 25 and 587

Operating system:CenotOS 7
Hi. I’m trying to create email account for a domain which I host on a VPS server. I created the mail by the Virtualmin panel, and it does seem to send messages to other addresses when I send it through the panel, but I do not receive incoming emails and when I try to send messages via Thunderbird it shows SMTP connection error. It appears that the reason may be blocked ports 25 and 587, because when I try to check to those ports via “telnet” command it’s returning “connection refused”. I tried tu open the ports by using the command:
firewall-cmd --permanent --zone=public --add-port=25/tcp
firewall-cmd --permanent --zone=public --add-port=587/tcp
But it still cannot connect to those ports. When I run “netstat -an4”, I can see that a lot of the ports are listeining under the 0.0.0.0 address:

tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN

However, for the ports which I opened, it appears to be listeining at “127.0.0.1”:
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN

Could the fact that it’s listeining at “127.0.0.1” instead of “0.0.0.0” be the reason why it still refuses to connect to those ports? If yes, is there any way to open them at “0.0.0.0”? Thank you in advance for any advise.

Your VPS host might have a firewall upstream from your server and independent of your server and it might be the one blocking your connection from 25 and 587. Could you check your VPS service provider’s control panel to check if they have their own firewall in place and if you can configure it to open 25 and 587?

I can confirm that Virtualmin does not block 25 and 587 by default, so you need not do anything to open those ports - they are open by default.

edit; Joe just said the same thing in a much better way.

Yes.
So, the question is how you got there… How did you install Virtualmin, and most importantly, what was installed on the server before?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.