Operating System - HP-UX
1833771 Members
2109 Online
110063 Solutions
New Discussion

When trying to telnet I get "connection refused".

 
Mike_305
Super Advisor

When trying to telnet I get "connection refused".

Hi,

To resolve this I have tried following and still I can???t telnet.

1. First ensure that telnet is an available service. You should see the following lines:

vi /etc/services
telnet 23/tcp # Virtual Terminal Protocol

vi /etc/inetd.conf
telnet stream tcp nowait root /usr/lbin/telnetd telnetd
These lines should be uncommented.

2. Telnet must be listening in order for you to make a connection

netstat -a | grep *.telnet should return the line
tcp 0 0 *.telnet *.* LISTEN

3. If it is not "listening" or you had to make a modification to your
inetd.conf file do the following:
inetd -c

This rereads your inetd.conf file. Now repeat step 2 to see if telnet is listening.

Shells:
A shell is a most common issue with telnet and ftp connection refused messages.

Create the following file on the system refusing the connection:
vi /etc/shells #create/edit this file to contain the following valid login shells#
/sbin/sh
/usr/bin/sh
/usr/bin/rsh
/usr/bin/ksh
/usr/bin/rksh
/usr/bin/csh
/usr/bin/keysh
/sbin/rsh
/sbin/ksh
/sbin/rksh
/sbin/csh
/sbin/keysh

Test telnet after adding this file.


Security for telnet:
vi /var/adm/inetd.sec

Look for a line that references telnet and the word allow or deny. If you see a line like that your system may be restricted from using this service on this system.

Example of an entry:

telnet deny 192.23.4.3 193.14
this entry denies a specific host 192.23.4.3, and an entire subnet 193.14.

telnet allow 192.23.4.3 193.14
this entry allows only the host 192.23.4.3, and any hosts on the subnet 193.14.
Everyone else is denied.

Telnet sessions:
To check the number of telnet sessions you have available, on the box refusing the connection do:

ls /dev/pty |wc -w
ls /dev/ptym | wc -w
60 are the default, if you see 60 as a response, yours has never been increased and you may be running out of telnet sessions.

To increase your telnet sessions, we need to increase the npty
Parameter. This is a kernel parameter so it will require a reboot.
Follow the 2 steps listed below:

1. Use SAM
Kernel
Configurable Parameters
npty (10.20 and 11.0)
nstrpty (11.0 only)

Set NPTY and NSTRPTY to 512, save and reboot. NPTY and NSTRPTY are the desired number of telnet sessions.

2. Rebuild the special device files at the command prompt as follows:

insf -d ptys -n 512 512 being the number you set NPTY in SAM (10.20 and
11.0)
insf -d ptym -n 512 (10.20 and 11.0)

insf -d pts -s 512 -e -v (for 11.0 only )

That's it; your sessions have been increased to 512.

Thanks in Advance.

Thanks,

Mike
If there is problem then don't think as problem, think as opportunity.
6 REPLIES 6
Arockia Jegan
Trusted Contributor

Re: When trying to telnet I get "connection refused".

Mike,

If the telnet access(TCP port 23 is blocked) is restricted in your firewall side you may have this problem.
PIYUSH D. PATEL
Honored Contributor

Re: When trying to telnet I get "connection refused".

Hi,

Check the NIC card statistics first. Also check your netstat output:

# netstat -s

If there are a lot of packet errors that error rate is high, it is a symptom of many possible causes including improper duplex negotiation.

To verify whether duplex negotiation is a cause, use lanadmin to check at server end e.g.

# lanadmin -x lan0

Also, check at the switch end.

If it has been identified as a cause (e.g. your server NIC has been at 100HD (half duplex) and your switch end is 100FD), you can set it at system runtime using

# lanadmin -X 100FD lan0

For the changes to take effect permanently even after a reboot, check out the files in:

# ls /etc/rc.config.d/hp*conf

Identify the driver you are using and modify its configuration file accordingly to hardcode the duplex mode.

Hope this helps. Regards.

Piyush
linuxfan
Honored Contributor

Re: When trying to telnet I get "connection refused".

Hi Mike,

Did you try enabling the connection logging for inetd.

/usr/sbin/inetd -l

tail -f /var/adm/syslog/syslog.log
(when trying to telnet.) see any errors?

Are you trying to telnet in as root or a regular user?

Did you install any patches which caused this issue?


-Ramesh
They think they know but don't. At least I know I don't know - Socrates
Mike_305
Super Advisor

Re: When trying to telnet I get "connection refused".

Hi Guys,

My problem is resolve. It was related to NIS. When I added NIS to this system some how my nsswitch.conf file got messed up. Now every thing is fine. It was not reading services file.

Thanks for quick reply.

Thanks,

Mike
If there is problem then don't think as problem, think as opportunity.
Michelle Boyle
Occasional Contributor

Re: When trying to telnet I get "connection refused".

Don't know if the above answers have already solved your problem but if you are on 11.11 and have put on patches you might want to try inetd -b twice..

If that works then you need to modify the /sbin/init.d/inetd file as instructions below indicate. A patch caused a problem where telnet ftp ect would not work - corrected patch is on the way soon.

comment all the lines in start part of the script /sbin/init.d/inetd and insert three lines:

inetd -b
sleep 2
inetd -b


Thanks,
Michelle
Mike_305
Super Advisor

Re: When trying to telnet I get "connection refused".

Hi Michelle,

Yes, my problem is tesolve and I am running 11.00.

Thanks,

Mike
If there is problem then don't think as problem, think as opportunity.