Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Terminal Service session terminates after idle
Is there a way to allow Terminal Service sessions to stay connected longer. We have users who use Terminal Service from external to internal networks and their sessions are timing out after a few minutes of idle time.
8 REPLIES 8

Not applicable
Created on ‎08-11-2004 11:52 AM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This has been discussed many times. To read the discussion, use the search engine. Otherwise, the quick answer is to check out the CLI option " set session_ttl [port number] timeout [seconds]" ...at least that was the command in FortiOS 2.50.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the response. I did the search but the time filter defaults to 1 month. Just needed to choose a longer period to search. Web interface for the FortiGate 500 not equal to the CLI interface. Downloaded CLI Ref Guide to help me with all the commands.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On a more non-Fortinet note... also consider the following Windows settings...
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.
ALSO USEFUL...
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 consider 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.
Have not tried these setting yet in the contect of TS and session time outs, but looks promising.
Steve.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use tcp_keep_alive on both Unix and Windows for Exchange, Telnet and TS clients and it works like a magic :)

Not applicable
Created on ‎08-11-2004 01:42 PM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you should configure TCP_keep_alive on your server. Deafult for Windows server (I think for Solaris too) is 2 hours, you could change it to 5 minutes or less if you want.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the setting jbult described is the one you want, the other suggestions shoudl perhaps be considered if jbults solutions doesnt work.
But i am sure it will, as this is a very common problem we see on the forums.
UK Based Technical Consultant
FCSE v2.5
FCSE v2.8
FCNSP v3
Specialising in Systems, Apps, SAN Storage and Networks, with over 25 Yrs IT experience.
UK Based Technical Consultant FCSE v2.5 FCSE v2.8 FCNSP v3 Specialising
in Systems, Apps, SAN Storage and Networks, with over 25 Yrs IT
experience.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
TTL paramet solve the problem partly, you still limited by TTL value. If you set your TTL for 5 hours and your client was idle 5 hours and 1 minute you get terminated session on server side and frozen session on the client side - it means outlook or RDP (RDP 5.1 knows how to reconnect) client can' t communicate with the server. If you have remote clients and you TTL is 8 hours but clients disconnected becuse of network problem you' ll keep all sessions opened until TTL expired...

Not applicable
Created on ‎08-27-2004 12:26 PM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In 2.8, the command would look something like this (e.g. telnet and SSH):
config system session_ttl
config port
edit 22
set timeout 3600
next
edit 23
set timeout 3600
end
end
