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

2 Answers 2


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.


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .