Personal tools
You are here: Home DB2 Zlinux Tips How does TCP TIME_WAIT work?
Navigation
Log in


Forgot your password?
 
Document Actions

How does TCP TIME_WAIT work?


Well, these excerpts below will clear out a lot of misconception:
"The TIME_WAIT status is part of the TCP protocol. It's a safety feature, to prevent packets from corrupting later connections."
"This is how TCP works; conenctions are supposed to linger in TIME_WAIT for a period of time (4 minutes, I believe)."
"Tuning TCP/IP TIME_WAIT For Systems With High Connection Rates Applies To: VDE / DFE / DSE (all versions, all operating systems)

Description: When using the netstat command to look at open TCP/IP connections, a large number of connections in the TIME_WAIT state are observed. The system exhibits poor throughput possibly coupled with high CPU use on the VDE/DFE/DSE server.

TCP uses a special handshake to close completed sessions. The TIME_WAIT state is used to handle possible problems that may occur in the network relating to unreliable or delayed packet delivery. Accordingly, TCP holds connections for a temporary waiting period (TIME_WAIT) to ensure that any delayed packets are caught and not treated as new connection requests. The size of TIME_WAIT is supposed to be twice the maximum segment lifetime or twice the time a packet can remain alive on a particular IP network. For some operating systems, this can be as high as 4 minutes!

On busy systems, this can lead to a depleation of TCP port resources. Low throughput may occur due to many connections sitting in TIME_WAIT state.

Explanation/Workaround: OctetString recommends reducing the operating system setting for TIME_WAIT substantially. If VDE / DFE / DSE is the only server product on the system, this can be reduced to the operating system minimum of 15 or 30 seconds (depending on OS).

For Windows:
Use regedit and create a REG_DWORD named TcpTimedWaitDelay under

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcpIp\Parameters

Set it to a decimal value of 30 which is for 30 seconds - the minimum.

For AIX:
To see the current TCP_TIMEWAIT value, run the following command:

/usr/sbin/no –a | grep tcp_timewait

To set the TCP_TIMEWAIT values to 15 seconds, run the following command:

/usr/sbin/no –o tcp_timewait =1

The tcp_timewait option is used to configure how long connections are kept in the timewait state. It is given in 15-second intervals, and the default is 1.

For Linux:
Set the timeout_timewait paramater using the following command:
/sbin/sysctl -w net.ipv4.vs.timeout_timewait=30

This will set TME_WAIT for 30 seconds.

For Solaris:
Set the tcp_time_wait_interval to 30000 milliseconds as follows:

 /usr/sbin/ndd -set /dev/tcp tcp_time_wait_interval 30000

Source: http://zeeky.mzrahman.com/archives/000019.html

Security Awareness
Would you like your company to implement gamification into your security awareness program?





Polls