Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to test my software runs across the internet, i.e. two machines can talk to each other via host addresses and name resolution with routers and port-forwarding in between. What's the best way to do this? I can use any OS and set up on VMs.

Machine A | Router | Modem/Internet/WAN? | DNS Server | Modem/Internet/WAN? | Router | Machine B

Basically I need to simulate a machine having an internal IP address hidden to the other machine and the machine only accessible via another IP address (the router) with port forwarding.

share|improve this question
up vote 6 down vote accepted

You can use WANem, a linux distro especially made to emulate internet.

share|improve this answer

I've also managed to do this using two installations of VirtualBox, here's my notes:

  • Have two machines, each will simulate a LAN
  • Your router and physical LAN (192.168.1.x network) will simulate the WAN
  • Setup VirtualBox on each machine, run guest on each
  • Configure NAT on both Guests to not use default but specific LAN addressing:
    • VBoxManage modifyvm "MachineA" --natnet1 "172.23.24/24*
      • This makes the NAT Guest network 172.23.24.x
      • Internal IP of host is
      • Guest is
      • External IP (WAN IP) is 192.168.1.x
  • Configure NAT to alias as proxy, so WAN IP is passed through
    • VBoxManage modifyvm "MachineA" --nataliasmode1 proxyonly
  • Set up hostnames on the router that map to the WAN address of each virtual box host, use these names as the connect addresses

*Quote from the User Manual:

9.10 Fine-tuning the VirtualBox NAT engine 9.10.1 Configuring the address of a NAT network interface In NAT mode, the guest network interface is assigned to the IPv4 range 10.0.x.0/24 by default where x corresponds to the instance of the NAT interface +2. So x is 2 when there is only one 145 9 Advanced topics NAT instance active. In that case the guest is assigned to the address, the gateway is set to and the name server can be found at If, for any reason, the NAT network needs to be changed, this can be achieved with the following command: VBoxManage modifyvm "VM name" --natnet1 "192.168/16" This command would reserve the network addresses from to for the first NAT network instance of “VM name”. The guest IP would be assigned to and the default gateway could be found at

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.