Building a resilient overlay network : Re6stnet
Internship at Nexedi KK
Ulysse Beaugnon
September 5, 2012

Contents
1 Introduction

2

2 The optimum
2.1 Optimal distance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Optimal resilience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2
3
3

3 A random network
3.1 Building a network without any global information . . . . . . . . . . . . . . . . . . . . . . . .
3.2 Our algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3 Advantages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3
3
4
4

4 Performances of the random network
4.1 Chances that the algorithm fails . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Average distance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3 Fault tolerance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4 Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5 Choosing the number of tunnels to establish . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6 Taking latency into account . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4
4
6
7
10
10
10

5 Optimizing the randomized network10
5.1 Evaluate the usefulness of tunnels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.2 Effects of the optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6 Reducing the need for a registry

14

7 Our implementation

14

8 Future improvements
14
8.1 Hierarchical routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
8.2 Security concerns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
9 Conclusion

16

1

1

Introduction

Nexedi provides services from servers hosted in unconventional places like private houses in addition to
traditional data-centers. They make extensive use of IPv6 (they need many IPs on a single machine forvirtualization) but the current IPv6 support is very bad. Many houses have no access to it and native IPv6
networks suffer from a lot of problems [10]. Using native IPv6 in houses is impossible for any professional
usage.
The common workaround is to create tunnels from each peer to a server with a good IPv6 connection.
This solution doesn’t scale well and is not resilient at all. It also requires to have multiple servers aroundthe world to reduce the latency overhead. The goal of my internship was to build a scalable, decentralized
and resilient peer-to-peer overlay network by creating tunnels between peers to answer those problems. I
have focused on establishing tunnels in a resilient, efficient and scalable way and not on routing.
Peer-to-peers overlay networks improve reliability of connections, even for IPv4 [16]. Since we control
routing tables, we recover faster from a link failure than BGP or other algorithms used by Internet providers.
This also improves latency : because of routing policies, the path chosen is not always the shortest and thetriangular inequality is not respected among peers. Using a detour route reduces latency [21].
I was working on this project with two colleagues : another intern (Guillaume Bury) and our supervisor(Julien Muchembled). I was in Tokyo while they were working from France. Since we had seven hours oftime difference, I used to work on my own all the day and explain to Julien what I had done and what I had
planned to do next before leaving the office.
I have mostly focused on finding an algorithm establishing the tunnels between peers while Guillaume has
focused on the implementation choices and choosing the external routing algorithm we use to route over our
network. Julien was only here to check what we had done, give us some advices and answer our questions.
We have both worked on the implementation of our algorithm.
I have started my internship by requesting a /48 IPv6 subnet to the RIPE to address our network. Then,
I have tried to find an algorithm to establish tunnels without considering latency. For this, I first tried tofind the best graphs possible in term of resilience and distance we could do. Then I looked at the existingalgorithms to build overlay networks, for example in distributed has tables before choosing a random graphapproach. To check the performances of our algorithm, I have used simulations as well as heuristics andmathematical bounds on the probability for the network to end-up disconnected.
Once we had a working random network, I have considered performances in term of latency and worked on
finding an algorithm to incrementally optimize our network by keeping only the best tunnels and replacing
the others. This was only based on simulation. At the end, I have been working on removing the need for acentral point in our overlay network.

2

The optimum

Since every peer can host a limited number of tunnels, we have only focused on k-regular undirected graphs.
We use an external routing algorithm to route over our network.

2

2.1

Optimal distance

To avoid catastrophic performances, we must be careful to the number of hops between nodes. The Moore
bound gives a limit on the number of nodes n for a k-regular graph of diameter D [7] :
n≤

D
X

ki

⇔

D ≥ Dm = dlogk (n (k − 1) + 1)e − 1

(2.1)

i=0

[17] also gives a lower bound on the average distance d for a k-regular graph with n nodes :d ≥ Dm −k Dm +1 − k · l − d + Dmn(k − 1)2

(2.2)

This bounds are not reachable for non-trivial cases [22] but De Bruĳn graphs can get close to them [13]
[15].

2.2

Optimal resilience

