Skip to main content

How to keep SSH connections alive


This blog describes how to keep SSH connections alive. If you have experience such problems while using SSH, such as dropped or unresponsive connections, you may need to adjust some settings in your SSH client.



KEEPING SSH CONNECTIONS ALIVE


Depending on your hardware and software configuration, you may experience SSH connectivity issues. For example, some types of firewalls may preemptively close connections after a certain amount of time has elapsed.

To work around these types of problems, you can adjust your SSH client's settings. Follow the appropriate procedure below for your own operating system.
Windows operating systems

Microsoft Windows operating systems use the PuTTY program to establish SSH connections. If you experience connectivity issues, you can adjust PuTTY's configuration to help keep connections alive. To do this, follow these steps:

  • Start PuTTY.
  • Load your connection session.
  • In the Category pane, click Connection.
  • Under Sending of null packets to keep session active, in the Seconds between keepalives, type 240.


  • In the Category pane, click Session.
  • Click Save.
  • Connect to your account and monitor the connection. If it stil drops, gradually decrease the keepalive interval until the connection is stable.
     
Linux and Mac OS X operating systems
On Linux and Apple Mac OS X operating systems, the ~/.ssh/config file enables you to specify many SSH settings, including those that keep alive an SSH connection.

For this, follow below steps:
  1. Use your preferred text editor to open the ~/.ssh/config file on your local computer.



  2. If the .ssh directory or the config file do not exist, create them.

  3. Add the following lines to the config file. The Host value can be any name you want; it is simply a label for the other settings. The Hostname value is the remote host you want to access; replace netwyman.com with your domain name. Replace newuser with your own A2 Hosting account username:

          Host netwyman
          Hostname netwyman.com
          Port 7822
          User newuser
          ServerAliveInterval 240
          ServerAliveCountMax 2




Save the changes to the config file.
Connect to your account using SSH. To do this, simply type ssh example where example represents the Host value you specified in step 2.
Monitor the connection. If it still drops, gradually decrease the ServerAliveInterval setting in the config file until the connection is stable.



Comments

Popular posts from this blog

What is STP? - Explain Advantages and Disadvantages

The Spanning Tree Protocol is a network protocol that builds a loop-free logical topology for Ethernet networks. The basic function of STP is to prevent bridge loops and the broadcast radiation that results from them. STP is a protocol. It actively monitors all links of the network. To finds a redundant link, it uses an algorithm, known as the STA (spanning-tree algorithm). The STA algorithm first creates a topology database then it finds and disables the redundant links. Once redundant links are disabled, only the STP-chosen links remain active. If a new link is added or an existing link is removed, the STP re-runs the STA algorithm and re-adjusts all links to reflect the change. STP (Spanning Tree Protocol) automatically removes layer 2 switching loops by shutting down the redundant links. A redundant link is an additional link between two switches. A redundant link is usually created for backup purposes. Just like every coin has two sides, a redundant link, along with

What are the Advantages and Disadvantages of TCP/UDP ?? Difference between TCP and UDP

As in previous blog we have define and explain about what is TCP and UDP and from now we are moving ahead with Advantages, Disadvantages and Difference of TCP and UDP but for this you have to know about TCP and UDP hence to understand it go for a What is TCP and UDP . Advantage of TCP Here, are pros/benefits of TCP: It helps you to establish/set up a connection between different types of computers. It operates independently of the operating system. It supports many routing-protocols. It enables the internetworking between the organizations. TCP/IP model has a highly scalable client-server architecture. It can be operated independently. Supports several routing protocols. It can be used to establish a connection between two computers. Disadvantages of TCP Here, are disadvantage of using TCP: TCP never conclude a transmission without all data in motion being explicitly asked. You can't use for broadcast or multicast transmission. TCP has no block boundaries, so you