AIX - Ports in use and how to check them

I have two issues below that I need help with.

First, I have an  example port receiving details that it is in use or blocked. How do I check to see what is using this port?

servername:/> netstat | grep -v grep | grep 201

udp4       0      0  servername.201    *.*

Second, I have an application that uses ports 1911-1919. These are application specific ports. How do I check what is using them and how to free up the ports?

servername:/> netstat -an | grep .191
tcp        0      0  1X.2XX.XXX.XX.9638    XX.XXX.XXX.XX.1913    ESTABLISHED
tcp        0      0  1X.2XX.XXX.XX.9639     XX.XXX.XXX.XX.1913    ESTABLISHED
tcp        0      0  1X.2XX.XXX.XX.9640     XX.XXX.XXX.XX.1913    ESTABLISHED
tcp        0      0  1X.2XX.XXX.XX.9641     XX.XXX.XXX.XX.1913    ESTABLISHED
tcp4       0      0  1X.2XX.XXX.XX.9642     XX.XXX.XXX.XX.1913    ESTABLISHED
tcp4       0      0  *.1911                *.*                    LISTEN
tcp4       0      0  *.1912                *.*                    LISTEN
tcp4       0      0  *.1914                *.*                    LISTEN
tcp4       0      0  *.1913                *.*                    LISTEN
Who is Participating?
And if you don't want to (or can't) use lsof:

1) Issue

netstat -Aan | grep <portno>

2) Use the address displayed in the first column (the PCB = protocol control block) to issue:

rmsock <pcb_address> tcpcb

Example for port 13 (inetd):

netstat -Aan | grep "*.13 "
f100060001814b98 tcp4       0      0  *.13               *.*                LISTEN

rmsock f100060001814b98 tcpcb
The socket 0x1814808 is being held by proccess 131162 (inetd).

Freeing up ports is only possible by killing the processes which use them.
AIX25Author Commented:
I used both methods and both worked properly.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.