Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I want to connect another computer via internet that doesn't have a public IP. Is there any away to do this?

share|improve this question
Khajavi - Why does the target computer not have a valid IP address? By which I mean, is it not physically connected to a network, is its IP address in a non-routable subnet, etc? – Tok Dec 5 '11 at 19:27
Is the destination computer connected to the Internet via some router? – Sachin Divekar Dec 5 '11 at 19:31
Did you ask for how to connect to another pc that does not have a public ip? More or less how to setup a ssh tunnel? – Johan Dec 5 '11 at 21:08
@Khajavi - People here would love to help, can you make your question a little more clear? We're not sure exactly what you are trying to accomplish. – gabe. Dec 5 '11 at 21:57
I apologies for my bad question, I means no public IP address. My network information is basic. sorry all. – Milad Khajavi Dec 6 '11 at 19:05
up vote 6 down vote accepted

I presume that by “doesn't have valid IP” you mean that the computer you want to connect to (let's call it bob) does not have a public IP address and is behind a NAT.

You can only make TCP connections (such as SSH connections) to a computer that has a public IP address. Or at least, the connection must be relayed by a computer that has a public IP address. If you can control the NAT device (a firewall of some kind) to open the public port 22 (or any other port) and forward it to bob, then you would ssh to that NAT device and be connected to bob.

If that is not possible, you need to connect out from bob to some other computer on the Internet with a public IP address. This is generally called “reverse SSH”. If the computer you're connecting from has a public IP address, see How can I configure a reverse SSH connection to the connecting computer?.

If neither the computer you're connecting from nor the computer you're connecting to has an IP address, you need to relay the connection via a third computer. Let's call the computers alice (from), bob (to) and charlie (via).

share|improve this answer

You can try a tunneling solution like n2n to establish connectivity between NAT'ed systems.

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.