Networking – How to connect / tunneling to another computer to use it’s localhost

apache-http-serverlocalhostnetworkingsshssh-tunnel

I'am not quite sure how to describe what I really asking for, so i will try:

I have two computer A and B.

Computer A is my primary computer I'am working on. I'am web developer, and as you may know, I'am using XAMPP / WAMP applications to deploy a server Apache/MySQL/PHP etc… so I can use: http://localhost and http://127.0.0.1 to access my websites on localhost machine.

Now at the moment, I'am not at home, currently on Computer B. I would like to access Computer A from Computer B so I can use http://localhost/ adresse on Computer B to access the websites I've been developing on Computer A.

I remember someone told me something about tunneling throught SSH (i.e. in PUTTY), but I'am not sure how to do it. So I would be really glad if someone could give me a hand on this.

Thanks

==== UPDATED ====

Configuration on both computer are the same: OS Windows 7 64bit.

==== UPDATED 2 ====

Both computers are accessible with public IP addresses.

Best Answer

If computer A is reachable via SSH, an SSH tunnel would be indeed the way to go:

computer-B$ ssh -L 1234:localhost:80 computer-A.example.com

Once you're logged in, point your browser to http://localhost:1234 and the webserver on computer A should respond.

With putty, there's a "Tunnels" menu underneath the "SSH" option (left side) where you can configure the same forwarding.

Update: While virtually all Linux distributions are shipping an OpenSSH server, Windows operating system has no such thing by default. There are however SSH servers for Windows available. Once the SSH server is running on computer A (and port 22/TCP is forwarded to that computer, if it's behind a router), you can use the example above to finally connect to computer A either via command line or via a graphical SSH client, like Putty.