diff options
author | Joe Crayne <joe@jerkface.net> | 2019-12-26 22:18:41 -0500 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2020-01-01 23:28:00 -0500 |
commit | 9f33d972b60959d69318e5f243ffae4252d6d3f5 (patch) | |
tree | 6e02c4257763b983a9a72bb297e28635f84ea3d8 | |
parent | d187c97aa8fd1c5385a99a8b061793d7a000fadb (diff) |
Notes on virtual network testing environment.
-rw-r--r-- | dht/vnet/README.vnet.md | 73 |
1 files changed, 73 insertions, 0 deletions
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 @@ | |||
1 | What We Have | ||
2 | ============ | ||
3 | |||
4 | ./build.sh | ||
5 | ---------- | ||
6 | |||
7 | First, as root, run the ./build.sh script. This will use the _tuntap_ subcommand | ||
8 | of _ip_ in order to create a variety of virtual interfaces. It then will assign to | ||
9 | each of these a unique address of the form: | ||
10 | |||
11 | inum.vnum.99.99 | ||
12 | |||
13 | where _inum_ is between 80 and 95 and _vnum_ is either 88 or, if your wlan0 | ||
14 | interface is on an IPv4 lan, the very last component of your wlan0 IP address. | ||
15 | For example, if wlan0 has address 192.168.5.33, then _vnum_ will be 33. This | ||
16 | allows multiple test environments to coexist on a lan and, provided routing | ||
17 | tables allow it, be routable from each other. | ||
18 | |||
19 | Note that the ip addresses of the testing environment are chosen from the pool | ||
20 | that RFCs assign to actual global internet addresses rather from one of the | ||
21 | reserved local lan domains. This is because the software algorithms may want | ||
22 | to recognize lan domains and treat them specially, so we want to simulate the | ||
23 | appearance of actual internet peers. | ||
24 | |||
25 | |||
26 | ./run.sh | ||
27 | -------- | ||
28 | |||
29 | Next, make a symlink (named "dhtd") in the _vnet_ folder to the dhtd binary. | ||
30 | And run the ./run.sh script. You do not need root. This will create a | ||
31 | detached _screen_ session where each window is running a different instance of | ||
32 | the dhtd daemon with a different working directory. Each instance will bind to | ||
33 | a different inum.vnum.99.99 ip address created by the ./build.sh script. | ||
34 | |||
35 | ./everywhere.sh | ||
36 | --------------- | ||
37 | |||
38 | To run the same command in every one of the running test instances, you may use | ||
39 | the ./everywhere.sh script. It's command line arguments are expected to be a | ||
40 | shell command that will be run repeatedly from within the working directory of | ||
41 | each of the running dhtd daemons. Since this is a shell command and not a dht | ||
42 | command, you may need to specify the path to the dht client binary as the first | ||
43 | argument. | ||
44 | |||
45 | ./clean.sh | ||
46 | ---------- | ||
47 | |||
48 | After issuing "stop" to all the dhtd instances, you may want to clean up and | ||
49 | remove all the working directories and network interfaces. To accomplish this, | ||
50 | as root, run the ./clean.sh script. | ||
51 | |||
52 | Note: You probably do not want to run build.sh and clean.sh repeatedly if you | ||
53 | are testing changes to the dhtd program as you can simply, without root, use | ||
54 | ./run.sh to re-launch a modified version of the daemon. | ||
55 | |||
56 | |||
57 | What We Want | ||
58 | ============ | ||
59 | |||
60 | We want to test TCP-only connectivity. This means some combination of iptables | ||
61 | and possibly the cgroups commands to create more controlled virtual network | ||
62 | environments. The following man pages are relevant: | ||
63 | |||
64 | man 4 veth | ||
65 | man 2 clone | ||
66 | man 8 iptables | ||
67 | man 7 cgroups | ||
68 | |||
69 | We need to bootstrap an instance of dhtd off of our test network and also an | ||
70 | instance of uTox (or some other toxcore-based client) and get them to build a | ||
71 | TCP-mediated link. This would, of course, disabling UDP in one or both of the | ||
72 | clients either by a hardcoded temporary source code patch or through iptables | ||
73 | rules. | ||