6

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

Nils
  • 18,492
  • 1
    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 05 '11 at 19:27
  • Is the destination computer connected to the Internet via some router? – Sachin Divekar Dec 05 '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 05 '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 05 '11 at 21:57
  • 1
    I apologies for my bad question, I means no public IP address. My network information is basic. sorry all. – Milad Khajavi Dec 06 '11 at 19:05

2 Answers2

6

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).

0

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

ewwhite
  • 1,521