Hi, I’m currently facing an issue where I can’t connect to a host via internet.
It’s only a simple test project where syncing basic movement is the only thing I’m trying to do. It really is simple, for hosting and joining, I’m only using StartHost and StartClient. No matchmaking whatsoever.
It worked great over LAN. However, I can’t seem to connect to host via internet.
I’m using my laptop as the host, and android as the client. My laptop’s connection to internet goes like this :
laptop → wifi router&modem-> internet
while my android connects directly to internet using mobile data.
I have opened the port (7777) on my laptop, both tcp and udp. I also have changed the networkaddress both on host and client to my laptop’s IP which I got from whereismyipaddress.com . I have tried using the bind server to IP option, with that IP, but it didnt help. I dont even know know what binding server to ip is for. Turning off firewall didnt help either. I have exception for unity anyway.
My ISP seem to use dynamic IP, would that be a problem? I searched and found that it would lead to random disconnection but I should be able to connect at least for a little while, right?
Also all devices connected to internet through my wifi router also share the same ip address, would that also be a problem? My android has different IP tho since I use mobile data for it.
Thank you.
I guess you didn’t config you router properly. Sometimes, there is a option “open game port” in router config and it should be application binding config too. Anyway, the following rule should be configured in your router:
udp: map “your router ip” port 7777 to “your local computer ip” port 7777.
hope it helps
Thanks. I’ve read more about this and it seems like that’s the problem. Though no one in my home seem to remember the router admin username and password, haha. I’ll try resetting later.
Btw I also found stuff like NAT punchthrough and traversal (are they the same tho), automatic port forwarding, and UPnP. Will they let users host games on 3G?
Thanks again.
Hi Linearch, maybe I can answer some of that. I’ll start with what I think is your biggest question:
From the little bit of research I’ve done, it seems like most nat traversal methods are unfortunately less effective on mobile networks. See this wikipedia page for more info: https://en.wikipedia.org/wiki/NAT_traversal#Symmetric_NAT
The way I think of at it at least, NAT traversal is more of a general term for any method of getting around router issues so you can connect to a host. This includes a bunch of types of punch-through, the relays that Unity uses, and port forwarding.
UPnP is a common method of automatic port forwarding. NAT PMP is another. Again, automatic port forwarding is just the general term for a bunch of specific technologies that all do the same thing. Port forwarding is only necessary for hosts that are behind a router (and therefor using a shared public address). In the case of 3G I don’t think it really applies since you are connected to the mobile network and not a home router. I’m not as knowledgeable on mobile stuff though so maybe someone else will chime in with a more concrete answer for you.
So all of them are meant for routers right? Heard that most mobile carriers also block UDP on their side while UNET uses UDP. Guess it’s a no-go then.
Thanks for the detailed explanation