Explanation of MSL in TCP/IP

Source: Internet
Author: User

MSL is short for maximum segment life time. It can be translated as "the longest message segment life". It is the longest time for any message to exist on the network. If it exceeds this time, the message will be discarded. We all know that there is a TTL field in the IP header. TTL is short for time to live. It can be translated as "time to live ", the survival time is the initial value set by the source host, but not the specific time, but the maximum number of routes that an IP datagram can pass through, the value is reduced by 1. If this value is 0, the datagram is discarded and the source host is notified by sending an ICMP message. In rfc793, MSL is set to 2 minutes, but this is entirely from the engineering perspective. For the current network, MSL = 2 minutes may be too long. Therefore, TCP allows different implementations to use smaller MSL values according to specific conditions. TTL is related to MSL but not simply equal. MSL must be greater than TTL.

The following figure shows the release of a TCP connection:

650) This. width = 650; "Title =" 2366tkm%80a_is0@duioj_e9d.png "src =" http://s4.51cto.com/wyfs02/M02/80/63/wKiom1c_C3zTY5p7AAIQhDP5xCk816.png "alt =" wkiom1c_c3zty5p7aaiqhdp5xck816.png "/>

(This figure is taken from Xie Xi's sixth computer network version)

We have noticed that there is a timeout setting from the time_wait status to the closed status during TCP connection release. The timeout setting is 2msl (rfc793 defines MSL as 2 minutes ), so why does it have to wait for 2msl time after time_wait? There are two main reasons ):

1. To ensure that the last ACK packet segment sent by the client (which is recorded as end a) can reach the server. This ACK packet segment may be lost, so that the server at the LASK-ACK side (we are counted as B) cannot receive the FIN + ACK packet segment that has been sent. B will retransmit the FIN + ACK packet segment timeout, and a will be able to receive the FIN + ACK packet segment in 2msl time. Then a re-transmits the message and restarts the 2msl timer. Finally, both A and B enter the closed State normally. If a is in the time_wait status and does not wait for a while, but releases the connection immediately after the ACK confirmation is sent, the FIN + ACK packet segment sent by B cannot be received, therefore, B cannot normally enter the closed status.

2. As we all know, if the connection segment of the first request sent by a is lost without confirmation, a will re-Send the connection request. Then B receives the confirmation and establishes the connection. After the data transmission is completed, the connection is released. A sends two connection request message segments, the first one is lost, and the second one is B. Assume that the first connection request packet segment sent by a is not lost, but remains in some network nodes for a long time, so that it will arrive at B after the connection is released, this is an invalid packet segment, but B does not know it, and a connection will be established again. The 2msl is waiting to solve this problem. After sending the final confirmation message, after 2msl, in this way, all the packet segments generated during the connection duration can be removed from the network, so that the old connection request packet segment will not appear in the next new connection.

Let's return to MSL. In 2msl time, the connection (client address, port and server port address) on this address cannot be used, for example, if we close the connection after establishing a connection and restart the connection quickly, the port becomes unavailable.













Explanation of MSL in TCP/IP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.