1833555 Members
3092 Online
110061 Solutions
New Discussion

netstat

 
SOLVED
Go to solution
srinivasa rao vaddadi
Frequent Advisor

netstat

how can i check what are all the ports (used and unused) allocated to my server.
And how can we decide which port belongs to which application or ...
14 REPLIES 14
Arunvijai_4
Honored Contributor

Re: netstat

Check with /etc/services and # netstat -na

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

Re: netstat

hello

under /etc/services u can see all ur ports
if u install an applikation it should make a entry in this file

netstat -a
man netstat

regrads gga
Joseph Loo
Honored Contributor
Solution

Re: netstat

hi,

so, how is your patch installation?

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=968532

guess u have not assign any points:

http://forums1.itrc.hp.com/service/forums/pageList.do?userId=CA1323105&listType=unassigned&forumId=1

ports your server is listening to:
# netstat -an|grep -i listen

ports your server has establish connection:
# netstat -an|grep -i estab

regards.
what you do not see does not mean you should not believe
AwadheshPandey
Honored Contributor

Re: netstat

man netstat


check ur /etc/services file to view all informations.

Awadhesh
It's kind of fun to do the impossible
Muthukumar_5
Honored Contributor

Re: netstat

b) how can we decide which port belongs to which application?

Ports and service name allocation is done based on /etc/services file.

It will be like,

servicename port number/protocol

a) how can i check what are all the ports (used and unused) allocated to my server?

You can check with netstat or lsof (free downloadable tool).

i) Using netstat
# netstat -na | grep -w

ii) Using lsof
# lsof -P

-Muthu
Easy to suggest when don't know about the problem!
RAC_1
Honored Contributor

Re: netstat

netstat -an
lsof -i tcp
lsof -i udp
There is no substitute to HARDWORK
srinivasa rao vaddadi
Frequent Advisor

Re: netstat

thanku all for the quick response.
i got thr. netstat -nr.
Arunvijai_4
Honored Contributor

Re: netstat

You can download lsof from,
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"
Muthukumar_5
Honored Contributor

Re: netstat

netstat -nr is used for getting routing entries not port information. Use netstat -in :)

-Muthu
Easy to suggest when don't know about the problem!
Senthil Prabu.S_1
Trusted Contributor

Re: netstat

Check the /etc/services to find of services that are running on your service. These services will be using 0 -1024 standard ports.


Man netstat to find the list of options to find the various port that are open on your machine.

And also use port scanners like nmap to find the various ports opened and services running using those ports.

HTH,
Prabu.S
One man's "magic" is another man's engineering. "Supernatural" is a null word.
沈國維
Occasional Advisor

Re: netstat

netstat -a list all port status.

And this is a common tcp port usege.
Matthew Ghofrani
Regular Advisor

Re: netstat

One important item to grep for is LISTEN in netstat.
"netstat -an|grep LISTEN"
This would show all the active listen ports which shows a lot more than /etc/services and the reason is that applications could start their on ports outside of /etc/services.

Matthew from Boston
Life is full of bugs
srinivasa rao vaddadi
Frequent Advisor

Re: netstat

thanku all , i got the answer by using netstat -an
rick jones
Honored Contributor

Re: netstat

A small but sematicaly important nit - the /etc/services file does not really "allocate" a port number - at least not in the sense of "reserving" it in any enforced way. It merely maps a port number to a more human friendly name. Actual _use_ of a given port number is on a first-come, first-served basis.

And just because something appears in /etc/services, it does not mean that service is active on the system - there are many many many more things in /etc/services than are enabled - perhaps even available - on HP-UX.

A port is only in use if you see it in netstat or lsof output.
there is no rest for the wicked yet the virtuous have no pillows