How to connect / tunneling to another computer to use it's localhost?

11,739

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.

Share:
11,739

Related videos on Youtube

aspirinemaga
Author by

aspirinemaga

Updated on September 18, 2022

Comments

  • aspirinemaga
    aspirinemaga over 1 year

    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.

    • aspirinemaga
      aspirinemaga over 10 years
      sorry, forgot about it. updated
  • aspirinemaga
    aspirinemaga over 10 years
    I have installed OpenSSH server on A, and OpenSSH Client on B. There is no such a command line where I can apply your code. I tried to connect but it's not responding to the IP. IP is correct, ports forwarded to 22, 23, 80 to comp A. Any suggestion ?
  • ckujau
    ckujau over 10 years
    Now with your updated description (Windows OS on both ends), let me emphasize my first sentence: "If computer A is reachable via SSH" :-) If you don't have an SSH server installed on computer A, SSH tunneling won't be an option for you. One could still use a VPN solution, but this may be even harder to set up properly.
  • aspirinemaga
    aspirinemaga over 10 years
    I've updated my question. Pls could you modify your answer depending on my computer's IP adresses ? thank yoi
  • davidbaumann
    davidbaumann over 10 years
    Forwarding port 80 makes your development enivronment accessible to the internet, which I absolutely don't recommend!
  • aspirinemaga
    aspirinemaga over 10 years
    thanks, will try to find more about that teamviewer vpn. btw I can't switch to linux at themoment, but thinking about it already.
  • davidbaumann
    davidbaumann over 10 years
    You can switch, and run your old apps in virtualbox - maybe. I switched and don't miss the time running 12 installers to update my system after 2 weeks.