I'm trying to establish a SSH tunnel to allow VNC/ARD connections (ports 5900 and 3389). However I'm uncertain about a certain thing:
Let's say machine A has IP 192.168.103.1 and has services running on ports 5900 and 3389.
I want to SSH to the server that has IP 192.168.103.254.
Machine B 192.168.103.2 wants to connect to machine A by using an tunnel on the server 192.168.103.254 and different ports (let's say 6001 and 4001)
So, the setup will look like this:
Machine B 192.168.103.2 --> VNC to Server 192.168.103.254:6001 (Server redirect --> 192.168.103.1:5900)
I know a little bit about SSH tunnel and reverse SSH tunneling but I'm unsure which command I need.
Please note:
- The Client PC has to connect to the server (the other way around is not possible since the clients have different IP addresses everytime)
Things I tried:
ssh -f [email protected] -L 6001:localhost:5900 -N
This command succeeds but when I try to connect to it I get a connection refused error:
Tims-Macbook-Pro:~ Tim$ telnet server.hostname.net 6001
Trying 192.168.103.254...
telnet: connect to address 192.168.103.254: Connection refused
telnet: Unable to connect to remote host
I also tried this
sudo ssh -NT -R 6001:localhost:5900 [email protected]
The command also gives a connection refused error when I'm trying to access it.
Tims-Macbook-Pro:~ Tim$ telnet server.hostname.net 6001
Trying 192.168.103.254...
telnet: connect to address 192.168.103.254: Connection refused
telnet: Unable to connect to remote host