Topic: NAT Punch Through with Ruby on Rails

I'm building a multiplayer game and I'm using Ruby on Rails to build my lobby server, which registers/unregisters active game servers (IP & Port). When someone loads my game, the game will query my Lobby Server for the list of active game servers they can join. The player can either join a game in the list or create a new game server and wait for people to join. Again, the only information I need to allow a player to join an existing game server is the IP and Port of the game server. This all works fine when running on the same LAN, but it breaks when the server is behind a NAT device because the IP and Port of the server isn't accessible by computers outside the NAT.

After doing research on this, I found this is a typical problem with internet multiplayer games and the solution is implementing a NAT Punch Through. As I understand it, all that is needed is an "introducer" server that can manage the information needed for a client to connect with the server that is behind the NAT. And as I understand that, that information would simply be the IP and Port of the NAT device. Then the players that wish to join the game server, that's behind the NAT, can simply use the IP and Port of the NAT device and the NAT device should automatically forward the packets to the game server. Is that (kinda) right?

If so, how can I get the IP and Port of the NAT device? If not, what information do I need to implement a NAT Punch Through solution using Ruby on Rails?

Thanks so much for your wisdom!

Last edited by beachrunnerjoe (2011-11-19 17:54:21)

Re: NAT Punch Through with Ruby on Rails

I guess you are talking about fire walls and port forwarding. This needs to be managed by the person managing the network concerned by punching a hole in their firewall on a particular port essentially it is opening up the ip address/port to the whole world so it is done with great care and usually very reluctantly.
The portforwarding website has a ton of information on this very subject. It's massive as it describes how to forward ports for just about every game worth playing on just about every router in existence so take care to look really hard for the info that might help you with this

http://portforward.com/help/portforwarding.htm

Essentially you would use the public ip address and the router via port forwarding will route the request to the specific computer that is behind the firewall.

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)