Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I want to get computer reachable from the Internet, but I don't have a public IP. It's because I am connected through my provider's NAT. Due I have a own server in the Internet, I want go through my server in the Internet and additionally forward a couple of ports to my network.

How can I handle this? I think VPN is the right way, but I don't know how this works. My server is running Debian and my computer is running Ubuntu. I would prefer if I could use a SSH connection.

network scheme

I hope you understand my although my bad English.

share|improve this question
You're saying you have a computer at work that you want to directly connect to your home computer hidden behind NAT, and right now you can do it by hopping on a secondary computer and from there going to your home computer? – Bart Silverstrim Sep 7 '10 at 17:59
No, my computer (me) is at home and that MAN is the network of my provider. I want to connect my home computer (me) from the Internet, e.g. from my mobile phone... – Sven Walter Sep 7 '10 at 18:59

Have the system behind the NAT use openVPN to connect to your system in the middle.

That can keep a network connection open all the time depending on how you configure it. Read up on openvpn.

The you can use iptables to redirect traffic (say ssh on port whatever?) coming from the internet->MAN->"my server"

so you can ssh (port 2222)->MAN (redirects 2222 to port 22)->"my server" (port 22)

Then you can hop to any system in that network.

share|improve this answer
I think you are right, but this topic is quiet complex. The effort is not worth it. I have to find a more simple solution... – Sven Walter Sep 7 '10 at 22:25

If you prefer to use SSH, then it's as easy as 1.2.3...

Simply set up a reverse SSH tunnel (and any others ports you want to forward) - script it or such in a shell script of your choice, so that if the connection goes down, it re-connects via a cronjob or such.

I would also suggest using ssh-agent so you don't have to enter any passwords (or passphrases when using this), if set up properly.

It's all in the man page and/or here too: (then there's google too).

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.