Lost connection to server using Putty (due to packet loss)

Hello,

I'm using Putty to connect to my FreeBSD server.
Several times a day, my connection drops due to packet loss (ISP capacity problems).

They are very short, but enough to disconnect my Putty session.
This is very annoying, and I wonder if there is something we can do in FreeBSD, increase timeout or change keep alive somewhere?

We have made the appropriate changes in the Putty client, but that doesn't do the trick.

Thank you,
 
Haven't used PuTTY or PowerTerm for years but used to run a keepalive script on idle terminal sessions to keep them from timing out. I still use one now and then for ssh sessions, and it works. Prints one period per minute on the terminal / one line of text per hour.
Code:
#!/bin/sh
x=0; y=0; z=0
while :;do
  sleep 60
  echo -n "."
  x=$((x+1))
  if [ $x -eq 5 ];then x=0; echo -n " ";fi
  y=$((y+1))
  z=$((z+1))
  if [ $y -eq 60 ];then
    y=0; z=0; echo
  elif [ $z -eq 10 ];then
    z=0; echo -n " "
  fi
done
 
I'm using Putty to connect to my FreeBSD server.
Several times a day, my connection drops due to packet loss (ISP capacity problems).

They are very short, but enough to disconnect my Putty session.
This is very annoying, and I wonder if there is something we can do in FreeBSD, increase timeout or change keep alive somewhere?

We have made the appropriate changes in the Putty client, but that doesn't do the trick.
Do not know, if this helps you, bu I am always using sysutils/screen. Especially on servers. So, when the ssh connection is terminated, all the shell sessions remain open. I can always log in again and reconnect.
 
Last edited:
Why don't you use Mosh instead (net/mosh)? It's been designed to recover automatically from connection drops. It even reconnects automatically in case your IP address has changed after a disconnect.
 
OP
Aknot
Thank you everyone, testing net/mosh right now and it seems to be working just great :D
 
Last edited by a moderator:
Top