# Simulating several NAT devices with internal networks + introducer server

This topic is 2289 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
Virtual NAT devices as well?

##### 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 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 on other sites
VirtualBox seems very cool, thanks for the tip! I have to look at VMWare too, though I thought it is very expensive...

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