Ok, so say my macs network name is 'mymac', then:
When defining tunnel -
Source port: 6900
Destination: localhost:5900 ('localhost' or 'xxxx.dyndns.org')?
When defining session -
Host name:
[email protected]
Also, how is port 6900 significant if its accessing the mac using port 22? (Excuse my ignorance, not 100% clued up on ports etc.)
OK, if your mac's network name is mymac, you will have a dyndns entry pointing back to it. Something like mymac.dyndns.org that resolves to the IP that mymac lives on.
So to SSH onto it, you would go -> SSH
[email protected]
That establishes the connection tunnel to the remote machine.
The -L command does the port redirection. So you need to tell ssh what port you want on the machine you are ssh'ing from to tunnel to.
So, say on the machine you are ssh'ing to, you want to connect to port 5900. the end of the tunnel on the remote side is ITS localhost. so you use localhost:5900. For arguments sake, if you wanted to use your mac on the remote end to route to your adsl router on 192.168.1.1 on port 80 for web access, you would use 192.168.1.1:80.
Because ports 80 and 5900 are most probably in use already on the machine that you are ssh'ing FROM, you have to use another port. I use 6900 or 6901 because they are normally free. so the SSH -L 6900:localhost:5900 command does this - it tunnels traffic on port 6900 from the machine your are ssh'ing from to port 5900 on the machine your are ssh'ing TO.
The username@domain establishes the connection to the remote machine, thats it.
So if you wanted to connect to your adsl router at home, this is what you would do. SSH onto your mac at home, and tell it to route the traffic on port 6900 on your client machine to port 80 on your router. you would then open your browser and go to
http://themachineyouaresshingFROM:6900 and your adsl router's webadmin page would load. Normally the machine your are sshing from is 127.0.0.1 or localhost.
The commands would thus be for you, assuming on your home network the router is on 192.168.1.1 :
SSH
[email protected] -L 6900:192.168.1.1:80
Open your browser and go to
http://localhost:6900
If you wanted to view the webserver on the mac you are sshing to at home :
SSH
[email protected] -L 6900:localhost:80
Open your browser and go to
http://localhost:6900
I think you will get the drift, hope this helps!
In summary, the process is establish the tunnel, direct the ports.
SSH "CREDENTIALS OF REMOTE MACHINE" -L "LOCALPORT ON CLIENT MACHINE":"DESTINATION IP YOU WANT REMOTE MACHINE TO ROUTE TO (USE LOCAL IF ITS THE SAME MACHINE)":"DESTINATION PORT"
Let me know if you still dont come right.
P