This one is really simple but it seems that i have to search for it every time. Note that keeping the connection alive is not really safe. Add these lines to your ssh_config
KeepAlive yes ClientAliveInterval 120
Once you done you can comment the line out
#KeepAlive yes #ClientAliveInterval 120