aboutsummaryrefslogtreecommitdiff
path: root/content/en/blog/news/20200216-ecmp.md
blob: 0a37552a7689a348b406b92eac88e40813e1182f (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
date: 2020-02-16
title: "Equal-Cost Multipath (ECMP) routing"
linkTitle: "Equal-Cost multipath (ECMP) example"
description: "A very quick example of ECMP"
author: Dimitri Staessens
---

As promised, I added equal cost multipath routing to the Ouroboros
unicast IPCP. I will add some more explanations later when it's fully
tested and merge into the master branch, but you can already try it.
You will need to pull the _be_ branch. You will also need to have
_fuse_ installed to monitor the flows from _/tmp/ouroboros/_. The
following script will bootstrap a 4-node unicast network on your
machine that routes using ECMP:

```bash
#!/bin/bash

# create a local IPCP. This emulates the "Internet"
irm i b t local n local l local

#create the first unicast IPCP with ecmp
irm i b t unicast n uni.a l net routing ecmp

#bind the unicast IPCP to the names net and uni.a
irm b i uni.a n net
irm b i uni.a n uni.a

#register these 2 names in the local IPCP
irm r n net l local
irm r n uni.a l local

#create 3 more unicast IPCPs, and enroll them with the first
irm i e t unicast n uni.b l net
irm b i uni.b n net
irm b i uni.b n uni.b
irm r n uni.b l local

irm i e t unicast n uni.c l net
irm b i uni.c n net
irm b i uni.c n uni.c
irm r n uni.c l local

irm i e t unicast n uni.d l net
irm b i uni.d n net
irm b i uni.d n uni.d
irm r n uni.d l local

#connect uni.b to uni.a this creates a DT flow and a mgmt flow
irm i conn name uni.b dst uni.a

#now do the same for the others, creating a square
irm i conn name uni.c dst uni.b
irm i conn name uni.d dst uni.c
irm i conn name uni.d dst uni.a

#register the oping application at 4 different locations
#this allows us to check the multipath implementation
irm r n oping.a i uni.a
irm r n oping.b i uni.b
irm r n oping.c i uni.c
irm r n oping.d i uni.d

#bind oping program to oping names
irm b prog oping n oping.a
irm b prog oping n oping.b
irm b prog oping n oping.c
irm b prog oping n oping.d

#good to go!
```

In order to test the setup, start an irmd (preferably in a terminal so
you can see what's going on). In another terminal, run the above
script and then start an oping server:

```bash
$ ./ecmpscript
$ oping -l
Ouroboros ping server started.
```

This single server program will accept all flows for oping from any of
the unicast IPCPs. Ouroboros _multi-homing_ in action.

Open another terminal, and type the following command:

```bash
$ watch -n 1 'grep "sent (packets)" /tmp/ouroboros/uni.a/dt.*/6* | sed -n -e 1p -e 7p'
```

This will show you the packet statistics from the 2 data transfer
flows from the first IPCP (uni.a).

On my machine it looks like this:

```
Every 1,0s: grep "sent (packets)" /tmp/ouroboros/uni.a/dt.*/6* | sed -n -e 1p -e 7p

/tmp/ouroboros/uni.a/dt.1896199821/65: sent (packets):                            10
/tmp/ouroboros/uni.a/dt.1896199821/67: sent (packets):                             6
```

Now, from yet another terminal, run connect an oping client to oping.c
(the client should attach to the first IPCP, so oping.c should be the
one with 2 equal cost paths) and watch both counters increase:

```bash
oping -n oping.c -i 100ms
```

When you do this to the other destinations (oping.b and oping.d) you
should see only one of the flow counters increasing.

Hope you enjoyed this little demo!

Dimitri