Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question
Are these inbound connections or outbound connections? – David Schwartz Dec 7 '11 at 1:17
Well, server is bored now, because it's late. I will check this tomorrow when number of users will grow. Currently: (~15k TIME_WAIT) 6973 IN 9017 OUT – csgwro Dec 7 '11 at 1:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.