0

I am creating a multiplayer game using Unity Game Engine. I created my server using Socket in C#.

My server works fine on the LAN, however it doesn't work on the WAN. I learned that I need to configure port forwarding in order to make it work on the WAN. I am using a Tp-Link router, and I found a great video that helped me to setup port forwarding:

https://www.youtube.com/watch?v=2tIUts0fyFk

Things I adjusted on my own:

  1. In the video, the person used HTTP, but I chose DNS for my Socket server. I don't really know what I should choose here.

The service type

  1. On the client side, I changed the server IP from the IP reported by ipconfig to my router's static IP, and the server port to the port I chose while setting up port forwarding.

The ip I am using in client side code

  1. On the server side, I put the IP reported by ipconfig as the server IP. This is the same IP I chose as my DHCP OPTION.

MY DHCP SECTION IP

I am using the UDP protocol for my game, and as I said it is working fine in my LAN network.

My problem is, even after all this, my game is not working on the WAN. I also made sure that my WAN client has his Windows Defender firewall turned off. It didn't work.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Saunak
  • 3
  • 3
  • HTTP is port 80 TCP; DNS is port 53 UDP. It's just how this router sets the port number. There should be an option to enter your own port number. Or if you run your game on port 53 it might work since it's the same port as DNS. – user253751 Jul 09 '22 at 18:41
  • 1
    there is no need to redact local addresses in your screenshots ... IP 10.x.x.x and 192.168.x.x and 172.16.0.0 to 172.31.255.255 are local only ... they are duplicated millions of times on LANs throughout the world ... these IP address ranges are not directly accessible from the internet ... so saying that client 0 uses 192.168.0.216 is not a security risk – jsotola Jul 09 '22 at 18:53
  • @jsotola Hey thank you for your response! I didn't know that that's why I just redact them to be at safe side. – Saunak Jul 09 '22 at 19:00
  • @user253751 Hey, Thanks for your response ,but as I said it is not working for me. I am using the same port that the router has provided me, "53" as you said. I do not know why but it is not working. My friends are still trying to connect to the server from WAN, but there no hope so far. – Saunak Jul 09 '22 at 19:02
  • @Saunak Using DNS as the server type is definitely wrong, since you are not running a DNS server. But, that being said, as long as your game server is listening on the LAN IP:port correctly (you didn't show your server code), and you configure your port forwarding as `UDP WAN IP:port -> UDP LAN IP:port` correctly (you didn't show your port configuration), and the client sends packets to the WAN's IP:port correctly (you didn't show your client code), and firewalls are off, then everything *should* work - **unless** your ISP is blocking inbound UDP traffic to your WAN IP:port (did you ask them?) – Remy Lebeau Jul 09 '22 at 23:21

0 Answers0