I have the following setup:
- Raspberry Pi with no public IP address
- Public "jumpserver"
Currently i have autossh running on the Raspberry to connect to the jumpserver.
Works without problems. I connect to the jumpserver via ssh and from there via ssh to the Raspberry Pi.
Now i want to add a VNC client on the Raspberry to the game so i can directly connect to it from my local machine. My plan would be:
- Start VNC on the Raspberry (Port 5901)
- Make an connection with autossh to create a reverse tunnel between localhost:5901 and jumpserver:1702
- Create iptable-entries on the jumpserver to forward incoming traffic on port 5555 to localhost:1702
The first question is: Could this work like this? Not sure about the vnc port on the Raspberry being the same as the local port auf autossh. Or would i need another local port for autossh and also use iptables on the Raspberry to forward the incoming traffic from autossh to the VNC port?
Any help is appreciated.
I already created iptable entries on the jumpserver like this, but it doesnt work:
sudo iptables -t nat -A PREROUTING -p tcp --dport 5555 -j DNAT --to-destination 127.0.0.1:1702
sudo iptables -t nat -A POSTROUTING -p tcp -d 127.0.0.1 --dport 1702 -j SNAT --to-source 127.0.0.1:5555