Operating System - HP-UX
1847730 Members
3516 Online
110265 Solutions
New Discussion

services using one specific port

 
SOLVED
Go to solution
Edwin Ruiz_2
Super Advisor

services using one specific port

Hi:

I would like to know which services are using one especific port. I use netstat -na but i cant see the service name using this form. Some body knows how can i get that information?

Thanks
11 REPLIES 11
Bill Hassell
Honored Contributor

Re: services using one specific port

The /etc/services file is basically a documentation file for well-known ports. A particular service may use the port that is documented but not always--see the man pages for the daemon. To track down a port to a program requires the use of the freeware program lsof. You'll need that to find open ports, directories and files on HP-UX. Get a copy from: http://hpux.connect.org.uk/

A program does not need to have an entry in /etc/services in order to use a network port although it is considered good form to do so with well-known ports (ports less than 256) and strongly recommended for ports 256 to about 10,000.


Bill Hassell, sysadmin
Steven E. Protter
Exalted Contributor

Re: services using one specific port

Start by looking at /etc/services

A lot of port use is documented there.

There are other netstat command line options that might be helpful.

If however you are totally in the dark a sniffer can provide you a gui look at things on your box.

Here is a quite cool gui sniffer that can analyze all network traffic in X

http://hpux.connect.org.uk/hppd/hpux/Gtk/Applications/ethereal-0.9.15/

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Bill Hassell
Honored Contributor

Re: services using one specific port

Actually, IANA defines well-known ports 0-1023, with official registration available for 1024-49151. The 0-256 limit was defined by RFC 793 which has been supplanted. See the list of well-known and registerd ports aqt http://www.iana.org/assignments/port-numbers


Bill Hassell, sysadmin
Geoff Wild
Honored Contributor

Re: services using one specific port

If you want to do some blocking, have a look at ipfilter:

http://www.software.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B9901AA

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Edwin Ruiz_2
Super Advisor

Re: services using one specific port

thanks for ur help.. but i want to see all the ports chage in memory.. on linux i use netstat -ap and i get the folowing information

16564/java
tcp 0 0 salato-apl17.grup:43536 salato-apl16.grupo:3060 ESTABLISHED 16564/java
tcp 0 0 salato-apl17.grup:43537 salato-apl16.grupo:3060 ESTABLISHED 16564/java
tcp 0 0 salato-apl17.grup:43538 salato-apl16.grupo:3060 ESTABLISHED 16564/java
tcp 0 0 salato-apl17.grup:43539 salato-apl16.grupo:3060 ESTABLISHED 16564/java
tcp 0 0 salato-apl17.grup:43544 salato-apl16.grupo:3060 ESTABLISHED 16564/java
tcp 0 0 salato-apl17.grup:43545 salato-apl16.grupo:3060 ESTABLISHED 16564/java
tcp 0 0 salato-apl17.grup:44558 salato-apl16.grupo:3060 ESTABLISHED -

Is there one similar command on HP-UX.

Thanks
Cesare Salvioni
Trusted Contributor
Solution

Re: services using one specific port

Hi
the option -n to the command netstat avoid resolving ip and port into hostnames and services.
If you use only netstat -a, the system will try to resolve al the ip adress and tcp/udp ports
The option -n (no resolv) is valid with any other netstat option, like -r to see the routing table:
with netstat -rn you will see only info in numerical form
with netstat -r the system will try to resolv ip and network addresses.
Obviously the command is faster with the option -n

Hope this helps
Con O'Kelly
Honored Contributor

Re: services using one specific port

Hi

You can also use lsof.
This is not s standard feature of HP-UX so you will need to install it.

# lsof -i
# lsof -i :

lsof is much better than netstat for showing service names and port numbers.

Cheers
Con
Edwin Ruiz_2
Super Advisor

Re: services using one specific port

Ok! thanks for all... from where can i get lsof? i want to install it...
Simon Hargrave
Honored Contributor

Re: services using one specific port

Bill Hassell
Honored Contributor

Re: services using one specific port

lsof is available from: http://hpux.connect.org.uk/ and associated mirrors.


Bill Hassell, sysadmin
Geoff Wild
Honored Contributor

Re: services using one specific port

LSOF is here:
http://hpux.ee.ualberta.ca/hppd/hpux/Sysadmin/lsof-4.71/

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.