

The command I come up with is next: autossh -M 20000 -N -i /home/tool/.ssh/id_rsa -R 8080:localhost:80 -C There is a tool that will help us - AutoSSH.Īutossh is a program to start a copy of ssh and monitor it, restarting it as necessary should it die or stop passing traffic. For example, once your ssh connection times out (By server-side timeout), your tunnel should be re-established automatically. Don’t forget to launch your application ) AutoSSHĪlso, we need to make a tunnel persistent - make sure the tunnel will always run. Now you can try to test it by opening your URL in the browser. The connection will then tunneled back to the client host, and the client then makes a TCP connection to port 80 on the localhost. -R 8080:localhost:80: This allows anyone on the remote server to connect to TCP port 8080 on the remote server.user - username on the remote server, IP - ip of the remote server.-i /home/tool/.ssh/id_rsa: Which identity (key) to use.Use a command like that: ssh -N -i /home/tool/.ssh/id_rsa -R 8080:localhost:80 -C

You can test if it works by trying to SSH on the remote server from the local server (caution, possible word “server” overdose): ssh Local server SSH Tunnelįinally, the SSH tunnel itself. After it is done add you public key from local server to the ~/.ssh/authorized_keys on the remote server. You need to generate a key (or just use the existing one if you have) using ssh-keygen command. To be able to create SSH tunnel to that remote server you need to give your local server SSH access. On the remote server - add your public SSH key to the authorized_keys Remote server Giving access Create a file in the /etc/systemd/system/ with the name like rvice Description=AutoSSH tunnel to remote server After=network.target Environment="AUTOSSH_GATETIME=0" ExecStart=/usr/bin/autossh -M 20000 -N -i /home/tool/.ssh/id_rsa -R 8080:localhost:80 -C WantedBy=multi-user.target
#Ssh tunnel hide ip free
It’s a good and free alternative to tools like Ngrok or Serveo. And use one of the remotely hosted servers to gain access to that tool through the internet. We decided to deploy one of our internal tools on the virtual machine inside that local server. And there is no access to that server outside of the local network.