Since we rely on peers we don’t control, we have to assume they may fail or leave the network at any
moment [20]. An attacker might also try to kill selected peers to damage our network. Thus we have toconsider resilience to avoid loosing connectivity.
A way to measure resilience is to count the number of nodes or edges one must remove to disconnect two
nodes in the graph. Since each node has k neighbors, the optimum is to have k paths with no common nodes
except the first and the last one between each pair of peers. Modified De Bruĳn graphs can achieve thisconstraints without altering their almost optimal average distance and diameter [8][9].

3

A random network

3.1

Building a network without any global information

Having a complete view of the network on each peer is impossible for a scalable network. Peers might
often leave and enter it. Broadcasting information about their status each time would saturate the links.
Structured overlay network, used in distributed hash tables like Chord or Kademlia [12][18], are able tobuild a network with O(ln(n)) information on each node. But this still require some overhead and links are
established according to a fixed topology that doesn’t take into account the underlying network parameters.
This is OK when we don’t care about latency but in our case it might lead to bad topologies.
Since no pertinent information can be collected without too much overhead, we have used random graphs
to generate our network. The only information a peer needs is the external IP and port of a few randomly
chosen peers to be able to connect to them.
Random k-regular graphs have good distances and resilience proprieties. They are almost surely kconnected [5] and according to [4] their diameter is almost surely below :logk−1 (k · n) + logk−1 ((2 + ) log n) + 1(3.1)
They are almost optimal both in term of resilience and distance compared to the bound given in 2.1.

3

3.2

Our algorithm

Random k-regular graphs are difficult to generate. A lot of coordination between nodes are required tochoose the tunnels to establish. Instead of that, we generate a graph where the arity of a node is ≥ k andclose to 2 · k with high probability.
Each peer rely on a local list of possible nodes to connect to (the local DB) to establish a tunnel to k
randomly chosen peers. Since each peer creates k tunnels, a node has in average 2 · k tunnels. The arity is
distributed according to the following formula :a 
n−a−1


k
n−1
k
(3.2)
1−
P (arity = a + k) =
n−1
n−1
a
With k = 10 and n = 1000, 99.9% of the nodes have an arity between 12 and 32. Thus, we can reasonably
hope that our random network will have properties close to random regular graphs.
If a tunnel is detected to be down, it is immediately replaced by a new randomly chosen one. Since apeer only cares about the tunnels it has established, no cooperation is needed among nodes. To include newpeers into the network, each peer replace a randomly chosen tunnel among the ones it has established everyt seconds.
To avoid that two nodes both establish a tunnel to the other, a node reminds peers connected to it. If
two nodes both establish a tunnel to the other at the same time, they compare their SSL certificate serial
number to chose which tunnel to keep.
Each peer regularly sends the necessary information to connect to it (external IP, port, . . . ) to a server: the registry. The registry reminds all the peers that have contacted him recently (so dead peers won’t
stay in its database). When a peer needs to refresh its local DB, it asks the registry for a list of peers. The
registry is also used to generate the SSL certificates necessary to enter the network and attribute static IPs
to peers.

3.3

Advantages

The only information stored on each peer is a partial list of other peers of constant size and no information
has to be exchanged between peers. They only need to contact the registry a few times a day. Thus, theoverhead generated by the maintenance of the network is very small and the network is scalable.
Except for the registry, the network is decentralized. The registry can fail for a short time since every
peer has a local DB and can survive alone as long as it is not empty. If the registry is not reachable from apeer (for example if it is censored in a particular country), the local DB can be initially filled by hand andthen the registry reached through the overlay network. This makes our network resilient.

4

Performances of the random network

4.1

Chances that the algorithm fails

In our algorithm, there is no guarantee that the network is connected. Two nodes can be disconnectedeven if no other node or tunnel has failed. An upper bound P̂d can be given on the probability Pd of such acatastrophic failure :Pd ≤ P̂d =n−2k+1X 
m=2k+1

 n−m−1n−m m−1m
n−1
k
 k
n−1 n
m−1
k
4

(4.1)

Figure 1: Chances that the algorithm fails

