summaryrefslogtreecommitdiff
path: root/dht/vnet/README.vnet.md
blob: 9bceb221df0f2319acded560b7ae3a92a0d3619e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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
  man 7 network_namespaces
  man 1 nsenter

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.