Using SSH as a simple VPN: timeouts?



I'm using ssh with port forwarding

ssh -f -N username@sshserver -L localport:remotehost:remoteport

together with the following iptables rule to transparently forward all traffic with destination remotehost:remoteport through the secure tunnel.

iptables -t nat -A OUTPUT -p tcp -d remotehost--dport remoteport -j DNAT --to-dest 127.0.0.1:localport

This works really great, but after some time (a few hours) the ssh connection is automatically disconnected (mostly after a period of inactivity on the client). I assume this has to do something with a timeout on the ssh server? But I couldn't find documentation on that? Anyone knows how to keep the connection open forever (or until I kill the ssh client manually)? I have the necessary permissions to change the configuration of to ssh server, if that is required.
.



Relevant Pages

  • Re: Safest way of accessing a home computer from outside?
    ... what if I my router doesent have a public IP ... use for ssh is forwarded to your ssh server. ... You can find Hamachi at ...
    (Fedora)
  • Re: Safest way of accessing a home computer from outside?
    ... what if I my router doesent have a public IP ... I agree - ssh with no password and then use certificates to ... use for ssh is forwarded to your ssh server. ... You can find Hamachi at ...
    (Fedora)
  • Re: AIX 5.2L "who" question
    ... SSH is corrupting the utmp file! ... where did you get the SSH server you are running? ... We have a 44P-270 running AIX 5.2L, when users connected via ssh they can't ... Monitoring ...
    (AIX-L)
  • Re: Blocking attacks from spoofed IP addresses
    ... Some of the ssh attacks are distributed. ... So IMHO public key authentication does not necessarily reduce risks. ... if one is scared about login unwanted attempts on a ssh server ...
    (comp.os.linux.networking)
  • Re: Remote Desktop from Linux console
    ... if your running a SSH server on L you can connect to V using RDC through the SSH tunnel. ... I do, or did, that all the time when I ran a SSH server on either a PC inside my router or on the router itself, ie. DD-WRT running on the router. ...
    (microsoft.public.windows.vista.networking_sharing)