Remote Device Connection behind firewalls (say CGNAT 4g)

My remote device is behind a firewall so I run a reverse tunnel using autossh to access it and als access the web pages.

I have a file resverse.sh with runs on reboot (crontab @reboot) with the following line

autossh -M 0 -N -f -o “ServerAliveInterval 30” -o “ServerAliveCountMax 3” -o “PubkeyAuthentication=yes” -o “PasswordAuthentication=no” -i /pathto/.ssh/id_rsa -R 9886:localhost:22 user@atmylinuxrserver -p 22 &

As similar line for http or https port.

I can then connect ssh -p 9886 -i /pathto/pisid_rsa pisuer@localhost from my home machine

It needs keys setting up which can be fiddly. It do change SSH port away from default 22

The quicker approach is https://www.pitunnel.com which is so easy to set up and seems more stable than my autossh reverse tunnel. I am very impressed by their script. I have both tunnels and of course flightaware’s pages can reboot and update.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.