How to make your intermittent or flaky terminal services connection a little more stable
2014-03-07 20:04
369 查看
In this article, I'll quickly discuss how using a few registry hacks, you can stabilize your terminal services network connection and reduce the number of
disconnected sessions you get from weak WAN connections. These tweaks will also serve to prevent disconnects from occurring when network devices kill off sockets that are idle too long.
Prerequisites:
•A running terminal server that needs to have its connection stabilized
•A registry editor, like regedit.exe
Section 1: Indicators:
Many WAN connections can vary in quality and latency, and often times these two characteristics will manifest themselves in disconnected terminal services
sessions. By doing two relatively easy registry hacks, you can reduce these disconnects and improve the overall experience of your users.
Section 2: Keep Alives:
In the registry at HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server, create or edit the DWORD value of KeepAliveEnable and set it to 1. This will turn
Keep Alives on. This will serve to stabilize the connection by sending 'heartbeat' packets to the client every so often. This will cause an idle connection to be probed every so often just to be sure that the connection is still alive and that the client is
still listening on the other side. This will also help prevent disconnects by preventing network devices from killing off sockets that it assumes to be idle. Because terminal services is such a low bandwidth protocol, when a user is idle, no network activity
will occur. Some network devices will interpret a connection that is in the idle state for an extended period of time to be a dead connection, and thus will terminate the socket. However, when the user comes out of the idle state, the terminal services client
can no longer contact the terminal server because the socket is dead. By turning on Keep Alives, the connection will not appear idle, and therefore the network device will not attempt to terminate the socket.
For more information about Keep Alives, check out this link.
Two other registry entries to look at are at HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\KeepAliveInterval and HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\KeepAliveTime.
Both are DWORD entries. These two registry entries typically do not need to be changed, but I've included them here for completeness.
KeepAliveInterval determines the interval separating keep alive retransmissions until a response is received. If a response is received, the delay until the
next keep alive transmission is again controlled by the value of KeepAliveTime. The connection will be aborted after the number of retransmissions specified by TcpMaxDataRetransmissions (which will be discussed in the next section) have gone unanswered. KeepAliveInterval
is set by default to be 1000, which is one second.
KeepAliveTime controls how often TCP attempts to verify that an idle connection is still intact by sending a keep alive packet. If the remote system is still
reachable and functioning, it will acknowledge the keep alive transmission. KeepAliveTime is set by default to be 7,200,000, which is 2 hours.
For more information about KeepAliveInterval and KeepAliveTime, check out this link.
Section 3: TcpMaxDataRetransmissions:
In the registry at HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters, create or edit the DWORD value of TcpMaxDataRetransmissions. By default it is
set to 5, but I would recommend doubling that value, to 10. The value of TcpMaxDataRetransmissions is the number of times TCP retransmits an unacknowledged data segment on an existing connection. TCP retransmits data segments until they are acknowledged or
until this value expires. Basically, when a client doesn't respond to a packet from the terminal server, the server will attempt to retransmit the packet up to TcpMaxDataRetransmissions number of times. By increasing this value, you are giving the client more
time to respond to the server, which will help improve flaky connections or connections with high latency or higher than normal packet loss.
For more information about TcpMaxDataRetransmissions, check out this link.
If you have numerous servers you need to migrate this out to, you can hack this registry entry, export the changes to a .reg file, then silently import
it (regedit.exe /q) onto your all your servers.
原文:http://terminal.servebeer.com/php/flaky_connections.php
disconnected sessions you get from weak WAN connections. These tweaks will also serve to prevent disconnects from occurring when network devices kill off sockets that are idle too long.
Prerequisites:
•A running terminal server that needs to have its connection stabilized
•A registry editor, like regedit.exe
Section 1: Indicators:
Many WAN connections can vary in quality and latency, and often times these two characteristics will manifest themselves in disconnected terminal services
sessions. By doing two relatively easy registry hacks, you can reduce these disconnects and improve the overall experience of your users.
Section 2: Keep Alives:
In the registry at HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server, create or edit the DWORD value of KeepAliveEnable and set it to 1. This will turn
Keep Alives on. This will serve to stabilize the connection by sending 'heartbeat' packets to the client every so often. This will cause an idle connection to be probed every so often just to be sure that the connection is still alive and that the client is
still listening on the other side. This will also help prevent disconnects by preventing network devices from killing off sockets that it assumes to be idle. Because terminal services is such a low bandwidth protocol, when a user is idle, no network activity
will occur. Some network devices will interpret a connection that is in the idle state for an extended period of time to be a dead connection, and thus will terminate the socket. However, when the user comes out of the idle state, the terminal services client
can no longer contact the terminal server because the socket is dead. By turning on Keep Alives, the connection will not appear idle, and therefore the network device will not attempt to terminate the socket.
For more information about Keep Alives, check out this link.
Two other registry entries to look at are at HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\KeepAliveInterval and HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\KeepAliveTime.
Both are DWORD entries. These two registry entries typically do not need to be changed, but I've included them here for completeness.
KeepAliveInterval determines the interval separating keep alive retransmissions until a response is received. If a response is received, the delay until the
next keep alive transmission is again controlled by the value of KeepAliveTime. The connection will be aborted after the number of retransmissions specified by TcpMaxDataRetransmissions (which will be discussed in the next section) have gone unanswered. KeepAliveInterval
is set by default to be 1000, which is one second.
KeepAliveTime controls how often TCP attempts to verify that an idle connection is still intact by sending a keep alive packet. If the remote system is still
reachable and functioning, it will acknowledge the keep alive transmission. KeepAliveTime is set by default to be 7,200,000, which is 2 hours.
For more information about KeepAliveInterval and KeepAliveTime, check out this link.
Section 3: TcpMaxDataRetransmissions:
In the registry at HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters, create or edit the DWORD value of TcpMaxDataRetransmissions. By default it is
set to 5, but I would recommend doubling that value, to 10. The value of TcpMaxDataRetransmissions is the number of times TCP retransmits an unacknowledged data segment on an existing connection. TCP retransmits data segments until they are acknowledged or
until this value expires. Basically, when a client doesn't respond to a packet from the terminal server, the server will attempt to retransmit the packet up to TcpMaxDataRetransmissions number of times. By increasing this value, you are giving the client more
time to respond to the server, which will help improve flaky connections or connections with high latency or higher than normal packet loss.
For more information about TcpMaxDataRetransmissions, check out this link.
If you have numerous servers you need to migrate this out to, you can hack this registry entry, export the changes to a .reg file, then silently import
it (regedit.exe /q) onto your all your servers.
原文:http://terminal.servebeer.com/php/flaky_connections.php
相关文章推荐
- How to make your issues in GitHub more professional? [Labels feature]
- How to find more or better bugs (12 tips to explode your bug count and/ or severity)?
- How to make your assembly more secure from referencing by unauthorized bits
- How to use Display Zoom on your iPhone 6 or iPhone 6 Plus
- How to Make an HTTP Connection Using TCP/IP with RSocket
- How to make more money from Google Adsense?
- How To Create a Full Android Phone or Tablet Backup Without Rooting or Unlocking Your Device
- How to Create a Cron Job (Scheduled Task) for Your Website or Blog
- How to make your 100k to 10k (3)
- NDoc: How to Make Good Use of Your XML Comments?
- How to make a terminal alias for Mac OS X
- How to add one or more control files
- 【Forward】Best Ideas on How to Complete a Lifebook for Your Adopted or Foster Child
- 码农如何快速打造一个有设计感的网站 How to Make Your Site Look Half-Decent in Half an Hour
- How to render a 128 Barcode in Reporting Services or .Net applications
- How to make your 100k to 10k (6)
- 网易云课堂 - Class Two and Three - How to make your works professional.
- How to make your 100k to 10k (4)
- How to move between two or more forms?
- NDoc: How to Make Good Use of Your XML Comments?