Skip to content

Set TCP KeepAliveTime in Exchange Server

It’s essential to configure the TCP KeepAliveTime in Exchange Server. By default, it’s not set, and you have to do that yourself by creating a DWORD (32-bit) value in the Windows Registry. In this article, you will learn how to set TCP KeepAliveTime in Exchange Server.

TCP KeepAliveTime

Microsoft recommends setting the TCP KeepAliveTime registry entry on the Exchange Server to a decimal value between 900000 and 1800000 (15 to 30 minutes in milliseconds). If there’s no entry in the registry for KeepAliveTime, then the default value is 2 hours.

If not set correctly, this value can affect both connectivity and performance. You must ensure that the load balancer and any other devices in the path from client to Exchange are configured correctly.

The goal is to set Exchange with the lowest value so that client sessions, when ended, are ended by Exchange and not by the device.

Check TCP KeepAliveTime setting

An excellent way to check the TCP KeepAliveTime setting is to create an Exchange Server Health Report with the Exchange Health Checker PowerShell script.

This is what the Exchange Server Health Report looks like in our example.

Set TCP KeepAliveTime in Exchange Server error

Not Set Error: Without this value the KeepAliveTime defaults to two hours, which can cause connectivity and performance issues between network devices such as firewalls and load balancers depending on their configuration. More details: https://aka.ms/HC-TcpIpSettingsCheck

How to set TCP KeepAliveTime in Exchange Server

Set TCP KeepAliveTime in Exchange Server by following one of the methods below.

Method 1: Registry Editor (GUI)

  1. Open the Registry Editor on the Exchange Server.
  2. Navigate to the following registry key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\TcpIp\Parameters
  1. Right-click the Parameters key, select New, and then select DWORD (32-bit) Value.
Set TCP KeepAliveTime in Exchange Server DWORD Value
  1. Type KeepAliveTime as the name for the new value, and then press Enter.
  2. Double-click the new KeepAliveTime value, select Decimal as the base, type 1800000 as the value data, and click OK.

Note: The value data 1800000 specifies the time (in milliseconds) that TCP will wait before sending a keepalive packet on an idle connection. In this example, the keepalive packet will be sent every 30 minutes.

Set TCP KeepAliveTime in Exchange Server Value data
  1. Close the Registry Editor.
  2. Restart the Exchange Server.

Note: Changes to the registry require a restart of the computer to take effect.

Method 2: PowerShell

  1. Start Windows PowerShell as administrator
  2. Run the below command
New-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\TcpIp\Parameters" -Name "KeepAliveTime" -PropertyType DWORD -Value 1800000 -Force
  1. Restart the Exchange Server

Note: Changes to the registry require a restart of the computer to take effect.

Verify TCP KeepAliveTime setting

Run the Exchange Health Checker script and check the TCP KeepAlive setting in the Exchange Server Health Report.

Set TCP KeepAliveTime in Exchange Server good

Everything looks great!

Read more: Check Exchange health mailboxes »

Conclusion

You learned how to set TCP KeepAliveTime in Exchange Server. It’s essential to set the TCP KeepAlive DWORD registry with the correct value to prevent connectivity and performance issues.

Did you enjoy this article? You may also like Configure HSTS on Exchange Server. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 2 Comments

  1. Short:
    REG ADD HKLM\System\CurrentControlSet\Services\TcpIp\Parameters /v KeepAliveTime /t REG_DWORD /d 1800000 /f

Leave a Reply

Your email address will not be published. Required fields are marked *