开发者

Network Address Translator's Simulator to Test P2P Software

开发者 https://www.devze.com 2023-02-15 11:36 出处:网络
Is there any Network Address Translator Simulator exist to test P2P softwares ? Currently I am working on a P2P softwares for Devices, and facing the issues to to test my software in different-2 type

Is there any Network Address Translator Simulator exist to test P2P softwares ?

Currently I am working on a P2P softwares for Devices, and facing the issues to to test my software in different-2 type of NATs e.g; - Clients behind same NAT (same Private Network), Different NAT (Different Private Networks) , on Different Global Network , Di开发者_如何学Gofferent Nat Levels

-- Do I need to physically set-up the test environment e.g; Nodes behind NAT

OR

-- Is there any Network Address Translator Simulator exist to test P2P softwares ?


Virtualization software such as VirtualBox will allow you to connect multiple guest VMs (Virtual Machines) together via NAT rather than use direct connections.

The built in NAT provided by Virtualbox is unrealistically 'peer-to-peer friendly' though when compared to common home and ISP level NATing routers. Virtualbox's NAT seems to be 'full cone NAT' which makes NAT traversal techniques (UDP/TCP hole punching) unrealistically easy (see this Wikipedia article for explanation) whereas a lot of router NAT is either 'symmetric NAT' or some form of 'restricted cone NAT' based on source port and/or address restrictions.

So one way to simulate multiple hosts communicating over realistic NAT would be to use virtualization tools such as Virtualbox and connect them together via Linux based 'router' VMs that perform the routing and NAT using the built in netfilter functions in the Linux kernel. The iptables command would allow you to set up netfilter rules to achieve the various NAT behaviours (as detailed in the above Wikipedia article), e.g. full cone NAT using iptables..

See this how-to for general information on setting up netfilter/IP-masquerading (required for NAT): http://www.ibiblio.org/pub/linux/docs/howto/other-formats/html_single/IP-Masquerade-HOWTO.html

You could of course bind your P2P software to various local interfaces (within 127.0.0.0/24 range or use an IPv6 subnet) and configure the routing tables and netfilter rules on a single machine to do this without virtualisation. I'm not sure which approach would be easier for you though, if you have the machine resources the virtualisation approach may turn out to be easier to keep track of.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号