All Products
Search
Document Center

:Windows instance: Fix "TCP/IP failed to establish an outbound connection" error

Last Updated:Aug 20, 2026

This topic explains how to resolve an issue where a Windows instance cannot access ports on internal or public network servers, logging the error "TCP/IP failed to establish an outbound connection."

Symptoms

A Windows instance repeatedly fails to access any ports on internal or public network servers, although ping commands work correctly. Connectivity to the target ports resumes after some time. The system log shows the following error message:

TCP/IP failed to establish an outbound connection because the selected local endpoint was recently used to connect to the same remote endpoint. This error typically occurs when outbound connections are opened and closed at a high rate, causing all available local ports to be used and forcing TCP/IP to reuse a local port for an outbound connection. To minimize the risk of data corruption, the TCP/IP standard requires a minimum time period to elapse between successive connections from a given local endpoint to a given remote endpoint.

For information about how to view the system log, see View instance system logs and screenshots.

Cause

This issue occurs when the Windows instance exhausts its available TCP ports, preventing new connections.

Solution

Adjusting registry keys, such as increasing MaxUserPort to 65534 and reducing TcpTimedWaitDelay to 30 seconds, increases the number of available TCP ports. This improves the success rate of new TCP connections when port usage is high.

Note

Adjust these values based on your specific workload to achieve the best results.

  1. Connect to the Windows instance.

    For more information, see Log on to a Windows instance by using Workbench.

  2. Open the Run dialog box, enter regedit, and then click OK.

  3. In the Registry Editor window, navigate to the Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters key.

  4. Create and modify the MaxUserPort value.

    1. Right-click the Parameters directory, select New > DWORD (32-bit) Value. Name the new value MaxUserPort.

    2. Double-click MaxUserPort. Under Base, select Decimal. In the Value data field, enter 65534.

    3. Restart the Windows instance for the configuration to take effect. For more information, see Restart an instance.

      Note

      You must restart the instance for the registry changes to take effect. If you cannot restart the instance immediately, you can temporarily increase the number of available ports by opening Command Prompt and running the netsh int ipv4 set dyn tcp [$Start_Num] [$Num_Range] command. In this command, [$Num_Range] specifies the number of ports, and [$Start_Num] specifies the starting port. Replace these placeholders with your required values.

  5. (Optional) Create and modify other related TCP parameters, and then restart the Windows instance.

    Method

    Parameter

    Value

    Description

    Adjust TcpTimedWaitDelay to reduce the wait time after a port is closed.

    TcpTimedWaitDelay

    30

    This parameter defines the time a closed port must wait before reuse, with a default of 120 seconds. Reducing this value, for example to 30, allows the port to be reused faster.

    Reduce the TCP KeepAlive time to automatically clean up connections in the CLOSE_WAIT state.

    KeepAliveTime

    300000 milliseconds (5 minutes)

    Controls how long TCP keeps a connection alive. A smaller value enables the operating system to close invalid or half-open connections sooner.

    KeepAliveInterval

    1000

    Controls the interval between KeepAlive probes.

    TcpMaxDataRetransmissions

    5

    Defines the maximum number of data retransmissions. Reducing this value helps identify a dropped connection more quickly when the network is unstable.