I've read a bit about TIME_WAIT connections, and know they should be harmless to my server (connection closed, so no resource connected with this socket).
Recently, my server reached the magic number of 60k ports in TIME_WAIT state; and I'm wondering if I'll run out of free ports?
My server uses dynamic local ports from this pool set in kernel:
# sysctl net.ipv4.ip_local_port_range
net.ipv4.ip_local_port_range = 32768 61000
When creating a new connection will it use one of the TIME_WAIT ports? or try to bind with a different, open port?
If I set this variable to ports 1024-65535, What would happen if I have some application running on ports in that range?
This is not a question how to minimize the wait of TIME_WAIT connection states.
Current kernel modifications:
# sysctl net.ipv4.tcp_tw_recycle
net.ipv4.tcp_tw_recycle = 0
# sysctl net.ipv4.tcp_tw_reuse
net.ipv4.tcp_tw_reuse = 1
# sysctl net.ipv4.tcp_fin_timeout
net.ipv4.tcp_fin_timeout = 30
# sysctl net.ipv4.tcp_timestamps
net.ipv4.tcp_timestamps = 1
# sysctl net.ipv4.tcp_sack
net.ipv4.tcp_sack = 1