

Therefore, to reach my NAS, I have a VPS (which I rent from OVH for a very small monthly cost), and that has a fixed public IP address. I have a NAS that I want to reach from the internet, I can't use port forwarding because my ISP uses CGNAT (my public IP is not really my public IP, I'm behind another router I don't have any control over).


This option applies to protocol version 2 only.įor those who don't want to (or) can't use AutoSSH. Theĭefault is 0, indicating that these messages will not be sent to The encrypted channel to request a response from the server. Sets a timeout interval in seconds after which if no data hasīeen received from the server, ssh(1) will send a message through (see below) is set to 15 and ServerAliveCountMax is left at theĭefault, if the server becomes unresponsive, ssh will disconnectĪfter approximately 45 seconds. The server alive mechanism is valu‐Īble when the client or server depend on knowing when a connec‐ The serverĪlive messages are sent through the encrypted channel and there‐įore will not be spoofable. Messages is very different from TCPKeepAlive (below). It is important to note that the use of server alive If this threshold is reached while server alive messages areīeing sent, ssh will disconnect from the server, terminating the Sent without ssh(1) receiving any messages back from the server. Sets the number of server alive messages (see below) which may be Upstart script on Ubuntu, where /etc/inittab is not available: start on net-device-up IFACE=eth0Įxec ssh -i /path/to/rsaKey -N -o "ServerAliveInterval 180" -R 55002:localhost:22 scriptĪccording to man page for ssh_config: ServerAliveCountMax etc/inittab, to have access to a box shipped and installed in another country, behind NAT, without port forwarding to the box, you can configure it to create an ssh tunnel back to you: tun1:2345:respawn:/usr/bin/ssh -i /path/to/rsaKey -f -N -o "ServerAliveInterval 180" -R 55002:localhost:22 'sleep 365d' sleep 5 done) do not remove the sleep command, ssh may fail quickly and you'll respawn too many processes Always use ServerAliveInterval SSH option in case the tunnel issues are generated by expired NAT sessions.Īlways use a respawning method in case the connectivity goes down entirely, you have at least three options here:
