telnet: Unable to connect to remote host: Connection refused (9393 Views)
Reply
Super Advisor
Carme Torca
Posts: 584
Registered: ‎09-20-1998
Message 1 of 10 (9,393 Views)
Accepted Solution

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 ;-)
Trusted Contributor
Delrish
Posts: 266
Registered: ‎01-05-2005
Message 2 of 10 (9,393 Views)

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
Barry Lowe
Posts: 23
Registered: ‎05-08-2006
Message 3 of 10 (9,393 Views)

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
Carme Torca
Posts: 584
Registered: ‎09-20-1998
Message 4 of 10 (9,393 Views)

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
Carme Torca
Posts: 584
Registered: ‎09-20-1998
Message 5 of 10 (9,393 Views)

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
fret
Posts: 7
Registered: ‎06-07-2006
Message 6 of 10 (9,393 Views)

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
fret
Posts: 7
Registered: ‎06-07-2006
Message 7 of 10 (9,393 Views)

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
Arunvijai_4
Posts: 4,194
Registered: ‎04-07-2005
Message 8 of 10 (9,393 Views)

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
Logu_2
Posts: 28
Registered: ‎01-29-2003
Message 9 of 10 (9,393 Views)

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
Vitaly Karasik_1
Posts: 1,461
Registered: ‎10-22-2002
Message 10 of 10 (9,393 Views)

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.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.