Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telnet [Unable to connect to remote host: Connection refused]

I was trying to create a telnet connection between Ubuntu and Guest OS (Kali). But the problem "Unable to connect to remote host: Connection refused" occurs in both Ubuntu terminal and Guest OS (Kali) Terminal. I configured Guest OS's ip settings as follows and I can send ping packets perfectly from both side.

enter image description here

According to ping packets sent and received, it seems there is no problem about connection line between these two system. But when I try to enter

In Ubuntu:

telnet ipAddressOfGuestOS

or

In Guest OS:

telnet ipAddressOfUbuntu

the terminal returns "Unable to connect to remote host: Connection refused" error. How can I handle this problem?

like image 881
Hasan Avatar asked Dec 21 '15 05:12

Hasan


People also ask

How do I fix telnet unable to connect to remote host connection refused?

Typically, you can start the telnet service with the following command. Check to make certain that the machine to which you are connecting does not block the standard telnet port 23. If that is the case, you should open the port on the server's firewall.

Why would a telnet connection be refused?

Question # 1: Why is telnet connection refused? Answer: Connection refused means that the port you are trying to connect to is not open. So either you are connecting to the wrong IP address, or the wrong port or the server is listening on the wrong port or is not running.

Can't connect to remote host connection refused connect?

A "Connection Refused" error will occur if your client sends a connection request to a remote server host, and the remote host responds to say that it refuses to accept the request. The "Connection Refused" error essentially means that the computer is not accepting connections to the requested IP address and port.

How do I fix telnet connected to address 127.0 0.1 Connection Refused?

You can solve the issue by either getting the software updated (or properly configured to listen on IPv6 if it's an option in the config file) or changing your command to telnet 127.0. 0.1 instead of telnet localhost .


1 Answers

0.Configure Guest OS via Virtualbox as follows.

VirtualBox Manager > Settings > Network 
Attached to: Bridged Adapter
Name : eth0
Advanced:
Promiscuous Mode: Allow All

1.Install telnet use this command in main OS terminal:

sudo apt-get install xinetd telnetd 

2.Edit /etc/inetd.conf in main OS using your favourite file editor with root permission,add this line:

telnet stream tcp nowait telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd

3.Edit /etc/xinetd.conf in main OS,make its content look like following:

Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/
defaults
{
# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}

4.Use this command to start telnet server in main OS:

sudo /etc/init.d/xinetd restart 

That was all. By the way, this configuration will affect just main OS which you use instead of Guest OS. That is, you can create a telnet connection just from Guest OS's terminal to main OS, not from main OS to Guest OS. Because, telnet server is in main OS. To be able to do two way telnet communication, you should repeat the steps above in Guest OS's terminal.

Resource : http://ubuntuguide.net/install-and-enable-telnet-server-in-ubuntu-linux

like image 136
Hasan Avatar answered Nov 16 '22 16:11

Hasan