Enabling TCP keepalive for console connections

Problem

Console connections traversing network (in particular a firewall) are silently dropped. Emulator is never notified that the connection has been dropped and refuses new connections to the console.

Firewalls keep information about active connections in tables of finite length. Many firewalls will throw away table entries for inactive connections. What a firewall considers "inactive" is dependent on the firewall product and configuration.

Solution

The problem can be solved by changing the firewall configuration to be more generous to such console connections, or to use TCP keepalive packets. This article describes the latter.

TCP keepalive is a TCP option that causes packets to be exchanged over a connection even if there is no traffic to transport. It should be enabled on both ends of the connection. TCP keepalive must be enabled at the operating-system level *and* by the application/program opening TCP connections.

Linux

On Linux, edit the "/etc/sysctl.conf" file and add these lines:

net.ipv4.tcp_keepalive_time = 200

net.ipv4.tcp_keepalive_probes = 9

net.ipv4.tcp_keepalive_intvl = 50

(feel free to adapt the values as you see fit). When done editing, you must make the new values known to the kernel:

# sysctl --load=/etc/sysctl.conf

Windows

On Windows, the defaults are too large. The default values can be overridden by creating new keys in the windows registry.  Please see this link for instructions:
http://www.charlescrampton.com/2011/10/tcp-keep-alive-in-windows-vista-and.html

Here is the relevant bit:

  • logged in with user having admin privileges, run REGEDIT
  • navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters
  • right click in right panel - select NEW - DWORD
  • type: KeepAliveTime  for the description and hit enter (no spaces and observe caps for K, A and T)
  • right click on KeepAliveTime and select MODIFY
  • click on the button beside decimal
  • type: 300000   in the box for value
  • click OK to save (should show 493e0 for hex after save)
    (info) this sets the value to 5 minutes (300,000 milliseconds); default value per Microsoft technet
  • right click in right panel - select NEW - DWORD
  • type: KeepAliveInterval  for the description and hit enter (no spaces and observe caps for K, A and I)
  • right click on KeepAliveInterval and select MODIFY
  • click on the button beside decimal
  • type: 1000   in the box for value
  • click OK to save (should show 3e8 for hex after save)
    (info) this sets value to 1 second = 1000 milliseconds; default value per Microsoft technet
  • file - exit


Reboot when finished.

PuTTY

You must also enable TCP keepalive packets in PuTTY. To do this:

  • load the profile you use to connect to the Alpha console by selecting the name in the list and clicking on the "Load" button
  • Next, in the left-hand menu pane ("Category") select "Connection"
  • In the right-hand pane ("Options controlling the connection")
    • in the "Low-level TCP connection options" box
      • tick the box marked "Enable TCP keepalives (SO_KEEPALIVE option)"
  • Finally, select "Session" in the left-hand pane, and click on the "Save" button to save your changes for this session profile.



© Stromasys, 1999-2024  - All the information is provided on the best effort basis, and might be changed anytime without notice. Information provided does not mean Stromasys commitment to any features described.