If I have a port number I want to use like 23456 and want to know if it is already in use I do the following steps on all my cloverleaf servers since we require all port numbers be unique across all our cloverleaf servers:
list_ports.ksh | grep 23456
grep 23456 /etc/services
netstat -a | grep 23456
In the future my dream list has me creating a list of all the available ports and when we want a new port we remove one from that list.
As mentioned earlier stay away from using ports in the ephemeral range and if you don’t know what that means start by keeping all you port numbers less than 32768 (32K).
Some places have designated certain port ranges for test and prod and I also like that idea even though it is too late for us.
Here is the script list_ports.ksh I worte to help with seeing if a cloverleaf site is already using a given port number:
#!/usr/bin/ksh
#
# Begin Module Header ==============================================================================
#
#——
# Name:
#——
#
# list_ports.ksh
#
#———
# Purpose:
#———
#
# list all the ports defined in the NetConfig for all sites
#
#——-
# Notes:
#——-
#
# Assumption:
#
# – all sites have a NetConfig file
#
# Normal Usage:
#
# list_ports.ksh > x.x
#
#———
# History:
#———
#
# 2001.01.30 Russ Ross
#
[code]#!/usr/bin/ksh
#
# Begin Module Header ==============================================================================
#
#
# Name:
#
#
# list_ports.ksh
#
#
# Purpose:
#
#
# list all the ports defined in the NetConfig for all sites
#
#
# Notes:
#
#
# Assumption:
#
# – all sites have a NetConfig file
#
# Normal Usage:
#
# list_ports.ksh > x.x
#
#
# History:
#
#
# 2001.01.30 Russ Ross
#
Russ Ross
RussRoss318@gmail.com