frapposelli / vagrant-vcloud

Vagrant provider for VMware vCloud Director®
MIT License
67 stars 38 forks source link

SSH into a VM freezes after a long pause #60

Closed StefanScherer closed 3 years ago

StefanScherer commented 10 years ago

This week a colleage and I encountered sometimes that SSH connections freeze after a long time of doing nothing in them. The SSH connections are made with vagrant ssh boxname over the Edge Gateway and over the vApp-Net into the VM.

It seems that one of the gateways drop connections if there is no traffic.

I have tested another SSH connection with

vagrant ssh-config boxname >vagrant.ssh.config
echo "TCPKeepAlive yes" >>vagrant.ssh.config
ssh -F vagrant.ssh.config boxname

and then the SSH connection lives longer. Adding the TCPKeepAlive yes to the ssh config (or perhaps to ~/.ssh/config) seems to solve the problem.

Is there a better approach, or should the vagrant-vcloud plugin automatically add TCPKeepAlive to the SSH connection?

tsugliani commented 10 years ago

Hi @StefanScherer,

This is a common setting for many gateways, it's not really vagrant or vagrant-vcloud related. You can also set this globally in you ssh_config file /etc/<pathto>/ssh_config

My settings are:

Host *
    ServerAliveInterval 15 

Maybe we can add this as a Wiki page for people that would get into this issue ?

StefanScherer commented 10 years ago

Hi @tsugliani,

it seems that is a common problem until you have such an entry. So I think this is worth mentioning in a wiki page.