All Products
Search
Document Center

:Resolve network failures from TIME_WAIT connections

Last Updated:Apr 15, 2026

This topic describes the symptoms, cause, and solution for external network access failures on a Windows instance caused by an excessive number of TCP connections in the TIME_WAIT state.

Symptoms

You can successfully ping an external network from your Windows instance, but you cannot browse external websites, web pages load slowly, or applications on the instance have network connectivity issues. When you run the netstat -an |find "TIME_WAIT" /c command in Command Prompt, the output shows a large number of TCP connections in the TIME_WAIT state. The following figure shows an example.查看time_wait连接

Cause

In Windows Server 2008 and later, the default dynamic port range includes 16,384 ports, from 49152 to 65535. The default TIME_WAIT delay for a TCP connection is 4 minutes. If a system handles a high volume of active connections, the ports can remain in the TIME_WAIT state for an extended period after the connections are closed. This can lead to port exhaustion, which prevents applications from establishing new connections.

Solution

Note

Steps may differ for other Windows versions.

  1. Connect to the Windows instance using VNC.

    For more information, see Connect to an instance using VNC.

  2. Open Command Prompt.

    1. Click the 开始图标 icon in the lower-left corner of the desktop, and then click the 搜索图标 icon.

    2. In the search box, enter cmd.单击命令提示符

    3. Click Command Prompt.

      The Command Prompt window opens.进入命令提示符

  3. Run the following command to view the current dynamic port configuration.

    netsh int ipv4 show dynamicport tcp

    The output is similar to the following, which indicates that the number of dynamic ports is 16,384 (from 49152 to 65535).

    20230209142221

  4. Run the following command to increase the number of dynamic ports.

    netsh int ipv4 set dynamicport tcp start=1025 num=60000
    Note

    The start and num parameters specify the starting port and the total number of ports, respectively. Adjust these values based on your requirements.

    The output is similar to the following, which indicates that the number of dynamic ports is increased to 60,000, ranging from 1025 to 61024.

    20230209142347

  5. Try to access the external network or connect to your application again.

    • If the access is successful, the issue is resolved.

    • If access fails, continue to the next step to shorten the TIME_WAIT delay by modifying the registry.

  6. If increasing the number of dynamic ports does not resolve the issue, you can reduce the TIME_WAIT delay by modifying the registry. The minimum supported value is 30 seconds. Perform the following steps:

    Important

    Modifying the registry incorrectly can cause serious system problems or data loss. Before you proceed, you must create snapshots of the system disk and data disks. After you modify the registry, you must restart the Windows instance for the changes to take effect.

    1. Open Registry Editor.

      1. Click the 开始图标 icon in the lower-left corner of the desktop, and then click the 搜索图标 icon.

      2. In the search box, enter regedit.打开注册表编辑器

      3. Click regedit.

        The Registry Editor window opens.2012注册表编辑器

    2. In Registry Editor, navigate to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters key and set the Value data of the TcpTimedWaitDelay entry to a decimal value of 30.

      If the TcpTimedWaitDelay entry does not exist, create the corresponding registry entry, and then modify its value data. For example, if TcpTimedWaitDelay does not exist, perform the following steps:

      1. Under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters key, right-click an empty area in the right pane and select New > DWORD (32-bit) Value.新建注册表项

      2. Enter TcpTimedWaitDelay and press Enter.

      3. Right-click the TcpTimedWaitDelay entry and select Modify.单击修改注册表项

      4. In the dialog box that appears, select Decimal and set Value data to 30.需改数值数据为30

      5. Click OK.

Related documents