Operating System - HP-UX
1833451 Members
3121 Online
110052 Solutions
New Discussion

Re: how do I make sure the port is opened

 
Hanry Zhou
Super Advisor

how do I make sure the port is opened

Hi,

we are trying to telnet to a port to confirm if the port is opened or not:
telnet a.b.c.d port#
but always getting "connection refused" message. However, when I run lsof or netstat -a , I don't see this particular port is using.

Is this correct way to test if the port is running or not.
none
9 REPLIES 9
Alex Lavrov.
Honored Contributor

Re: how do I make sure the port is opened

well, telnet is executed by inetd, so only when it's beeing made a connection to the port, there is actually telnetd is executed. when there are no attempts, the port is not in use, that's why you don't see anything.

You should check if telnetd presents in /etc/inet.d file.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Uday_S_Ankolekar
Honored Contributor

Re: how do I make sure the port is opened

Is that prot listed in /etc/services file?

-USA..
Good Luck..
Rick Garland
Honored Contributor

Re: how do I make sure the port is opened

A neat utility for finding out open ports is called "nmap". Available from porting archive,
http://gatekeep.cs.utah.edu

Can install on your local system and run 'nmap localhost' The output will be the open ports on the localhost system.
Hanry Zhou
Super Advisor

Re: how do I make sure the port is opened

the port is not being used as far as I can see by lsof and netstat -a. However, the question is when we run "telnet ip 7003", we got connection refused. What does that mean? do that mean that the port is not opened on the server ?
none
Alex Lavrov.
Honored Contributor

Re: how do I make sure the port is opened

If the program that must handle this port listed in /etc/inetd.conf and /etc/services, you won't see it with lsof, because it will be brought up by inetd, only when this port is accessed (that's the idea).

If it's stand alone daemon and you don't see any binds to this port, it means the daemon is not running.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Rick Garland
Honored Contributor

Re: how do I make sure the port is opened

The port 7003 on IP is not accepting telnet connections. Could be open for other types of connections but not telnet
Biswajit Tripathy
Honored Contributor

Re: how do I make sure the port is opened

If your "netstat -a" shows that the port is in LISTEN
state in the server, but still you get connection refused
message in the client, then chances are there is a
firewall running which is blocking the connection AND
replying with "connection refused" message.

- Biswajit
:-)
Mel Burslan
Honored Contributor

Re: how do I make sure the port is opened

also make sure that, the host you are coming from is not in the list of hosts blocked by any rule in the /etc/inetd.sec file if all other settings seems to be in correct order.


________________________________
UNIX because I majored in cryptology...
Ermin Borovac
Honored Contributor

Re: how do I make sure the port is opened

"Connection refused" usually means that no program is listening on the port. You can say that port is opened (i.e. not blocked by firewall or similar), but not used.