1833843 Members
2313 Online
110063 Solutions
New Discussion

Open Port?

 
SOLVED
Go to solution
Nobody's Hero
Valued Contributor

Open Port?

My dba asked me how I can ping a port, or to see if the port is open.

How can I do this with ping. If I cant,
how do I do it with lsof.
UNIX IS GOOD
7 REPLIES 7
mirco_1
Valued Contributor

Re: Open Port?

hi,

# telnet <#port>

DM.
Ralph Grothe
Honored Contributor
Solution

Re: Open Port?

lsof -i :

or

netstat -an | awk '$4~/\.$/'

or

nmap -P0 -p

or the suggested telnet client
or a custom client for the protocol
Madness, thy name is system administration
Biswajit Tripathy
Honored Contributor

Re: Open Port?

I would recommend nmap (as suggested by
Ralph). Very simple to use and very effective
(see nmap.org).

One problem with "netstat -an" is, the port
will be marked as "listen" even if it is
blocked by a firewall at lower layer.

I use the attached simple script for
portscanning (this script should run from a
remote machine). Run without any argument to
see the usage info.

- Biswajit
:-)
Raj D.
Honored Contributor

Re: Open Port?

Hi Robert ,

Download the lsof utility from http://hpux.cs.utah.edu/ , and check # lsof -i :

Also can be checked with # netstat -n | grep EST


hth,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Muthukumar_5
Honored Contributor

Re: Open Port?

To see whether a port is open or not as,

# netstat -na | grep

Another way is with telnet as,

# telnet

You have to get connected message then port is opened. Else it is not. To come back to shell then ctrl + ] will ask telnet>quit put there in that prompt.

Best utility to use is with lsof tool.

hth.
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: Open Port?

Latest version of "lsof" is here,
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.76/

Man page is at,
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.76/man.html

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Thomas Bianco
Honored Contributor

Re: Open Port?

my personal fav is nmap, from insecure.org

bear in mind this is a security tool, and it's considered... impolite... to run it against a server without the owners permission.
There have been Innumerable people who have helped me. Of course, I've managed to piss most of them off.