Wednesday, December 11, 2013

Prevent SSH connection from freezing

Recently I have experinced my ssh connection to remote server is hung after idle time. this is very annoying because ssh connection was established over vpn and take time to reconnect the session again. If your ssh connection hung/freeze time to time following solution may be helpful.


1) Open the ssh_config file.


location may differ,in centos
vim /etc/ssh/ssh_config

2) Add following lines


Host *
    ServerAliveInterval 300
    ServerAliveCountMax 2



Remember, this configuration is done at client side. client send keep alive message to server every 180 seconds and server send ack (acknowledgement) message.If 2 consecutive ack messages are lost from server side. connection will be dropped as server is not available.

1 comment:

  1. Very interesting article and I did not know technology could freeze like this. I love finding tech blogs like this because they always give great information on new technological innovations. I have been reading about the new storage units that companies are using for their computer equipment. I think Server Racks are a great option because they allow you to customize your set up and have plenty power outlets that will keep everything organized

    ReplyDelete

Related Posts