0

Assume you have a host (hosta) that is running a TCP service (e.g. a VNC server on port 5901). You want to access to this service from another host (hostb) running a VNC client. Both hosts are connected to Internet, but there are some restrictions:

1. hosta can be reached from the Internet using any of its TCP ports

VNC client on hostb connects to hosta:5091 directly.

2. hosta can be reached from the Internet only through SSH

From hostb:

ssh -L 5901:localhost:5901 usera@hosta

VNC client on hostb connects to localhost:5901

3. hosta cannot be reached from the Internet (e.g. it is behind CGN / CGNAT). However, hostb can be reached from the Internet

From hosta:

ssh -R 5901:localhost:5901 userb@hostb

VNC client on hostb connects to localhost:5901

4. hosta and hostb cannot be reached from the Internet. They are behind CGN / CGNAT; they can only create outbound connections

We can use another host (hostc) which can be reached from the Internet using ssh.

From hosta:

ssh -R 5555:localhost:5901 userc@hostc

From hostb:

ssh -L 5901:localhost:5555 userc@hostc

VNC client on hostb connects to localhost:5901

I have a case like the 4th scenario above, but I do not wish to use a third host (hostc), mainly because of performance and cost reasons.

What are my alternative (cheaper [=free] and better performance) options?


Note 1: I have tested and determined that although TCP hole punching does not work in my case, UDP hole punching does work. However, I need a tool that will establish connection oriented (similar to TCP) session over UDP that will utilize UDP hole punching.

Note 2: Failing to use any of "UDP hole punching" programs available on the Internet, I decided to write my own. I am still improving it, but, as it is, it works fairly well. You can find it here.

4
  • 1
    Not sure that you'd be able to get away from using a commonly accessible (third) machine, in your fourth use case. Alternatives to SSH would include virtual private LANs (e.g., Hamachi) or VPNs, both of which (in your case) would still require a third party.
    – joatd
    Jan 6, 2019 at 14:08
  • You haven't much alternatives here: either one of NATs should be configured for port forwarding or external host should be used.
    – montonero
    Jan 16, 2019 at 11:32
  • @montonero yup. but at times, that isn't the case. EG - brother and sister go to 2 different universities, and both are behind NAT and have no ability to change configuration at either end.
    – ivanivan
    Feb 3, 2019 at 15:58
  • @ivanivan in this case some intermediate host should be involved. to make a connection you'll need to have an open port at some point.
    – montonero
    Feb 4, 2019 at 7:18

1 Answer 1

0

Tor and tor hidden services is one option. It technically still assumes usage of some third host, but in our case that will be a chain of multiple such hosts: hosta <-> hostc1 <-> hostc2 ... <-> hostb

It's not that fast, but it's free, opensource and secure.

Also, the similar option will be any other overlay networks. From the top of my head: I2P, FreeNet, GNUnet

You must log in to answer this question.

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