System Administration
Showing results for 
Search instead for 
Do you mean 

telnet: Unable to connect to remote host: Connection refused

SOLVED
Go to Solution
Super Advisor

telnet: Unable to connect to remote host: Connection refused

Hi,

I have one server, that when I do telnet, it shows me this message:

# telnet 127.0.0.1 25
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

I have this configuration:

# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.30.1.128 0.0.0.0 255.255.255.128 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 10.30.1.129 0.0.0.0 UG 0 0 0 eth0

# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:50:56:95:75:4E
inet addr:10.30.1.178 Bcast:10.30.1.255 Mask:255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:23587191 errors:0 dropped:0 overruns:0 frame:0
TX packets:26078566 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1787962940 (1705.1 Mb) TX bytes:913539197 (871.2 Mb)
Interrupt:9 Base address:0x1080

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:260902 errors:0 dropped:0 overruns:0 frame:0
TX packets:260902 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:65076725 (62.0 Mb) TX bytes:65076725 (62.0 Mb)


What can I do?
Thanks a lot of!
Carmen.
Users are not too bad ;-)
9 REPLIES
Trusted Contributor Trusted Contributor

Re: telnet: Unable to connect to remote host: Connection refused

You tried to connect to port #25. Usuallt smtp listens on port 25. Please check your smtp daemon. Also you should check that the server listen on port 25 or not (netstat -n) and at last may be your daemon is not listen on loopback interface . try to telnet to 10.30.1.178 port 25

Advisor

Re: telnet: Unable to connect to remote host: Connection refused

Carmen, do you have telnet enabled?

Look for the file in /etc/xinetd.d/telnet and edit the line with 'disable' on to say 'no' instead of 'yes', then restart xinetd with the command 'service xinetd restart'. Off the top of my head you may also need to add some entries into /etc/securetty for pts/0, pts/1 etc.

Telnet is usually enabled on port 23 - any reason why you are using 25? That's the smtp port.

I'll let others comment on the security issues involved with telnet...
Super Advisor

Re: telnet: Unable to connect to remote host: Connection refused

Hi,

I have disable telnet
#telnet 127.0.0.1 25

I need to connect to port 25, because one application needs its (don't ask me why!!), and its the same message:

# telnet 127.0.0.1 25
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

Any idea?
Users are not too bad ;-)
Super Advisor

Re: telnet: Unable to connect to remote host: Connection refused

Hi,

# telnet 10.30.1.178 25
Trying 10.30.1.178...
telnet: Unable to connect to remote host: Connection refused

Its the same. How can I activate port 25?
Thanks!
Users are not too bad ;-)
Occasional Advisor

Re: telnet: Unable to connect to remote host: Connection refused

telnet isn't the pbl.
Here, telnet is used only on the client side to connect to a remote port.
You should also use netcat or nmap to check if the port is open.

So concerning the port 25, it's the standard port for SMTP. An MTA (Mail transfert Agent) should be binded here.

So if people ask you for the port 25 to be binded, I supposed they want to use an MTA !
Choose your favorite MTA an instal it (postfix, sendmail, qmail....)
Occasional Advisor

Re: telnet: Unable to connect to remote host: Connection refused

One more thing : you maybe only have to start the MTA. It's maybe already installed.

To check the runing services on this host, use "netstat -ltpn"
That would give you all the open port and also the software binding it
Honored Contributor Honored Contributor

Re: telnet: Unable to connect to remote host: Connection refused

Hi Carmen,

Try to start your sendmail or postfix daemon to listen in port '25'.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Advisor

Re: telnet: Unable to connect to remote host: Connection refused

what does the "netstat -nap|grep 25 " say.
Make sure your application is running and its service binds with the loopback interface.

-logu
Honored Contributor Honored Contributor

Re: telnet: Unable to connect to remote host: Connection refused

If you have rpm-based distro, you should
1) check if sendmail installed :

rpm -qa|grep sendmail

2) activate & start sendmail

chkconfig sendmail on
servicew sendmail start

Of course you can use postfix or other MTA instead of sendmail.