Adjust TCP Keepalive Interval Using Regedit

This guide explains how to configure system-wide TCP keepalive settings in Windows by modifying the system registry. TCP keepalive packets ensure that inactive connections remain open and detect dead connections through intermediary devices like firewalls and NAT gateways. By following the steps below, you will learn how to locate the appropriate registry keys and adjust the idle time and retry intervals to meet your network requirements.


Step 1: Open the Registry Editor

  1. Press Windows Key + R to open the Run dialog box.
  2. Type regedit and press Enter (or click OK).
  3. If prompted by User Account Control (UAC), click Yes to grant administrative permissions.

Step 2: Navigate to the TCP/IP Parameters Key

In the address bar at the top of the Registry Editor, paste the following path and press Enter:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Step 3: Configure KeepAliveTime

The KeepAliveTime parameter controls how often TCP sends a keepalive probe when a connection has been idle.

  1. In the right-hand pane, check if a DWORD value named KeepAliveTime exists.
  2. If it does not exist:
    • Right-click an empty area in the right pane.
    • Select New > DWORD (32-bit) Value.
    • Name it KeepAliveTime.
  3. Double-click KeepAliveTime.
  4. Under Base, select Decimal.
  5. In the Value data field, enter the desired idle time in milliseconds.
    • Example: For 5 minutes, enter 300000 (the Windows default is 7200000 ms, or 2 hours).
  6. Click OK.

Step 4: Configure KeepAliveInterval

The KeepAliveInterval parameter determines the delay between consecutive probe transmissions if no acknowledgment is received for the initial probe.

  1. In the right-hand pane, check if a DWORD value named KeepAliveInterval exists.
  2. If it does not exist:
    • Right-click an empty area in the right pane.
    • Select New > DWORD (32-bit) Value.
    • Name it KeepAliveInterval.
  3. Double-click KeepAliveInterval.
  4. Under Base, select Decimal.
  5. In the Value data field, enter the retry interval in milliseconds.
    • Example: For 1 second intervals, enter 1000 (the Windows default is 1000 ms).
  6. Click OK.

Step 5: Apply the Changes

Registry changes to the TCP/IP stack do not take effect immediately. Close the Registry Editor and restart your computer to apply the new system-wide keepalive configuration.