Simulating several NAT devices with internal networks + introducer server

Started by
7 comments, last by hplus0603 12 years, 6 months ago
Hey,

I recently took the time to read up on NAT punch-through and I want to implement this into my game/engine. The final product will (most likely) be a p2p game using UDP (well, enet really, which is based on UDP) where people host games on their home computers. These hosts are reported to an authentication server, which also acts as the NAT intruducer (a small server running Linux or something similar). I would need some way to test a setup like this while I am developing it. How would you do this/how have you done it?

I guess I need:
-Two (or more) NAT devices with a public IP and a gateway IP
-Two (or more) computers, each behind a NAT device, with a private IP
-One linux server with a public IP

I have:
-One NAT device (linksys WLAN router)
-Two windows machines and enough parts to build a test ubuntu introducer server

Can I somehow simulate the missing parts or do I have to have two physical networks each with it's own NAT device + a server with a public IP?

Also, am I missing something really crucial? Last week I did not understand NAT at all, and last year I sucked at network programming altogether.

Thanks!
Advertisement
Virtual Machines are your friends.
Virtual NAT devices as well?
Virtual NAT devices as well?

Yes. You can configure virtual Linux servers as a routers with IP masquerading to be your test NAT devices. Virtualbox will handle this easily.

Virtual NAT devices as well?


Yes! VMWare comes with a Virtual Network Editor. VirtualBox has network options. KVM/QEmu lets you use the Linux kernel networking, set up bridging/translation using iptables, ifconfig and route, which is very flexible. Either of these should let you test the system if you work at it. The configuration will likely be annoyingly fiddly, though.
enum Bool { True, False, FileNotFound };
VirtualBox seems very cool, thanks for the tip! I have to look at VMWare too, though I thought it is very expensive...

VirtualBox seems very cool, thanks for the tip! I have to look at VMWare too, though I thought it is very expensive...


VMWare Workstation is a few hundred dollars. Whether that counts as "very expensive" compared to the cost of a computer or the cost of a MSDN subscription or other tools you may want to use is really dependent on you.
enum Bool { True, False, FileNotFound };
I don't count that as expensive :)

I have heard talk about thousands of euros, but I guess that's some of the enterprise products they offer. Anyway, thanks for your tips. I'll try out virtualbox to get more familiar with virtualization, and see if I should consider VMWare later.

I don't count that as expensive :)

I have heard talk about thousands of euros, but I guess that's some of the enterprise products they offer. Anyway, thanks for your tips. I'll try out virtualbox to get more familiar with virtualization, and see if I should consider VMWare later.


Thousands of euros -- that must be ESXi you're thinking of. We use that for virtualizing all our build/test machines (hundreds of VMs) across a dozen super-sized physical servers. When each server host is $12k, paying $5k to manage all of them centrally is worth it :-)
VMWare Workstation is much cheaper, but only runs on one box. It does, however, virtualize 3D (for Windows only), which is nice for games testing. There is also a free version called VMWare Player, so if you can find a created VM image that's already what you need, you may be able to just use that. (A blank image that you can install from scratch on may be sufficient!)
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement