Simulate internet routers, dns in a lab?

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.


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

  • Official site : http://wanem.sourceforge.net/
  • Article on PacketLife.net : http://packetlife.net/blog/2011/jan/12/emulating-wans-wanem/