Wednesday 22 August 2012

Virgin Media Super Hub and ssh timeouts

After upgrading to a new "shiny" Virgin Media Super Hub I started to get annoying ssh timeouts on idle connections.  After some Googling around I discovered that it suffers from TCP connection timeouts and some users have suggested that there isn't much memory in the device, so it can't save much session data.

Well, how does one workaround this issue?  Setting the keep alive probe down to 50 seconds and then resending it every 10 seconds seems to do the trick for me. I also tweaked the TCP settings so that if no ACK response is received for 5 consecutive times, the connection is marked as broken.  Here's the quick one-liner fix:
 
 sudo sysctl -w net.ipv4.tcp_keepalive_time=50 \
 net.ipv4.tcp_keepalive_intvl=10 \
 net.ipv4.tcp_keepalive_probes=5  

Of course, to make these settings persistent across reboots, add them to /etc/sysctl.conf

I'm not sure if these settings are "optimal", but they do the trick. You're mileage may vary.

3 comments:

  1. Do what I did, plug your old router into the eth port beside the coax cable and flick the hub over to modem only mode no more issues with unreliability fixed, I think popey had to do the same thing so he could use his sip phone.

    ReplyDelete
    Replies
    1. My older router had different "reliability" issues and also I don't really want to have another piece of old legacy kit running - I'm trying to save power :-)

      Delete
  2. I've had exactly the same problem and ended up adding

    ClientAliveInterval 60

    to the sshd config files on the servers I ssh into. But your solution seems better.

    ReplyDelete