Virtualization software such as VirtualBox allows you to connect multiple guest virtual machines (virtual machines) through NAT, rather than using direct connections.
the built-in NAT provided by Virtualbox is unrealistically peer-to-friendly , although compared to conventional NAT routers and ISP routers. Virtualbox NAT is apparently a βfull cone NATβ that makes NAT traversal (UDP / TCP bumps) unrealistic easy (see this Wikipedia article for an explanation), while many NAT routers are either βsymmetricβ NAT ", or some form of" bounded NAT cone "based on port and / or address restrictions.
Thus, one way to simulate multiple hosts interacting with realistic NAT is to use virtualization tools such as Virtualbox and combine them together using Linux routing virtual machines that perform routing and NAT using the built-in netfilter functions in the Linux kernel. The iptables command allows you to set netfilter rules to achieve various NAT actions (as detailed in the above Wikipedia article), for example. full cone NAT using iptables . .
See this guide for general information on configuring netfilter / IP masking (required for NAT): http://www.ibiblio.org/pub/linux/docs/howto/other-formats/html_single/IP-Masquerade-HOWTO. html
Of course, you could associate your P2P software with various local interfaces (within the range 127.0.0.0/24 or use an IPv6 subnet) and configure routing tables and netfilter rules on the same machine to do this without virtualization. I'm not sure which approach will be easier for you, although if you have the machine resources, the virtualization approach may be easier to track.
source share