As shown on figure 1, this probability is very low and catastrophic failures should not be a problem.
Proof of (4.1). :Let G(V, E) be a labeled graph generated by our algorithm. Let n = |V |, v ∈ V and A the maximal
connected component of v. If X, Y ∈ V , X ⊥ Y means there is no edge between X and Y .
Pd= P (G is not connected)(4.2)= P (A ( V )X=
P (B is a maximum connected componnent)

(4.3)
(4.4)

B(V
v∈B

≤

X

P B ⊥ V\B



(4.5)

B(V
v∈B

≤

n−1
X

X

P B ⊥ V\B



(4.6)

m=1 |B|=mv∈B

Let B ( V such that B⊥V\B and m = |B|. Since each vertice of B generates k edge and that there ism·(m−1)
possible edge in B :
2

⇔

m·k

≤

m

≤

5

m · (m − 1)
2
2·k+1

(4.7)
(4.8)

(4.8) also stand for m = V\B , thus :2 · k + 1 ≤ m ≤ n − (2 · k + 1)

(4.9)

Then :≤

Pd

n−2·k+1
X

X

P B ⊥ V\B



(4.10)

m=2·k+1 |B|=mv∈B

Let B ⊂ V such that v ∈ B, and |B| = m. In our algorithm, when 2 nodes
both establish a tunnel tothe other, one of the tunnels is replaced. This can only decrease P B ⊥ V\B since the replaced tunnel was
useless. As we only want an upper bound, we can do as if tow nodes could make tunnels to each other whencalculating P B ⊥ V\B .

When we generate the graph, each node has n−1
possibilities to create its tunnels. Thus, the number ofknpossible E is n−1.
Ifwe
impose
that
B
⊥
V
,
then
each node of B has m−1
possibilities and each node\Bkkn−m m−1mn−m−1
of V\B andpossibilities. Thus the number of possible E when B ⊥ V\B is n−m−1
.
k
k
k
Then:
P B ⊥ V\B

≤number of possible E were B ⊥ V\B
number of possible E
n−m−1 n−m m−1 m
k

≤

n−1 n
k

k

(4.11)(4.12)This and (4.10) give us :Pd≤n−2·k+1X

n−m−1 n−m m−1 m
k
 k
n−1 n
k

(4.13)

 n−m−1n−m m−1m
n−1
k
 k
n−1 n
m−1
k

(4.14)

X

m=2·k+1 |B|=mv∈B≤n−2·k+1
X 
m=2·k+1





≤ P̂d

4.2

(4.15)

Average distance

We give an heuristic on the number ud of node at a distance d of a given node :u0 = 1
u1 = 2k


d
P

ui

1−
· (2k − 1)ud∀d ≥ 1
 ud+1 =n(4.16)

i=0This allows us to give an heuristic on the average distance D̄. If d ∈ N∗ such that ud−1 ≤ n < ud , then :
D̄ ≈

d−1
X

i · ui + d · (n −

i=0

d−1
X
i=0

6

·ui )

(4.17)

Figure 2: Average distance (simulation and heuristic)
As shown on figure 2, the heuristic follows the simulation, especially when k is high. The distance is also
close to the optimum given in (2.2) for a constant number of tunnels of 2 · k.
Origin of (4.16). :Let v be a node of our network. We note Vd the nodes at distance d of v and ud = |Q|. Each node havingon average 2k tunnels (establish by itself and other nodes), we assume in the heuristic that each node has
exactly 2k tunnels. Thus :
u0 = 1(4.18)
u1 = 2k
ud+1 ≈ the number of tunnels from Qd which doesn’t link toS

Qi . For d ≥ 1, each node of Vd has onei≤dtunnel linking it to Vd−1 . This leaves 2k − 1 potential tunnels toconnect toQd+1 . A new tunnel has a
d
d
P
S
P
ui
ui
Qi . Then approximatively 1 −· (2k − 1) tunnels from Qd
probabilityn of connecting to
n
i=0

i=0

i≤d

link to Qd+1 . This gives us :ud+1 =

1−

d
X
ui
i=0

n

!
· (2k − 1)ud

(4.19)

Which is exactly (4.16).

4.3

Fault tolerance

There is a bound P̂u on the probability that two node can’t reach each other after q nodes randomly
chosen have failed.
7

Pu ≤ P̂u =

n−q−1
X 
m=1

n−2−q
m−1

 n−m−1n−m−q m+q−1mkk

n−1 n−qk(4.20)

Figure 3: bound (4.20) for n = 1000

We also made a simulation where we built a random graph following our algorithm and then removed a
portion of the peers. As shown on figure 4, results from the simulation are much better than the bound(4.20) when a big portion of the network is dead.
Proof of (4.20). :Let G(V, E) a graph generated by our algorithm, v0 , v1 ∈ V , Q ( V\{v0 , v1 } and q = |Q|. We want theprobability Pu that v1 is unreachable from v0 when all the nodes of Q are dead. As for (4.12), we supposethat the graph was generated without replacing tunnels when 2 nodes both connect to the other.

8Figure 4: Simulation of a simultaneous failure on several nodes for n = 1000Pu

= P (The maximal connected component of v0 doesn’t contain v1 )X=
P (A is a maximal connected component)(4.21)(4.22)

A(V\{v1 }
v0 ∈A

≤

X

P A ⊥ V\A∪Q



(4.23)

A(V\{v1 }
v0 ∈A

≤

n−q−1
X

X

P A ⊥ V\A∪Q



(4.24)

m=1 A(V\{v1 }
|A|=m
v0 ∈A

≤

n−q−1
X

X

m=1 A(V\{v1 }
|A|=m
v0 ∈A

number of possible E where A ⊥ V\A∪Q
number of possible E(4.25)

n
As for (4.12), the number of possible E is n−1. When A ⊥ V\A∪Q , a node in Q can connect to anykother node, a node in A can connect to any other node in A ∪ Q and a node in V\A∪Q can connect to anym n−1q n−m−1n−m−qother node in V\A . This makes m+q−1
possibilities for E. Then :
k
k
k
9

Pu

≤

n−q−1
X

X

m=1 A(V\{v1 }
|A|=m
v0 ∈A

≤

n−q−1
X 
m=1

≤

4.4

m+q−1 m n−m−1 n−m−qkk
n−1 n−q
k



n−2−q
m−1



(4.26)

 m+q−1m n−m−1n−m−qkk
n−1 n−qkP̂u(4.27)(4.28)

Availability

Ensuring that the network stays connected is essential but even if it does, the routing algorithm will needa little time to detect a failure and establish a new route. This result in a small unavailability for routes.
unavailability =average distance · recover timemean time between failure of a node

(4.29)

With the routing algorithm the recover time is typically 1 minute and for Nexedi’s servers, the mean time
between failure is 3.6 days. According to figure 4.16, with k = 10, this gives us an unavailability of 5.0 · 10−4
for 103 nodes and of 9.4 · 10−4 for 106 nodes.

4.5

Choosing the number of tunnels to establish

In our network, each node establish 10 tunnels (k = 10). This allows us to have a reasonable distance andresilience while the overhead due to hosting tunnels remains small. As shown on figure 5, the improvement
in distance is much smaller after k = 10.
To avoid having too many tunnels on the same node, we have also set a maximal arity of 3 · k. If a nodetries to connect to a node which is already full, then the connection will be refused and the node will try toconnect to someone else. This shouldn’t change a lot of thing since it only affects a small number of peers(0.3% of nodes with 1000 nodes). In our simulations no effect was visible.

4.6

Taking latency into account

The measure of distance in hop gives a good idea of how things are but some tunnels might have amuch bigger latency than others. Computing the shortest path using latency is necessary to achieve good
performances. For example, in simulations on our dataset, when routing in number of hop, the averagelatency was 220 ms while it was 90 ms when taking it into account.
To make simulations with latency, we have used a dataset [1] giving RTTs between 2500 nodes. The
average latency when using only direct connection was 75.8 ms and 16.1 ms with a full overlay mesh network
making the use of detour routes possible.

5

Optimizing the randomized network

5.1

Evaluate the usefulness of tunnels

Even if our network has good performances, it can still be improved since some tunnels are almost uselessand could be replaced by more useful ones. For example, if a node has a really bad connection no traffic will
10

Figure 5: Average distancetransit through it and it is useless for other to connect to it. Tunnels established by the node itself should
be sufficient to ensure its good connectivity.
As explained in 3.1, it is difficult to choose the best tunnel to create without a lot of informations on
the network. But once the tunnel is establish, it is possible to make local measures on it to estimate its
usefulness. Instead of randomly choosing a tunnel to replace every t minutes, we choose the less useful one.
After many iterations, only the most useful will remain : we incrementally optimize our network.
The most obvious way to measure a tunnel usefulness is to look at the amount of traffic going through it.
This can be done very easily using the kernel stats. Favor such tunnel will favor the most used routes andtends to make faster connections between nodes that needs to speak a lot to each other. This can seam tobe a good idea but it also raise some problems. Firstly, if a group of nodes talk a lot together and never tothe other nodes, they will end disconnected up from the rest. Secondly, it brings some instabilities in the
network since the most used routes are not always the same.
An other way is to try to keep tunnels with a good latency. Favor those tunnels will avoid the bad ones
but a node will tends to stay connected only to close peers and a group of well connected together machines
will eventually end up disconnected from the rest.
A last way to evaluate the usefulness of a tunnel is to count the number of peers reached through it. This
information is retrieved from the routing table. This is the measure we have used to choose which tunnel
we should replace at every iteration of the algorithm.

11

5.2

Effects of the optimization

Replacing tunnels with the less peers reached tends to sort peers in tow equally-sized categories : nodes
with an almost maximal arity and nodes with an almost minimal arity (figure 6).

Figure 6: Evolution of the arity distribution

Nodes with an almost maximal arity are the more central nodes in the overlay network. They allow peers
connected to them reach a lot of other peers so others stay connected to them. On the other side, less central
nodes have an almost minimal arity : others have dropped tunnels they had established to them. Since ahigh arity increase the centrality, central nodes tends to become even more central. This is why the tow
categories of peers are so well separated.
Peers with a low average latency to others on the underlying network have a higher chance of becoming
central as this can be seen on figure 7. More reliable peers are also advantaged since they have a longer lifeand so, a bigger chance of becoming central. This can be observed on figure 8 where we have given to eachpeer a probability p of leaving and instantaneously re-enter the network between tow iterations as if the node
had been shutdown or disconnected from the Internet for a short time. Thus our algorithm automaticallychoose the most well-connected and reliable peers to make them a little more important and reduce latency.
The average latency between nodes is greatly improved by this incremental optimization. As shown on
figure 9, the average latency fall from ≈ 90 ms to ≈ 20 ms. This is much better than the average latency
through direct connections (≈ 75 ms) and close to the full mesh network (≈ 16 ms).
Many iteration have to be made before the average latency is almost optimal. Since each iteration generates
some traffic to update routes, we can’t increase their frequency too much. This is OK when the network
is stable since it will ultimately reach almost optimal performances, but when peers often leave and enter,
performances are decreased : the almost optimal topology has no time to be established. For example, if
1
at each iteration, the averageeach peer leave and instantaneously re-enter the network with a probability 100
latency was 50 ms in our simulation. This is still better than direct connections but not as good that whatis achievable with a stable network.
Since each node still have at least 10 tunnels and that not only one or tow but half of the peers are more
important, we still have a mesh network and we keep a reasonable resilience (figure 10).
12Figure 7: Distribution of the arity depending on the
average latency of the direct connections to the othernodes

Figure 9: Evolution of the average latency

Figure 8: Arity depending on reliability

Figure 10: Simulation of a simultaneous failure of several nodes

13Replacing only tunnels with the less peer reached also reduce the traffic generated by the routing algorithm
since less routes are changed. In our dataset (with 2500 nodes), the average number of peers reached by thetunnels replaced was 1.85 while the average is 75 for a tunnel.

6

Reducing the need for a registry

Our algorithm use the registry as a central point to exchange informations. If it is down for a long time,peers cannot discover each others anymore. Its neighbor might also have to forward a lot of traffic if the
network grows too big. Thus, the registry should only be used when a peer knows no other peers (for example
when it first enter the network) so there is no central point of failure and the network will scale better.
To allow others to connect to it, a peer randomly choose a few addresses belonging to the network in its
routing table and send them its external informations (external IP, port, . . . ) so the receivers can store themin their local DB. A new peers has to send its external information to a number of node equal to the size ofthe local DB so it has as many chances as other to be chosen for establishing a tunnel.
Even if nodes can fill their DB by themselves, the registry is still needed to ensure the network is connected
and when a peer knows no other peer. Twice a day a node contact the registry to give him its external
informations. If it can’t reach the registry through the overlay network, then it contact it by its public IP
to ask for new peers as if it was first entering the network. This way, if a set of nodes get disconnected, it
will be reconnected as soon as one of them tries to recontact the server.

7

Our implementation

Our implementation is based on a python script to contact the registry and manage tunnels. The script
launch an OpenVPN server and several OpenVPN client [2] to establish the tunnels. It also launch therouting daemon. The script is able to automatically ask for a port forward to a router using UPnP-IGD
protocol.
In order to communicate with the Internet through our network we have requested a /48 IPv6 subnet so
IPs given to nodes will be routable on the Internet and can be accessed through a gateway making the link
between the real IPv6 network and the overlay network.
Our implementation also detect when some other peers are available in the LAN to avoid establishingtunnels with them and instead use a direct connection.
All features have been tested using Marionnet which permit to build a virtual network between virtual
machines [14].
To route over our network we use the Babel routing protocol [6]. It was designed specifically for meshnetworks and can recover fast from a node failure. The latency measurement has not been implemented init yet but will soon be.

8

Future improvements

8.1

Hierarchical routing

There is currently no hierarchical routing in our network. Because of this, the routing table size and therouting information exchanged between each neighbors is in O(n). Implementing a hierarchical routing is

14

essential if we want our network to be scalable since it would reduce the size of the routing table and theinformation exchanged to O(ln(n)).
Usually, subnets are assigned statically and manually at the creation of a network. But here, when a node
ask to join, we have no information about it nor about the topology of the network so it is impossible tochoose in which subnet we should put it. And even if we manage to do so, the network might evolve in a very
different way. Moreover, since nodes from a single subnet must stay connected, having a static addressing
would add a constraint and reduce resilience. Thus a dynamic addressing able to follow the evolutions of
the network and to recover from a failure is mandatory.
Even if the addressing is dynamic, some services still need to have a static IP. To achieve this each peer
must run a NAT and have both a static and a dynamic IP. A packet is sent to an other machine using its
static IP. The NAT of the emitter changes the static IP of the destination to its dynamic IPs and the NATof the receiver change it back to the static IP. This way, the overlay network only sees dynamic IPs andmachines only see static IPs. The index necessary to store the indirection between static and dynamic IPs
can be stored in a DHT with a cache on each peer. When a node changes its IP, it can keep both the oldand the new one until the information has propagated.
Multiple algorithms and their implementations exist to automatically build a hierarchical mesh network[19], but some work might be needed to adapt them to our network since most of them have been developed
for specific environments like ad hoc wireless networks.
Every subnet will contain ≈ 100 machines (or smaller subnet). Inside a subnet the routing will be optimaland outside a subnet, a packet will be routed on the shortest path to enter to its subnet (and not on the
shortest path to its destination). Since the routing will not be optimal, latency will be affected if the numberof machine in a subnet is big enough, the effect should be small.
The parts of our algorithm relying on the routing table (described in 5.1 and 6) will have to be adapted towork with a hierarchical routing. If for each subnet in its routing table, a peer knows the number of peers it
contains, then it can count the number of peers accessed through each tunnel. It can also send a message toan uniformly chosen peer : it choose a subnet (or peer) S in its routing table with a probability proportional
to the number of peers inside S. If S is a machine, it only need to sends the packet to it. If S is a subnet, it
anycast the packet to this subnet. When the packet is received by a node of S it is forwarded to a randomly
chosen machine inside S using the same technique recursively.
The number of nodes in a subnet can be transmitted at the same time than routes. A node starts byadvertising its own subnet saying there is one node in it. Then, whenever a node receive a route to a subnet,
it knows the number of nodes inside it. When a node aggregate some routes, it just has to sum up thenumber of nodes in the routes aggregated.

8.2

Security concerns

We currently control who is connecting to our network using OpenSSL certificates for OpenVPN. But if
an evil peer manage to get a certificate, it may damage the network. Some security issues have to be solved
to answer this problem.
The first thing necessary is the possibility to revoke some certificates. This could be achieved by storing
the revoked certificates in a server contacted once a day by peers to update their list of revoked certificates.
An algorithm to detect peers behaving badly (for example a node refusing to forward traffic) would also benecessary.

15

We also need to ensure that external node cannot send false information about entry-points inside the
network using a peer with a badly configured firewall or that a single node cannot advertise many false
entry-point. This can be done by signing every message sent for entry-point advertising. This way, we cancheck that the message was sent by someone with a certificate granted by the registry and that it only
advertise one entry-point.
The last problem is that a node can send false routing information. This problem is not limited to our
network and the Internet face the same problem [11].

9Conclusion

We have presented a way to build a dynamic peer-to-peer unstructured overlay network. Our algorithm isinspired from the good properties of random regular graphs. It can be used to provide a more reliable andfaster connection since it can use detour routes. Our algorithm was validated using heuristics, bounds andsimulations.
We then present a way to optimize the random network to get lower latency while keeping an acceptable
resilience. With this optimization, on our dataset, we could achieve a better latency than direct connections
thanks to detour routes.
Once hierarchical routing will be implemented, our network should scale well since their is no structure or
global information to maintain except the routing table and a list of peers on each node. Unlike some otheroverlay network like RON [3] trying to improve resilience and latency, the number of neighbor is bounded.
Our algorithm will be used by Nexedi to provide a fast and reliable IPv6 to its servers.

16

References[1] The meridian dataset. http://www.cs.cornell.edu/People/egs/meridian/data.php.
[2] Openvpn website. http://openvpn.net/.
[3] David G. Andersen. Resilient overlay networks. Massachusetts Institute of Thechnology, 2001.
[4] W. Fernandez de la Vega B. Bollobas. The diameter of random regular graphs. Combinatorica, 1981.
[5] Bela Bollobas. Random graphs. Cambridge University Press, 2001.
[6] J. Chroboczek. The babel routing protocol. RFC 6126, 2011.
[7] F. R. K. Chung. Diameters of communication networks. Mathematics of Information Processing, 1984.
[8] V. Rai S. Ganesh D. Loguinov, A. Kumar. Graph-theoric analysis of structured peer-to-peer systems :Routing distance and fault resilience. Texas A & M Technical Report, 2003.
[9] H.Q. Ngo G.W. Peck D.Z. Du, D.F. Hsu. On connectivity of consecutive-d digraphs. Discrete Mathematics, 2002.
[10] Steinar H. Gunderson. Global ipv6 statistics. RIPE 57, 2008.
[11] Xinyang Zhang Hitesh Ballani, Paul Francis. A study of prefix hĳacking and interception in the internet.
ACM SIGCOMM Computer Communication Review, 2007.
[12] David Karger M. Frans Kaashoek Hari Balakrishnan Ion Stoica, Robert Morris. Chord : a scalable
peer-to-peer lookup service for internet applications. SIGCOMM, 2001.
[13] J. Trdlicka I. Vrto J. Rolim, P. Tvrdik. Bisecting de bruĳn and kautz graphs. Discrete Applied Math,1998.
[14] Luca Saiu Jean-Vincent Loddo. Marionnet, a virtual network laboratory. FOSDEM, 2010.
[15] R. Raghavendra K.N. Sivarajan. Fault-tolerant networks based on the bruĳn graph. IEEE Trans. on
Computers, 1991.
[16] Spring N. Lumezanu C., Levin D. Peerwise discovery and negotiation of faster paths. HotNets, 2007.
[17] Masaki Itoh Makoto Imase. Design to minimize diameter on building-block network. Transactions on
Computers, 1981.
[18] David Mazieres Petar Maymounkov. Kademlia : a peer-to-peer information system based on the xor
metric.
[19] Andrea Lo Pumo. Scalable mesh network and the address space balancing problem. University ofCambridge, 2010.
[20] S.D. Gribble S. Saroiu, P.K. Gummadi. A measurement study of peer-to-peer file sharing systems. Proc.
Multimedia Computing Networking, 2002.
[21] Hoffman E Snell J Anderson T Savage S, Collins A. The end-to-end effects of internet path selection.
SIGCOMM, 1999.
[22] S. Toueg W.G. Bridges. On the impossibility of directed moore graphs. Journal of Combinatorial
Theory, 1980.

17