HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

Opening port in HPUX

 
Sac77
Advisor

Opening port in HPUX

Hi Guys,

I am trying to open the port in hpux.

I've enterd the port in /etc/services but still reciving the below error

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

please help thanks!
19 REPLIES
Johnson Punniyalingam
Honored Contributor

Re: Opening port in HPUX

Hi Sac,

can please help to post the entry to put under the /etc/services ..?

after edting did you issue

# inetd -c (to reinitilze) try if helps.

# telnet 21000

Thanks,
Johnson
Problems are common to all, but attitude makes the difference
Sac77
Advisor

Re: Opening port in HPUX

Here you go,

host > egrep '28000|29000' /etc/services
28000 28000/tcp
29000 29000/tcp

I've already tried to inetd -c but dosent work.
Sac77
Advisor

Re: Opening port in HPUX

Sorry grep the wrong port -

host > grep 21000 /etc/services
21000 21000/tcp
Johnson Punniyalingam
Honored Contributor

Re: Opening port in HPUX

>>host > egrep '28000|29000' /etc/services
28000 28000/tcp
29000 29000/tcp
<<

# telnet 28000
# netstat -an|grep 28000 or 29000

Thanks,
Johnson
Problems are common to all, but attitude makes the difference
Sac77
Advisor

Re: Opening port in HPUX

Hi Johnson,

my 28000 is working fine...
but not 21000 would you please advise.

Also I need to stop this port from listing state. can advise me for the same. thanks!

> netstat -an | grep 28000
tcp 0 0 *.28000 *.* LISTEN
Steven Schweda
Honored Contributor

Re: Opening port in HPUX

> I am trying to open the port in hpux.

What does this mean, exactly?

> I've enterd the port in /etc/services [...]

And what did you expect this to do, exactly?

/etc/services provides a mapping between port
numbers and service names. It does not cause
any program to be run. (And it can't stop
most programs from running, either.)

man services

> [...] Connection refused

This normally means that there's no program
which is running (or registered as ready to
run) which is listening (or willing to
listen) to that port.

> # inetd -c [...]

This causes inetd to re-read _its_
configuration file (which is _not_
/etc/services). If you put something into
_that_, it might make a difference.

man inetd
man inetd.conf
Steven Schweda
Honored Contributor

Re: Opening port in HPUX

> Also I need to stop this port from listing
> state. [...]

So, take something out of inetd.conf (or stop
the listening program, if it isn't started by
inetd).

Give /etc/services a (well deserved) rest.
Johnson Punniyalingam
Honored Contributor

Re: Opening port in HPUX

my 28000 is working fine...
but not 21000 would you please advise.

how is your entry.? Does it look like below


Example:-
serive name port comment
omni 5555/tcp # DATA PROCTECTOR

>>>Also I need to stop this port from listing state. can advise me for the same. thanks!>
netstat -an | grep 28000
tcp 0 0 *.28000 *.* LISTEN<<<<


You can comment from /etc/service "port 28000" & inetd -c


Thanks,
JOhnson
Problems are common to all, but attitude makes the difference
Steven Schweda
Honored Contributor

Re: Opening port in HPUX

> You can comment from /etc/service "port
> 28000" & inetd -c

Yes, you can, but don't be amazed if it MAKES
NO DIFFERENCE.


PLEASE, GIVE /etc/services A (well deserved) REST.
Johnson Punniyalingam
Honored Contributor

Re: Opening port in HPUX

Hi ,

Apologies for missing some thing..?

have you put entry also in the /etc/inetd.conf file ..? for your new port which you are recently adding..?


Thanks,
Johnson
Problems are common to all, but attitude makes the difference
Johnson Punniyalingam
Honored Contributor

Re: Opening port in HPUX

Hi Sac,
please see comment from >>Steven Schweda <<
you can comment your port 28000" but not effect, while "inet.conf" you can comment service name which is pointing to the port "28000"

>>>>Steven Schweda <<

Thanks lot for correcting me.

rgds,
Johnson

Problems are common to all, but attitude makes the difference
Sac77
Advisor

Re: Opening port in HPUX

have you put entry also in the /etc/inetd.conf file ..? for your new port which you are recently adding..? --- NO

Which entry do i need to put ?
Johnson Punniyalingam
Honored Contributor

Re: Opening port in HPUX

yes,

before that what is the purpose for adding the port "21000"

Example:-

entry for DATA-PROTECTOR under /etc/services

# grep omni /etc/services
omni 5555/tcp # DATA-PROTECTOR

entry for DATA-PROTECTOR under /etc/inet.conf

# grep omni /etc/inetd.conf
omni stream tcp nowait root /opt/omni//lbin/inet inet -log
/var/opt/omni//log/inet.log
#

Thanks,
Johnson
Problems are common to all, but attitude makes the difference
dirk dierickx
Honored Contributor

Re: Opening port in HPUX

note that _all_ ports on hpux are open by default, what you are trying to do is binding a service to a certain port number, there's a difference there.
Laurent Menase
Honored Contributor

Re: Opening port in HPUX

what is the daemon you are trying to add?

/etc/services is only a table to define names of ports used by applications which are doing
getservbyname()

It doesn't open a service.


A service can be launched by inetd like telnetd/remshd or by itself like sshd.


inetd create the socket and when an inbound connection is made, it launches a daemon process which will use its stdin/stdout to use the socket provided.

other server daemon process must proceed to opening a socket, binding and accepting the client socket.


an example how to use inetd:

======== /bin/totosrv =======
#/tmp
!/usr/bin/ksh
echo you are logged as $(id)
echo ">> \c"
while read a
do
a=$(echo $a |tr -d "\015")
$a
echo ">> \c"
done
==============================
====== in /etc/services add ======
totosrv 32123/tcp
===================================
=======in /etc/inetd.conf add======
totosrv stream tcp wait toto /bin/toto /bin/toto
==================================


# inetd -c

# telnet localhost totosrv
Trying...
Connected to localhost.
Escape character is '^]'.
you are logged as uid=125(toto) gid=10(tty)
>> ls /home
toto
titi
tutu
>> exit
Connection closed by foreign host.









WilliamSmith11
Super Advisor

Re: Opening port in HPUX

Hi , have you solved the connection socket?

I have done this but it is not working , please see my attachment
rperez
Steven Schweda
Honored Contributor

Re: Opening port in HPUX

> I have done this but it is not working ,
> please see my attachment

1. Please start your own thread for your own
problem.

2. So far as I can tell, we never did learn
what Sac77 was trying to do. You might begin
your new thread with some explanation of what
_you_ are trying to do.
Laurent Menase
Honored Contributor

Re: Opening port in HPUX

I made some typo:
france/=>more /bin/totosrv
#!/usr/bin/ksh
echo you are logged as $(id)
echo ">> \c"
while read a
do
a=$(echo $a |tr -d "\015")
$a
echo ">> \c"
done

france/=> ls -l /bin/totosrc
-r-xr-xr-x 7 bin bin 77852 Jan 12 2007 /bin/totosrv


Suraj K Sankari
Honored Contributor

Re: Opening port in HPUX

Hi,
please post this command's output

grep telnet /etc/inetd.conf

if any hash is there at begning of the line remove it and do

# inetd -c

then try with telnet localhost 21000

Suraj