Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I use a Ubuntu machine in a computer lab which has a private IP like At my home I use Internet provided by a local ISP, so my home PC has a private IP like I am just user in both places. Is it possible to connect these to PCs by SSH tunneling?? You can also suggest me any alternative ways.

Thank You

share|improve this question

You want to have two private IP's communicating over the internet? Unless you can forward the ports on both sides (to be able to ssh from A to B and vice versa, otherwise you will only be able to connect one way): no.

Alternatives? You can setup a VPN server somewhere with a public IP or a an IP/port that get's forwarded.

share|improve this answer

The following may not be real ssh tunneling but an alternative solution to your issue. First of all..

  • On your home network firewall/router you have to setup a forwarding rule. Say you have port 2022 forwarded to 22 on Which means you can ssh to your home-pc "" like shown below.

    ssh -p 2022 "YOUR-PUBLIC-HOME-IP"

The next step is ssh tunnel , you can do this per-application or for the entire PC

  • For the entire just do

      ssh -X -p 2002 "YOUR-PUBLIC-HOME-IP"
  • Just want access port 80 on your PC

       ssh -L 2112: "YOUR-PUBLIC-HOME-IP"
       Note:-  Port 2112 is a random port you can choose any unused port >1000
  • Say you want to mount your home file system on your local workstation

       sshfs -p 2022 user@YOUR-PUBLIC-HOME-IP  /local-mountpoint

Home this answers your question.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.