telnet/ssh disconnects... Possible NAT teardown?

Christopher K. Johnson ckjohnson at gwi.net
Sat Feb 7 14:48:11 UTC 2004


Jeremy wrote:

>Ok, I'm at home now, and i tried telneting in from another computer on the
>network....   It works fine.  No disconnects.
>
>I'm using Road-Runner (Cable modem) to connect to the internet, the linux PC in
>question is the router (2 NIC cards, one to cable modem, other to LAN).
>
>Is it possible the cable modem is the cause?  I don't understand what could be
>wrong.
>
>-Jeremy
>
>  
>
This is a common problem with ssh connections through firewalls.
I avoid this problem by placing the following perl script in my path 
(either world executable in /usr/local/bin for any users , or user 
executable in my own ~/bin/ directory) and I name it "dot".  Then either 
execute dot when leaving an ssh session alone for a while, or run it in 
the background if it is not too disruptive of what you are doing.   Just 
ctrl-c with dot in the foregrond to stop it.

#!/usr/bin/perl
# Simple keep-alive script when port forwarding via ssh through firewall
# Otherwise the TCP connections in fw table may timeout.
$|=1;
$i=0;
while (true){
  $i++;
  if ($i>60) {
    print("\n.");
    $i=1;
  } else{
    print(".");
  }
sleep 60;
}

Enjoy!

-- 
-----------------------------------------------------------
   "Spend less!  Do more!  Go Open Source..." -- Dirigo.net
   Chris Johnson, RHCE #807000448202021






More information about the fedora-list mailing list