- Home /
Connect to remote private IP
Hi! First of all, thanks to anyone who reads this and attempts to help me, it is really appreciated ^^
Second, the actual question: Is there a way to manually connect (Nework.Connect()) to a server (directly to the computer, not its router) if we happen to have the public IP of its router AND the private IP assigned by the router of the server via a custom build master server that saves public IP, private IP and the port of each servers.
I know a NAT facilitor kinda does that, but im trying to stay away from those, since unity's official masterserver and facilitor pretty much never work like intended
tl;dr : How to connect to a specific server with its router IP, its port and its private IP (assigned by the router). Thanks!
-SpectralMemories
Answer by thegreatzebadiah · Jun 26, 2016 at 12:09 AM
The host will have to forward the port they are hosting on in their router settings.
the client will then be able to connect to the host's public IP on the forwarded port.
I understand what you are saying, I know that the hosts must portforward their router for one to connect on their machine using its public IP. $$anonymous$$y question is how to avoid the need to portforward, given the fact that the client knows the private IP (and thus the specific machine) on which it has to connect.
I created a plugin for just this purpose that you can get on the asset store. It does automatic port forwarding, as well as NAT punchthrough, which will get your players connected even when port forwarding is not an option. Check it out, I think it's exactly what you're looking for: http://u3d.as/qhh
The routes have to be added to the router or it will never let traffic through. Automatic port forwarding will set that up automatically. NAT punchthrough sort of tricks the router into adding the routes.