Sign in to follow this  
GuyWithBeard

Simulating several NAT devices with internal networks + introducer server

Recommended Posts

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!

Share this post


Link to post
Share on other sites
[quote name='GuyWithBeard' timestamp='1318337247' post='4871428']Virtual NAT devices as well?[/quote]
Yes. You can configure virtual Linux servers as a routers with IP masquerading to be your test NAT devices. [url='https://www.virtualbox.org/']Virtualbox[/url] will handle this easily.

Share this post


Link to post
Share on other sites
[quote name='GuyWithBeard' timestamp='1318337247' post='4871428']
Virtual NAT devices as well?
[/quote]

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.

Share this post


Link to post
Share on other sites
[quote name='GuyWithBeard' timestamp='1318361129' post='4871559']
VirtualBox seems very cool, thanks for the tip! I have to look at VMWare too, though I thought it is very expensive...
[/quote]

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[quote name='GuyWithBeard' timestamp='1318399263' post='4871742']
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.
[/quote]

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!)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this