From 9f33d972b60959d69318e5f243ffae4252d6d3f5 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Thu, 26 Dec 2019 22:18:41 -0500 Subject: Notes on virtual network testing environment. --- dht/vnet/README.vnet.md | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 dht/vnet/README.vnet.md diff --git a/dht/vnet/README.vnet.md b/dht/vnet/README.vnet.md new file mode 100644 index 00000000..caa84057 --- /dev/null +++ b/dht/vnet/README.vnet.md @@ -0,0 +1,73 @@ +What We Have +============ + +./build.sh +---------- + +First, as root, run the ./build.sh script. This will use the _tuntap_ subcommand +of _ip_ in order to create a variety of virtual interfaces. It then will assign to +each of these a unique address of the form: + + inum.vnum.99.99 + +where _inum_ is between 80 and 95 and _vnum_ is either 88 or, if your wlan0 +interface is on an IPv4 lan, the very last component of your wlan0 IP address. +For example, if wlan0 has address 192.168.5.33, then _vnum_ will be 33. This +allows multiple test environments to coexist on a lan and, provided routing +tables allow it, be routable from each other. + +Note that the ip addresses of the testing environment are chosen from the pool +that RFCs assign to actual global internet addresses rather from one of the +reserved local lan domains. This is because the software algorithms may want +to recognize lan domains and treat them specially, so we want to simulate the +appearance of actual internet peers. + + +./run.sh +-------- + +Next, make a symlink (named "dhtd") in the _vnet_ folder to the dhtd binary. +And run the ./run.sh script. You do not need root. This will create a +detached _screen_ session where each window is running a different instance of +the dhtd daemon with a different working directory. Each instance will bind to +a different inum.vnum.99.99 ip address created by the ./build.sh script. + +./everywhere.sh +--------------- + +To run the same command in every one of the running test instances, you may use +the ./everywhere.sh script. It's command line arguments are expected to be a +shell command that will be run repeatedly from within the working directory of +each of the running dhtd daemons. Since this is a shell command and not a dht +command, you may need to specify the path to the dht client binary as the first +argument. + +./clean.sh +---------- + +After issuing "stop" to all the dhtd instances, you may want to clean up and +remove all the working directories and network interfaces. To accomplish this, +as root, run the ./clean.sh script. + +Note: You probably do not want to run build.sh and clean.sh repeatedly if you +are testing changes to the dhtd program as you can simply, without root, use +./run.sh to re-launch a modified version of the daemon. + + +What We Want +============ + +We want to test TCP-only connectivity. This means some combination of iptables +and possibly the cgroups commands to create more controlled virtual network +environments. The following man pages are relevant: + + man 4 veth + man 2 clone + man 8 iptables + man 7 cgroups + +We need to bootstrap an instance of dhtd off of our test network and also an +instance of uTox (or some other toxcore-based client) and get them to build a +TCP-mediated link. This would, of course, disabling UDP in one or both of the +clients either by a hardcoded temporary source code patch or through iptables +rules. -- cgit v1.2.3