[OT] Handling multiple UDP clients through NAT

Steve smorrey at gmail.com
Tue Feb 6 12:42:20 MST 2007

Hello again everyone,
While designing my new MUD server I ran into a design problem that I'm
hoping someone here has had experience with.

Specifically, I currently keep track of clients in a hashmap, with the
hash being comprised of their IP address and port.

This works very well until multiple clients who are NAT'd try to connect.

Now my initial response to this was to have each client bind a
listener to a random port, then send a discovery request to the server
that contains the port that they bound their listener to.

That kind of works, except that some NAT Gateways and routers
(specifically my own ActionTec Gateway POS from Qwest), block
unsolicited incoming UDP packets on all ports regardless of if the
same IP address is responding, as was used in the initial request, if
the response packet is coming in on a port different than the one the
original discovery packet was sent from.

Ideally I'ld like to implement a solution that doesn't require the end
user to reconfigure their gateway,router or firewall, ala a port
forwarding solution.

I've looked at protocols like STUN, but there is so much overhead in
the final binary, that I'ld really rather not try and implement all of

Has anyone run up against trying to handle multiple UDP clients
through a NAT?  And if so, what solutions did you come up with?

Thanks in advance!


More information about the PLUG mailing list