“Telnet connection refused by remote host” error – Causes & Fixes

telnet connection

Table of Contents

Learn how to resolve the “Telnet Connection Refused by Remote Host” error. Our Server Management Support team is here to help you with your questions and concerns.

 

Telnet Connection Refused by Remote Host – Causes & Fixes

Telnet errors are sometimes hard to decode. Here is one such error:

telnet: connection refused by remote host.

At 1onlyhost, we help server owners resolve these errors as part of our Dedicated Support Services.

Today, we are going to take a look at the top reasons behind this error and how to fix them.

The telnet service is not running

One of the most likely reasons behind the error is that the telnet service isn’t installed on the machine the user is trying to connect.

Telnetd is the daemon that supports Telnet protocol. So, for telnet communication to happen smoothly, telnet service has to be installed at the destination.

Otherwise, there’s no daemon to answer the telnet connection request from the source, resulting in an error as seen below:

telnet localhost 1181
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

How to fix this?
In such cases, our Support Engineers ask customers to check if Telnet is installed on the machine they are trying to connect. If not, we have to install it. For example, on Linux Ubuntu servers, we install the telnet tool with this command:

apt-get install telnetd

Then, we have to get the service up and running on the server. We can do this with this command:

/etc/init.d/inetd restart

Moreover, we have to make sure the machine that we are connecting to does not block the standard telnet port 23. If so, have to open the port in the server firewall.

For example, we can allow the telnet port in UFW as seen here:
ufw allow 23/tcp

However, Telnet is highly insecure as the communication is not encrypted. In other words, your passwords and all other data are transferred as plain text which is not secure.

So, our Support Experts recommend using Secure Shell(SSH) instead of telnet. And, only use telnet unless it’s necessary.

Telnet disabled in the configuration file

This error also occurs if the telnet service is disabled in its configuration file.

Xinetd service controls telnet in Linux. The parameter disable in xinetd configuration file “/etc/xinetd.d/telnet” decides whether the telnet service should be disabled in the server or not.

We’ve seen instances where users forget to enable this parameter which can cause problems.


service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = yes
}

How to fix this?
Our Support Experts ensure that the telnet service is enabled on the destination server by changing the parameter :

disable=no

Most importantly, we take a backup of this file before making changes. Also, we restart the xinetd service to reflect these changes.

[Need help in installing telnet service on your server? We can help you here.]

Firewall restrictions

Similarly, this error may occur when the firewall in between is rejecting the connections.

Telnet Connection Refused by Remote Host – Causes & Fixes

For example, customers run into this error when the firewall restricts connections:

$ telnet 52.83.122.133 200
Trying 52.83.122.133...
telnet: Unable to connect to remote host: Connection refused

This error means that the firewall is blocking connections to the specified port on the remote host. The firewall can be at the remote host or at the intermediate level.

How to fix this?
In such cases, our Support Engineers get the traceroute results from the client side to the destination end. This gives us an idea where the connection is getting interrupted.

If the connection is interrupted at the remote host, then we make sure that the required port is opened in the server firewall. Moreover, we ensure that the customer’s IP address isn’t blocked at the remote host.

Alternatively, if the connection drops at the intermediate level, then most probably the issue is at the ISP end. In such cases, customers need to contact the ISP end to fix the problem.

Service is not running

Another possible reason for this error is that there is no service listening on the connected port.

For example, server owners usually set the HTTP port to 80. Consider customers trying to connect to port 80 using telnet, but the HTTP service isn’t running on the server.

So, users receive the below error:

$ telnet xx.xx.xxx.xxx 80
Trying xx.xx.xxx.xxx...
telnet: Unable to connect to remote host: Connection refused

How to fix this?
In such cases, our Support Engineers first verify whether the service is enabled and running on the server. For example, on Linux servers, we check the status of the HTTP service as below:

ps aux | grep http

Further, we verify the port that this service is listening to. For example, we use the netstat command to verify the port on which the HTTP service listens. In addition to that, this command also shows which IP address it’s actually bound to.

netstat -lnpt | grep :80

So, if the customer uses the wrong port or IP address, we’ll update them to use the correct details for connecting.

More Troubleshooting Tips

Furthermore, the error may be due to one of the following reasons as well:

  • We have to verify that we are using the correct port number for the service we are trying to access. Different services use different default ports. So we have to specify the correct port in our Telnet command.
  • If the remote server is not reachable from our client machine we will run into the error. Network problems, routing issues, or DNS resolution problems can result in the server being unreachable.

    So we have to ensure the remote server is reachable.

  • Additionally, a high server load or resource exhaustion on the remote server can also lead to connection refusal. So, we have to check the server’s resource utilization and see if it needs to be restarted or scaled.
  • In some cases, some servers may have IP whitelisting or access control lists that restrict access to specific IP addresses. So we have to make sure that our client’s IP address is allowed to connect to the server.
  • Finally, it is a good idea to review the logs on the remote server for any error messages or indications of why the connection is being refused.

[Need an Expert to resolve this error? Click here, and get one of our Support Engineers for your help.]

Conclusion

In short, “telnet: connection refused by the remote host” is a common error raised by the customers. This may be due to firewall restrictions, disabled telnet service, etc. Today, we’ve discussed the top reasons behind this error and how our Dedicated Support Engineers fix them.

Leave a Comment

Your email address will not be published. Required fields are marked *

Social Share

Facebook
Twitter
LinkedIn
Telegram

Cheapest Web Hosting

Fasters Web Hosting Promo
Scroll to Top

Launch your Website at RS599

Create a professional website yourself with our domain hosting combo. Get Extra benefits at this Year end Sale with 10% OFF and Enjoy Amazing Deels on Shared Hosting!

Starting at Only RS599/Year

Year End Sale

Hours
Minutes
Seconds

Use Code STARTBIZ at Checkout.

Create an earning opportunity with A Web Hosting Business

Become reseller and start reselling domains, web hosting, ssl certificates and More.

45% OFF

Starting at RS399/Month

Hours
Minutes
Seconds

Use coupon: at the checkout.