Re: how to release a port in hpux (2030 Views)
Reply
Valued Contributor
Sreer
Posts: 222
Registered: ‎07-02-2008
Message 1 of 5 (2,030 Views)
Accepted Solution

how to release a port in hpux

Hi Gurus,

I have to close a port in my hpux box.

[root@caefr0p006 ~]# cat /etc/services | grep -i 7006
afs3-errors 7006/tcp # error interpretation service
afs3-errors 7006/udp # error interpretation service
[root@caefr0p006 ~]#
[root@caefr0p006 ~]#
[root@caefr0p006 ~]# netstat -an | grep -i 7006
tcp 0 0 0.0.0.0:7006 0.0.0.0:* LISTEN
tcp 0 0 44.47.100.106:7006 152.9.100.40:57767 TIME_WAIT
tcp 0 0 44.47.100.106:7006 152.9.100.40:57765 TIME_WAIT
tcp 0 0 44.47.100.106:7006 152.9.100.40:57764 TIME_WAIT
tcp 0 0 44.47.100.106:7006 152.9.100.40:57763 TIME_WAIT
tcp 0 0 44.47.100.106:7006 152.9.100.40:57762 TIME_WAIT
tcp 0 0 44.47.100.106:7006 152.9.100.40:57760 TIME_WAIT
tcp 0 0 44.47.100.106:7006 152.9.100.40:57759 TIME_WAIT
tcp 0 0 44.47.100.106:7006 152.9.100.40:57757 TIME_WAIT
tcp 0 0 44.47.100.106:7006 152.9.100.40:57756 TIME_WAIT
tcp 0 0 44.47.100.106:7006 152.9.100.40:57754 TIME_WAIT
tcp 0 0 44.47.100.106:7006 152.9.100.40:57751 TIME_WAIT
[root@caefr0p006 ~]#

My application team is asking to release the port 7006 .

Iam not worked much on the ports side.

Cpould you pls guide me how to close the port as listed above?

waiting for help
Rgds
Sree
Exalted Contributor
Steven E. Protter
Posts: 33,806
Registered: ‎08-15-2002
Message 2 of 5 (2,030 Views)

Re: how to release a port in hpux

Shalom,

Standard network configuration is for the network socket to close 60 seconds after even an abnormal termination of the process.

You might want to use lsof to figure out what application is using port 7006 and shut it down.

Shutting down the application is the way to go if you want that port released.

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
Honored Contributor
Duncan Edmonstone
Posts: 5,678
Registered: ‎08-05-2000
Message 3 of 5 (2,030 Views)

Re: how to release a port in hpux

Ports are closed when a process exits, so presumably there are processes on this system holding those ports open.

Well a quick google indicates that port 7006 is often used by BMC products such as Patrol or Control-M - if you have these on your system, you might want to stop/restart all the processes relating to that...

Also, do you know what the system with IP address 152.9.100.40 is and what it does? That might give you some clue as to what the processes holding the ports open are...

Otherwise you might want to get a copy of lsof:

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.84/

then running:

lsof -i :7006

Should show you which processes have that port open

(I won't be surprised if the processe that have the port open are owned by the very application team that wants you to close them!)

HTH

Duncan


HTH

Duncan
Honored Contributor
rick jones
Posts: 3,814
Registered: ‎12-02-1996
Message 4 of 5 (2,030 Views)

Re: how to release a port in hpux

Not much to add but this - if the application is written "correctly" the only thing standing in the way of it starting again and creating a listen endpoint on port 7006 is the existing LISTEN endpoint. The endpoints still in TIME_WAIT at the time you did the netstat -an are a don't care as far as application (re)start is concerned. Again though, that is if the application is written "correctly" which is to say sets SO_REUSEADDR before it attempts to bind() to the port number.
there is no rest for the wicked yet the virtuous have no pillows
Valued Contributor
Sreer
Posts: 222
Registered: ‎07-02-2008
Message 5 of 5 (2,030 Views)

Re: how to release a port in hpux

Hi Gurus,
Thanks much for your help.

Your answers are excellent and is worked.

What I actioned is:

lsof -i:7006

identified PID

killed the PID

And the port got closed successfully.

Thanks again.

Rgds
Sree
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.