Linux – telnet fails to connect: Connection closed by foreign host


I try to connect to localhost with telnet:

% telnet localhost 6311

This connection succeed, but when I connect by external IP of my computer, connection fails:

% telnet x.x.x.x 6311
Trying x.x.x.x...
Connected to x.x.x.x
Escape character is '^]'.
Connection closed by foreign host.

What could be wrong?

Best Answer

  • The problem was with the service ( that was running on 6311) The servise just was not configured to work with remote access.

    It means, telnet was OK :)