Maximum segment lifetime
![]() | This article contains instructions, advice, or how-to content. (February 2016) |
Maximum segment lifetime is the time a TCP segment can exist in the internetwork system. It was defined in 1981 to be 2 minutes.[1] <quote> For this specification the MSL is taken to be 2 minutes. This is an engineering choice, and may be changed if experience indicates it is desirable to do so. </quote>
The Maximum Segment Lifetime value is used to determine the TIME_WAIT interval (2 * MSL), the minimum time a system must wait before designating the socket closed, thus preventing the socket from being re-used before that interval.
Values in various operating systems
The command that can be used on Solaris systems (prior to v11) to determine the TIME_WAIT interval is:
ndd -get /dev/tcp tcp_time_wait_interval
60000 (60 seconds) is a common value.
On FreeBSD systems this description and value can be checked by the command sysctl:[2]
sysctl -d net.inet.tcp.msl sysctl net.inet.tcp.msl
which gets the result:
net.inet.tcp.msl: Maximum segment lifetime net.inet.tcp.msl: 30000
In Linux, the kernel will wait up until TCP_TIMEWAIT_LEN before closing a socket in the TIME_WAIT state. This value is hardcoded at 60 seconds, which implies a MSL of 30 seconds. Linux implements several possible optimizations to shorten the TIME_WAIT state through _recycling_, down to a minimum of 3.5s, for an effective MSL of 1 second.[3]
References
- ^ "RFC 793". Transmission Control Protocol. Retrieved December 5, 2006.
- ^ "Tuning FreeBSD to serve 100-200 thousands of connections".
- ^ "Linux Kernel socket implementation".