Telnet: Unable to connect to remote host

6,044

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.

Share:
6,044

Related videos on Youtube

Rufein
Author by

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, 2022

Comments

  • Rufein
    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:

    1. I can connect from other different machines to the SMTP server. So i discard the SMTP server as origin of the problem.
    2. 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.

    1. I've found that the server has UFW, but it is not running.
    2. 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
      alexus over 8 years
      do telnet X.X.X.X smtp to telnet to SMTP port vs into telnet port (which is usually disabled.
    • Rufein
      Rufein over 8 years
      Thanks 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
      kasperd over 8 years
      Try running netstat -ntlp on the server to see which services are actually listening.
    • Rufein
      Rufein over 8 years
      Thanks. I 've updated the question. I am not a sys-admin, so do you see something wrong in the output?
  • Rufein
    Rufein over 8 years
    Thank 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.