1834532 Members
3620 Online
110069 Solutions
New Discussion

services question

 
SOLVED
Go to solution
navin
Super Advisor

services question

How should i know if the port is blocked in a HPUX server and how should i open a particular port
Thanks ,appreciated
Learning ...
5 REPLIES 5
Sandman!
Honored Contributor

Re: services question

Only firewalls can open or block ports. On HPUX servers a port is in use or not depending on whetehr a server is up and using it. lsof can tell you whether a service is bound to a particular port or not.
navin
Super Advisor

Re: services question

can you please lil bit more specific about the command to test if th eport is in use- i normally go with netstat or grep port number from services - have not heard anyuthing about lsof
Thanks
Learning ...
Sandman!
Honored Contributor

Re: services question

If you have lsof then the following command will determine if a particular port say 512 is in use or not. You can get lsof from HP's Porting and Archive site http://hpux.cs.utah.edu and use it as:

# lsof -i:512
or
# netstat -an | awk 'z[split($4,z,".")]==512'
skt_skt
Honored Contributor

Re: services question

"whereis lsof" and confirm if you have that

lsof >lsof.out

lsof -i tcp >lsof_tcp.out
lsof -i udp >lsof_udp.out
Ralph Grothe
Honored Contributor
Solution

Re: services question

Unfortunately, HP-UX doesn't ship lsof.
But you can stick with netstat for looking up ports currently in use on the server. (Sandmam!'s netstat line is pretty nifty as it reuses the returned last index of awk's split in situ, which is the position where the local socket's port is found; note Linux's netstat uses ":" as port separator).
However, you usually want to connect to a port from another host on whose route some packet filter may block the port.
For this to check you can use a port scanner like nmap (also not part of the standard hpux toolset) from this host.
You can get it from here
http://insecure.org/nmap/
But read the docs before using it because you may trigger off some alert with network or firewall intrusion detectors or arouse their admins' disdain.
Madness, thy name is system administration