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
- Press
Windows Key + Rto open the Run dialog box. - Type
regeditand press Enter (or click OK). - 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.
- In the right-hand pane, check if a DWORD value named
KeepAliveTimeexists. - If it does not exist:
- Right-click an empty area in the right pane.
- Select New > DWORD (32-bit) Value.
- Name it
KeepAliveTime.
- Double-click
KeepAliveTime. - Under Base, select Decimal.
- In the Value data field, enter the desired idle
time in milliseconds.
- Example: For 5 minutes, enter
300000(the Windows default is7200000ms, or 2 hours).
- Example: For 5 minutes, enter
- 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.
- In the right-hand pane, check if a DWORD value named
KeepAliveIntervalexists. - If it does not exist:
- Right-click an empty area in the right pane.
- Select New > DWORD (32-bit) Value.
- Name it
KeepAliveInterval.
- Double-click
KeepAliveInterval. - Under Base, select Decimal.
- In the Value data field, enter the retry interval
in milliseconds.
- Example: For 1 second intervals, enter
1000(the Windows default is1000ms).
- Example: For 1 second intervals, enter
- 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.