Secure Tunnelling with SSH - Remote Control (Page 7 of 9 )
SSH also allows you to do the reverse - forward connections made to a port on the remote host to the local host, or some other host.
In order to better understand this, let's look at another example. Suppose I wanted all connections made to port 9000 on the remote host "brutus" to be forwarded to port 80 (the Web server port) on my local machine "olympus". Here's how:
[me@olympus] $ /usr/local/ssh/bin/ssh -R 9000:olympus:80 brutus
Once SSH connects and logs me in, it will automatically set up a listener on port 9000 on the host named "brutus". All connections to this port will then get forwarded to port 80 on the host named "olympus" (my local host).
You can verify this by logging in to "brutus" and attempting a telnet connection to port 9000:
[me@brutus] $ telnet localhost 9000
Trying 127.0.0.1...Connected to localhostEscape character is '^]'.GET /some.file.html HTTP/1.0HTTP/1.1 404 Not FoundDate: Fri, 28 Mar 2003 06:11:36 GMTServer: Apache/1.3.20 (Unix) PHP/4.0.6Connection: closeContent-Type: text/html; charset=iso-8859-1
Next: In And Out >>
More Administration Articles
More By icarus, (c) Melonfire