The Linux system cannot establish a TCP connection and does not respond to problems related to the SYS package.

Source: Internet
Author: User

Developers reported that sometimes they can connect to the server, sometimes they cannot connect to the server, and the connection is broken frequently. This problem has plagued them for a month or two. By using Wireshark to capture packets on the server, it is indeed as the developer said: When the client requests the server to establish a TCP connection, it sends the SYS packet to the server, however, the server does not respond to the SYS package, so connection disconnection occurs. The packet capture result is as follows:

From packet capture, we can clearly see that port 35425 of the client sends a SYS packet to port 80 of the server three times in a row and requests a TCP connection. However, the server did not respond and did not send the response packet to port 35425 of the client. Therefore, the client considers that a TCP connection fails to be established, which may result in connection disconnection or network disconnection.

After query, the server does not respond to the client SYS package request as follows:

When the SYS packet sent by the client has a timestamp, after NAT translation, if the used port has been used before, in addition, the timestamp in the SYS package with the same port is greater than the timestamp in the current SYS package. In this case, the Linux kernel will directly discard the SYS package, resulting in the Link failure to complete the three handshakes of TCP/IP. [This function is related to rfc1323: http://tools.ietf.org/html/rfc1323]

The above statement may be a bit difficult to understand. Let's take an example. If host A and host B in the same internal network access serverN through the NAT Gateway (one IP address and the same port), because the timestamp time is the current time when the system starts, the timestamp of host A and host B is different. In this case, the host with A large timestamp successfully accesses serverN, while the host with A small timestmap fails to access serverN.

To solve this problem, disable the timestmap function of TCP, that is, disable timestamp.

# Vi/etc/sysctl. conf, Set

View plain copy
 
 
  1. Net. ipv4.tcp _ timestamps = 0

  2. # By default, this value is 1, that is, enabled

Then execute # sysctl-p to make the configuration take effect, so that there will be no intermittent disconnection.

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.