Master Server.
by Mark Cohen · in Torque Game Engine Advanced · 04/02/2009 (2:25 pm) · 5 replies
Hi,
I have read pretty much all the postings on making and running a master server. I am using the perl one in the resource. This is what I found out and I just want to confirm this for myself and everyone else so no one has to dig through all the posting like I had to.
1-If you are behind a NATed firewall even with port forwarding on you can not expect to be able to host both the Master Server and a dedicated game server even if they are on the same machine because the IP address is the same. I found this out by reading and trial and error. When I run them both behind my firewall and connect through the internet outside my firewall the Master Server picks this up but I can not see any game servers. When I run the dedicated server and a game client outside my network and point to my Master Server it works.
2-How does anyone actually run their own Master Server and dedicated server behind their firewall and expect anyone to connect to it outside their firewall? What are my options?
Thanks in advance for your help.
I have read pretty much all the postings on making and running a master server. I am using the perl one in the resource. This is what I found out and I just want to confirm this for myself and everyone else so no one has to dig through all the posting like I had to.
1-If you are behind a NATed firewall even with port forwarding on you can not expect to be able to host both the Master Server and a dedicated game server even if they are on the same machine because the IP address is the same. I found this out by reading and trial and error. When I run them both behind my firewall and connect through the internet outside my firewall the Master Server picks this up but I can not see any game servers. When I run the dedicated server and a game client outside my network and point to my Master Server it works.
2-How does anyone actually run their own Master Server and dedicated server behind their firewall and expect anyone to connect to it outside their firewall? What are my options?
Thanks in advance for your help.
#2
It's likely that when your master server and your game server are inside your firewall, your master server might be reporting the address of the game server as a local IP address instead of the one you're forwarding from your firewall.
(i.e. your firewall / dyndns address might be 234.112.42.45 and your internal game server address is 192.168.1.23)
When a client attempts to connect to the game server using the reported address of 192.168.1.23, that's obviously not going to work.
A workaround might be to make sure your game server connects to the master server via the dyndns address, not via the internal 192.168.x.x address.
The same theory applies to the server running on the same machine. If you're connecting to the master server via "localhost" or "127.0.0.1" then the master server may get the wrong address. Again, use the dyndns address instead of localhost and 127.0.0.1.
As for things not working when the master server and the game server on the same machine, that sounds a bit odd, but possibly it's because TGEA 1.8.x has a nasty little bug in that it ignores all UDP packets coming from 127.0.0.1. See this post for more details and a way to fix it.
Just a thought... that might not be the problem, but it's a good place to look.
04/03/2009 (6:33 am)
I'm not exactly sure how the Perl version of the master server works, but I bet it's getting the IP address of game servers from the recvFrom().It's likely that when your master server and your game server are inside your firewall, your master server might be reporting the address of the game server as a local IP address instead of the one you're forwarding from your firewall.
(i.e. your firewall / dyndns address might be 234.112.42.45 and your internal game server address is 192.168.1.23)
When a client attempts to connect to the game server using the reported address of 192.168.1.23, that's obviously not going to work.
A workaround might be to make sure your game server connects to the master server via the dyndns address, not via the internal 192.168.x.x address.
The same theory applies to the server running on the same machine. If you're connecting to the master server via "localhost" or "127.0.0.1" then the master server may get the wrong address. Again, use the dyndns address instead of localhost and 127.0.0.1.
As for things not working when the master server and the game server on the same machine, that sounds a bit odd, but possibly it's because TGEA 1.8.x has a nasty little bug in that it ignores all UDP packets coming from 127.0.0.1. See this post for more details and a way to fix it.
Just a thought... that might not be the problem, but it's a good place to look.
#3
Thanks
04/03/2009 (6:36 am)
Side note... Mr. Blake, can you make sure Mr. Scarborough is aware of this issue?Thanks
#4
I am pretty sure it is the locatlhost 127.0.0.1 issue as you mentioned as this did not happen with TGE when running dedicated and msster server on the same machine and I think I can probably comment out that code that ignores 127 and it will probably work.
Thanks for your help!
04/03/2009 (12:05 pm)
Hi,I am pretty sure it is the locatlhost 127.0.0.1 issue as you mentioned as this did not happen with TGE when running dedicated and msster server on the same machine and I think I can probably comment out that code that ignores 127 and it will probably work.
Thanks for your help!
#5
04/04/2009 (3:12 pm)
Commenting out the network code for 127.0.0.1 does not help. I'll have a look at this later. It works running the dedicated server on another pc in my network so it is really not that much of an issue for me.
Torque Owner Mark Cohen
Default Studio Name
My master server is port forwarded TCP and UDP from 28002-28011 and 1031-1053
Another PC running a dedicated server is port forwarded TCP and UDP from 28000-28001. I probably don't need all those ports open unless every client who joins uses a port maybe? I do not know how that works yet. I am seeing some strange ports connect outside my range. I am also running DynDNS to sync my ip address to a domain name on the Windows 2003 server running the Master Server, a Vista PC is running the dedicated server. and I do not have my local ip address of the server in my host file. I think one of the issues is that the dedicated server should not be running on the same pc as the master server.
I was then able to log in from outside my firewall and see and join my game server.
This seems to work. If anyone can add more value to this please do.
Thanks.