Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

 
discard

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

Browse other questions tagged or ask your own question.