Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Suppose I use a Ubuntu machine in a computer lab which has a private IP like 10.255.1.34. At my home I use Internet provided by a local ISP, so my home PC has a private IP like 172.16.203.105. 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

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.

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 172.16.203.105. Which means you can ssh to your home-pc "172.16.203.105" 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:72.16.203.105:80 "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

 
discard

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.