tty/pty/console wish

Matthew Dillon dillon at
Tue Jun 5 17:52:42 PDT 2007

    I will note one thing on remote sessions... if you are running through
    NAT (network address translation), which is a very typical function of
    today's cable modems, the NAT translation will often timeout if the
    link stays idle too long.  This will cause the link to die when you
    come back to it later on and try to type something.

    The only way to deal with this is to adjust the TCP keepalive timers:

    sysctl net.inet.tcp.always_keepalive=1
    sysctl net.inet.tcp.keepidle=7200000
    sysctl net.inet.tcp.keepintvl=75000

    The numbers are in ticks.  The default, 7200000 (with hz = 100)
    is 20 hours.  That is, an idle TCP connection is only tested
    once every 20 hours by default.

    The keepalive interval is how often it retries (up to a limit) after
    the tcp connection has been idle for keepidle ticks.  The default is
    around 12 minutes.  It retries a few times before giving up and
    dropping the connection.

    You would have to reduce  the idle interval down to something a lot
    smaller to prevent the NAT session from timing out.  Something like
    60 seconds or so (keepidle set to 6000 and keepintvl set to 6000.
    YMMV.  Clearly not something one can do over a dialup or if running
    a small server, but perhaps reasonable on a client.  The interval 
    depends a lot on the NAT server and the connection load the NAT server
    is handling.


More information about the Users mailing list