Telnet: Unable to connect to remote host
Your server is not listening on port 587. I accept that you think you've been able to connect to it from some other machines, but I can only surmise that they've been going through some kind of transparent proxy which has hijacked connections to mail-server-type services, and whisked you off to some local mail server.
In other words, the machine that can't connect to server:587 is telling you the truth. Any machines that claim they can are lying to you.
Related videos on Youtube
Rufein
Developer who works with open source tools like Drupal and Wordpress. Sometimes i help people, but i am not superman!!
Updated on September 18, 2022Comments
-
Rufein over 1 year
Related Threads:
The problem
I have a server running Debian 3.2.65-1 and i am having some problems to connect other server to send emails through SMTP in a web app based on Drupal.
The first thing i've done is ckecking the server with telnet and the result is the following message.
Command Line syntax:
telnet smtp.mydomain.com 587
Result:
Trying XXX.XXX.XX.XXX... telnet: Unable to connect to remote host: Connection timed out
After googling and reading some posts about different solutions:
- I can connect from other different machines to the SMTP server. So i discard the SMTP server as origin of the problem.
- The statement on 1 makes me think that it is a firewall problem. Then, I've checked iptables.
Command Line syntax:
iptables -L
Result:
Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination
I understand that the server is open and it has the default configuration with no rules.
- I've found that the server has UFW, but it is not running.
- Following the advice of kasperd in comments: 3rd comment
netstat -ntlp
result:
(Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:36990 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:6082 0.0.0.0:* LISTEN - tcp6 0 0 :::111 :::* LISTEN - tcp6 0 0 :::8080 :::* LISTEN - tcp6 0 0 :::80 :::* LISTEN - tcp6 0 0 :::46645 :::* LISTEN - tcp6 0 0 :::22 :::* LISTEN - tcp6 0 0 :::443 :::* LISTEN - tcp6 0 0 ::1:6082 :::* LISTEN -
Any ideas how can i fix it ?
-
alexus over 8 yearsdo
telnet X.X.X.X smtp
to telnet toSMTP
port vs intotelnet
port (which is usually disabled. -
Rufein over 8 yearsThanks for your response. I've updated my question. I've been using
telnet smtp.mydomain.com port
everytime. The port i want to connect is 587 and i can connect to the STMP server with my local machine. IS there something i am missing? -
kasperd over 8 yearsTry running
netstat -ntlp
on the server to see which services are actually listening. -
Rufein over 8 yearsThanks. I 've updated the question. I am not a sys-admin, so do you see something wrong in the output?
-
Rufein over 8 yearsThank you very much !!! You have been close. But i accept your answers because it gave me clues to resolve the problem. There was a proxy to isolate the server.