Search Unity

Remote clients can no longer connect with new modem / router

Discussion in 'Multiplayer' started by MMOERPG, Nov 28, 2016.

  1. MMOERPG

    MMOERPG

    Joined:
    Mar 21, 2014
    Posts:
    50
    Hi,

    PROBLEM: I have a unity networking game that I got working twice in two locations without changing the game code. I've recently moved once again and am using a new router and the game will not connect remote clients, only local clients using localhost or the servers internal ip address as the Network Address.

    Dynamic DNS: I'm using No-IP for my dynamic DNS and have ensured that is working properly and updating my external IP address. The address for No-IP is what I place in the Network Address field (mmoerpg.ddns.net in this case.)
    NoIP.PNG

    Port Forwarding: I went in to my router and forward the port that the game uses which is 4444 allowing both TCP and UDP connections to the internal IP address of my server which was set to static. Still, when I try to connect a remote client using these settings, it does not connect although it used to connect using these same settings.
    Screen Shot 2016-11-27 at 8.34.06 PM.png

    Test Port Forwarding: I began to think it was the new router (I would use my old router for trouble shooting but the new router is modem/router combo and is designed for DSL whereas my old modem is for Cable.) To test that the router had in fact forward the ports correctly, I went to www.portchecktool.com and test port 4444. First, it said that the connection was timing out. I tried disabling the firewall on my server and tried again. This time it, much more quickly, it said Connection refused. I then tried running the game on the server with the firewall disabled and still, the port check tool said Connection refused.
    Screen Shot 2016-11-27 at 8.30.29 PM.png
    Screen Shot 2016-11-27 at 8.30.48 PM.png

    Check For Listened Port w/ netstat -a: So it now seemed that the port was forwarded properly as it was trying to get into my server but the server was refusing it. The next thing I checked was whether my game was actually listening on the right port after starting and that that port wasn't already being used by another program for some reason. I opened cmd with admin rights and used the netstat -a command which shows all ports currently being listened to. Port 4444 was not on the list. Great, nothing is using the port. I launch the game and start server then check netstat -a again. This time it shows two UDP instances listening to port 4444. What is strange is that the prefix for the port is not my servers internal IP address which I thought it should be but then again I don't really know. The prefix for one was 0.0.0.0:4444 and the other was [::]:4444. Could this be my problem? or is this normal when a program is listening on a UDP port.
    netstat -a.PNG
     
  2. MMOERPG

    MMOERPG

    Joined:
    Mar 21, 2014
    Posts:
    50
    This was post by Bunny83 on another thread that I had improperly post this question to. Thank you Bunny83.

    0.0.0.0:4444 is correct. "0.0.0.0" is the local binding address for the socket. As you might know IP communication uses IP addresses inside of a packet to specify the target location. In order to receive packets one has to "open" a port first. In addition to specifying the port you can also specify what local address you want to bind to. That means only packets which are sent at that specific IP address are actually received. One computer / peer can own multiple IP addresses at the same time. You usually have a local network address as well as the local loopback address which however is only valid within your own system. The address 0.0.0.0 is a special address which simply means "all addresses". So there's no restriction which the actual target IP is, you will get any packet on that port that arrives at your NIC.

    Note: some routers have their own firewalls built-in so make sure you check that. Also keep in mind when you forward ports to choose the right protocol. When in doubt you can forward both (TCP and UDP).

    Some other routers (i have such a crap :|) don't allow local loopbacks on the public IP of the router, That means the whole world can connect to your router, except you how sits behind this router. All routers i had before had no problems going out and coming straight back in using the public IP. However if you use an external site to test the connectivity that shouldn't be the problem.

    I suggest you install a packet monitoring software on your server (something like WireShark) to see if you receive anything. You can do the same on your client to see what goes out and what comes back. If you get a connection refused you should receive an ICMP message with "delivery failure".
     
  3. fredrikholmstrom

    fredrikholmstrom

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    8
    A few things to keep in mind:

    1. Is your new modem/router a pure modem-router configuration? Some modems have built-in routers in themselves so you get double NAT:ed (this has happened to me), which means you need to open ports in both places.
    2. Did you open the ports in windows firewall?
    3. Not getting a reply on an ICMP package is not uncommon since a lot of routers block them, and refuse to answer to them.
    4. Some routers do not support what's called "hairpinning", it basically means that you can't connect on your external ip address from within the NAT itself, this is a limitation in the NAT software/hardware, you can read more about it here: https://en.wikipedia.org/wiki/Hairpinning (I've had this issue on my own home connection as the router supplied with the DSL-line did not support it).
     
    Lohoris2 and MMOERPG like this.
  4. MMOERPG

    MMOERPG

    Joined:
    Mar 21, 2014
    Posts:
    50
    Oh for the love of internet,

    Thank you for the suggestions @fredrikholmstrom sure enough, my city modem/router does not support hairpinning. I set my modem/router to transparent bridge mode and attached my old TP-Link router and BAM! it all works perfectly.
     
    Lohoris2 likes this.
  5. BiwanMedona

    BiwanMedona

    Joined:
    Oct 10, 2018
    Posts:
    1
    We here at Intercel offer a wide variety of 4G routers in industrial rugged enclosures which are used on the industrial level for M2M/IoT applications. They have been tested and proved to be operational in extreme environments like heat and vibration. These devices are very smart and are used as utilities in industries.
     
    Last edited: Feb 1, 2019